qquicktest: Wait for the view to finish loading
authorDaiwei Li <daiweili@suitabletech.com>
Fri, 23 Jan 2015 22:42:33 +0000 (14:42 -0800)
committerDaiwei Li <daiweili@suitabletech.com>
Tue, 3 Feb 2015 02:04:40 +0000 (02:04 +0000)
Tests can be skipped if the view is still loading by the time we get
to the end of the loop. There is a case where the window is active
but the QML hasn't been loaded.

Change-Id: I4e8346ee547653810458d042925d673748c1fec8
Reviewed-by: Caroline Chao <caroline.chao@theqtcompany.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
src/qmltest/quicktest.cpp

index bef20c6..0c8bfab 100644 (file)
@@ -362,6 +362,10 @@ int quick_test_main(int argc, char **argv, const char *name, const char *sourceD
             }
             view->show();
             view->requestActivate();
+
+            while (view->status() == QQuickView::Loading)
+                QTest::qWait(10);
+
             QTest::qWaitForWindowActive(view);
             if (view->isExposed())
                 QTestRootObject::instance()->setWindowShown(true);