diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative/qsgpositioners/tst_qsgpositioners.cpp | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/tests/auto/declarative/qsgpositioners/tst_qsgpositioners.cpp b/tests/auto/declarative/qsgpositioners/tst_qsgpositioners.cpp index e425e33b3d..2ea8205b08 100644 --- a/tests/auto/declarative/qsgpositioners/tst_qsgpositioners.cpp +++ b/tests/auto/declarative/qsgpositioners/tst_qsgpositioners.cpp @@ -96,7 +96,7 @@ private slots: void test_attachedproperties_dynamic(); private: - QSGView *createView(const QString &filename); + QSGView *createView(const QString &filename, bool wait=true); }; tst_qsgpositioners::tst_qsgpositioners() @@ -230,7 +230,7 @@ void tst_qsgpositioners::test_horizontal_spacing_rightToLeft() void tst_qsgpositioners::test_horizontal_animated() { - QSGView *canvas = createView(SRCDIR "/data/horizontal-animated.qml"); + QSGView *canvas = createView(SRCDIR "/data/horizontal-animated.qml", false); canvas->rootObject()->setProperty("testRightToLeft", false); @@ -248,6 +248,8 @@ void tst_qsgpositioners::test_horizontal_animated() QCOMPARE(two->x(), -100.0); QCOMPARE(three->x(), -100.0); + QTest::qWaitForWindowShown(canvas); //It may not relayout until the next frame, so it needs to be drawn + QSGItem *row = canvas->rootObject()->findChild<QSGItem*>("row"); QVERIFY(row); QCOMPARE(row->width(), 100.0); @@ -282,7 +284,7 @@ void tst_qsgpositioners::test_horizontal_animated() void tst_qsgpositioners::test_horizontal_animated_rightToLeft() { - QSGView *canvas = createView(SRCDIR "/data/horizontal-animated.qml"); + QSGView *canvas = createView(SRCDIR "/data/horizontal-animated.qml", false); canvas->rootObject()->setProperty("testRightToLeft", true); @@ -300,6 +302,8 @@ void tst_qsgpositioners::test_horizontal_animated_rightToLeft() QCOMPARE(two->x(), -100.0); QCOMPARE(three->x(), -100.0); + QTest::qWaitForWindowShown(canvas); //It may not relayout until the next frame, so it needs to be drawn + QSGItem *row = canvas->rootObject()->findChild<QSGItem*>("row"); QVERIFY(row); QCOMPARE(row->width(), 100.0); @@ -431,7 +435,7 @@ void tst_qsgpositioners::test_vertical_spacing() void tst_qsgpositioners::test_vertical_animated() { - QSGView *canvas = createView(SRCDIR "/data/vertical-animated.qml"); + QSGView *canvas = createView(SRCDIR "/data/vertical-animated.qml", false); //Note that they animate in QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one"); @@ -446,6 +450,8 @@ void tst_qsgpositioners::test_vertical_animated() QVERIFY(three != 0); QCOMPARE(three->y(), -100.0); + QTest::qWaitForWindowShown(canvas); //It may not relayout until the next frame, so it needs to be drawn + QSGItem *column = canvas->rootObject()->findChild<QSGItem*>("column"); QVERIFY(column); QCOMPARE(column->height(), 100.0); @@ -662,7 +668,7 @@ void tst_qsgpositioners::test_grid_row_column_spacing() void tst_qsgpositioners::test_grid_animated() { - QSGView *canvas = createView(SRCDIR "/data/grid-animated.qml"); + QSGView *canvas = createView(SRCDIR "/data/grid-animated.qml", false); canvas->rootObject()->setProperty("testRightToLeft", false); @@ -692,6 +698,8 @@ void tst_qsgpositioners::test_grid_animated() QCOMPARE(five->x(), -100.0); QCOMPARE(five->y(), -100.0); + QTest::qWaitForWindowShown(canvas); //It may not relayout until the next frame, so it needs to be drawn + QSGItem *grid = canvas->rootObject()->findChild<QSGItem*>("grid"); QVERIFY(grid); QCOMPARE(grid->width(), 150.0); @@ -745,7 +753,7 @@ void tst_qsgpositioners::test_grid_animated() void tst_qsgpositioners::test_grid_animated_rightToLeft() { - QSGView *canvas = createView(SRCDIR "/data/grid-animated.qml"); + QSGView *canvas = createView(SRCDIR "/data/grid-animated.qml", false); canvas->rootObject()->setProperty("testRightToLeft", true); @@ -775,6 +783,8 @@ void tst_qsgpositioners::test_grid_animated_rightToLeft() QCOMPARE(five->x(), -100.0); QCOMPARE(five->y(), -100.0); + QTest::qWaitForWindowShown(canvas); //It may not relayout until the next frame, so it needs to be drawn + QSGItem *grid = canvas->rootObject()->findChild<QSGItem*>("grid"); QVERIFY(grid); QCOMPARE(grid->width(), 150.0); @@ -1453,13 +1463,14 @@ void tst_qsgpositioners::test_attachedproperties_dynamic() delete canvas; } -QSGView *tst_qsgpositioners::createView(const QString &filename) +QSGView *tst_qsgpositioners::createView(const QString &filename, bool wait) { QSGView *canvas = new QSGView(0); canvas->setSource(QUrl::fromLocalFile(filename)); canvas->show(); - QTest::qWaitForWindowShown(canvas); //It may not relayout until the next frame, so it needs to be drawn + if (wait) + QTest::qWaitForWindowShown(canvas); //It may not relayout until the next frame, so it needs to be drawn return canvas; } |