Fix unstable GridView test
authorBea Lam <bea.lam@nokia.com>
Mon, 18 Jul 2011 04:14:43 +0000 (14:14 +1000)
committerQt by Nokia <qt-info@nokia.com>
Mon, 25 Jul 2011 04:08:56 +0000 (06:08 +0200)
Change-Id: I1e1f1afe38cced3c85b3e20d37e9859b8304e69c
Reviewed-on: http://codereview.qt.nokia.com/1729
Reviewed-by: Bea Lam <bea.lam@nokia.com>
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
tests/auto/declarative/qsggridview/tst_qsggridview.cpp

index c97a42b..3929c71 100644 (file)
@@ -666,6 +666,7 @@ void tst_QSGGridView::currentIndex()
 
     QSGView *canvas = new QSGView(0);
     canvas->setFixedSize(240,320);
+    canvas->show();
 
     QDeclarativeContext *ctxt = canvas->rootContext();
     ctxt->setContextProperty("testModel", &model);
@@ -726,6 +727,7 @@ void tst_QSGGridView::currentIndex()
     gridview->moveCurrentIndexLeft();
     QCOMPARE(gridview->currentIndex(), model.count()-1);
 
+    qApp->processEvents();
     QTRY_COMPARE(gridview->contentY(), 880.0);
 
     gridview->moveCurrentIndexRight();
@@ -734,7 +736,6 @@ void tst_QSGGridView::currentIndex()
     QTRY_COMPARE(gridview->contentY(), 0.0);
 
     // Test keys
-    canvas->show();
     qApp->setActiveWindow(canvas);
 #ifdef Q_WS_X11
     // to be safe and avoid failing setFocus with window managers