Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix autotests
  • Loading branch information
Aaron Kennedy committed Jun 22, 2011
1 parent 9dd1818 commit 6938289
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
Expand Up @@ -328,7 +328,6 @@ void tst_qdeclarativeimage::mirror()
p_e.drawPixmap(QRect(0, 0, width, height), srcPixmap, QRect(0, 0, srcPixmap.width(), srcPixmap.height()));
break;
case QDeclarativeImage::PreserveAspectFit:
QEXPECT_FAIL("", "QTBUG-19538", Continue);
p_e.drawPixmap(QRect(25, 0, width / (width/height), height), srcPixmap, QRect(0, 0, srcPixmap.width(), srcPixmap.height()));
break;
case QDeclarativeImage::PreserveAspectCrop:
Expand Down
Expand Up @@ -332,6 +332,7 @@ void tst_qdeclarativeinstruction::dump()
i.storeScriptString.propertyIndex = 24;
i.storeScriptString.value = 3;
i.storeScriptString.scope = 1;
i.storeScriptString.bindingId = 3;
data->addInstruction(i);
}

Expand Down Expand Up @@ -535,7 +536,7 @@ void tst_qdeclarativeinstruction::dump()
<< "25\t\tSTORE_VARIANT_OBJECT\t22"
<< "26\t\tSTORE_INTERFACE\t\t23"
<< "27\t\tSTORE_SIGNAL\t\t2\t3\t\t\"console.log(1921)\""
<< "28\t\tSTORE_SCRIPT_STRING\t24\t3\t1\t0"
<< "28\t\tSTORE_SCRIPT_STRING\t24\t3\t1\t3"
<< "29\t\tASSIGN_SIGNAL_OBJECT\t0\t\t\t\"mySignal\""
<< "30\t\tASSIGN_CUSTOMTYPE\t25\t6\t9"
<< "31\t\tSTORE_BINDING\t26\t3\t2"
Expand Down
5 changes: 1 addition & 4 deletions tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp
Expand Up @@ -408,10 +408,7 @@ void tst_qsgtextedit::alignments()
ob->setProperty("horizontalAlignment",hAlign);
ob->setProperty("verticalAlignment",vAlign);
QTRY_COMPARE(ob->property("running").toBool(),false);
QImage actual(canvas.width(), canvas.height(), QImage::Format_RGB32);
actual.fill(qRgb(255,255,255));
QPainter p(&actual);
canvas.render(&p);
QImage actual = canvas.grabFrameBuffer();

expectfile = createExpectedFileIfNotFound(expectfile, actual);

Expand Down
20 changes: 11 additions & 9 deletions tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp
Expand Up @@ -1037,12 +1037,7 @@ void tst_qsgtextinput::horizontalAlignment()
QObject *ob = canvas.rootObject();
QVERIFY(ob != 0);
ob->setProperty("horizontalAlignment",hAlign);
QImage actual(canvas.width(), canvas.height(), QImage::Format_RGB32);
actual.fill(qRgb(255,255,255));
{
QPainter p(&actual);
canvas.render(&p);
}
QImage actual = canvas.grabFrameBuffer();

expectfile = createExpectedFileIfNotFound(expectfile, actual);

Expand Down Expand Up @@ -1736,7 +1731,7 @@ void tst_qsgtextinput::cursorRectangle()

// Check the cursor rectangle remains within the input bounding rect when auto scrolling.
QVERIFY(r.left() < input.boundingRect().width());
QVERIFY(r.right() >= input.width());
QVERIFY(r.right() >= input.width() - error);

for (int i = 6; i < text.length(); ++i) {
input.setCursorPosition(i);
Expand Down Expand Up @@ -2221,18 +2216,25 @@ void tst_qsgtextinput::preeditAutoScroll()
QCOMPARE(input->positionAt(0), 0);
QCOMPARE(input->positionAt(input->width()), 5);

// some tolerance for different fonts.
#ifdef Q_OS_LINUX
const int error = 2;
#else
const int error = 5;
#endif

// test if the preedit is larger than the text input that the
// character preceding the cursor is still visible.
qreal x = input->positionToRectangle(0).x();
for (int i = 0; i < 3; ++i) {
ic.sendPreeditText(preeditText, i + 1);
QVERIFY(input->cursorRectangle().right() >= fm.width(preeditText.at(i)));
QVERIFY(input->cursorRectangle().right() >= fm.width(preeditText.at(i)) - error);
QVERIFY(input->positionToRectangle(0).x() < x);
x = input->positionToRectangle(0).x();
}
for (int i = 1; i >= 0; --i) {
ic.sendPreeditText(preeditText, i + 1);
QVERIFY(input->cursorRectangle().right() >= fm.width(preeditText.at(i)));
QVERIFY(input->cursorRectangle().right() >= fm.width(preeditText.at(i)) - error);
QVERIFY(input->positionToRectangle(0).x() > x);
x = input->positionToRectangle(0).x();
}
Expand Down

0 comments on commit 6938289

Please sign in to comment.