aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2011-09-16 11:50:15 +1000
committerQt by Nokia <qt-info@nokia.com>2011-09-16 03:54:35 +0200
commit23966bf69eb97314b1af232efa05fb3376275b0e (patch)
treed53bc2476f8fe16231223dca3751a1de1c93d771
parent4a5d31a56dfd871f3f7c5ce162885ebc870b8803 (diff)
Fix qsgpositioners autotest
A waitForWindowShown now takes long enough of the animations to make progress, which had been confusing the initial state checks. Task-number: QTBUG-21414 Change-Id: I3e01f804d6bca7f627012da6cc69b0baabaabaaa Reviewed-on: http://codereview.qt-project.org/5041 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
-rw-r--r--tests/auto/declarative/qsgpositioners/tst_qsgpositioners.cpp27
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;
}