From 6938289ce3e1e29cc81f0e007390e0b5f6ef1a43 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Wed, 22 Jun 2011 13:04:30 +1000 Subject: Fix autotests --- .../qdeclarativeimage/tst_qdeclarativeimage.cpp | 1 - .../tst_qdeclarativeinstruction.cpp | 3 ++- .../auto/declarative/qsgtextedit/tst_qsgtextedit.cpp | 5 +---- .../declarative/qsgtextinput/tst_qsgtextinput.cpp | 20 +++++++++++--------- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp index 8044b8097a..b5aaa007e9 100644 --- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp +++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp @@ -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: diff --git a/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp b/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp index fda16409b7..1aa9a5d5b1 100644 --- a/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp +++ b/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp @@ -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); } @@ -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" diff --git a/tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp b/tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp index 40920e3c24..ea9260772e 100644 --- a/tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp +++ b/tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp @@ -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); diff --git a/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp b/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp index 72d5288824..77427253a6 100644 --- a/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp +++ b/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp @@ -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); @@ -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); @@ -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(); } -- cgit v1.2.3