From: Gunnar Sletta Date: Thu, 17 Jan 2013 11:41:53 +0000 (+0100) Subject: Avoid race condition in QQuickTests X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=fc0e916784b88a3a9ad12263ecc617c0a383664e;p=konrad%2Fqtdeclarative.git Avoid race condition in QQuickTests The QQuickView::show() function may or may not be synchronous and because the rendering happens on another thread, the frameSwapped can be emitted before we enter the qWaitForSignal() event loop. Fix this by waiting for the window to become exposed instead, which implies that it has rendered at least one frame. Change-Id: I1100a6fe981018395bf141d67f06adb94a354206 Reviewed-by: Samuel Rødal --- diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp index 705908c..ce44bc4 100644 --- a/src/qmltest/quicktest.cpp +++ b/src/qmltest/quicktest.cpp @@ -339,7 +339,8 @@ int quick_test_main(int argc, char **argv, const char *name, const char *sourceD view->resize(200, 200); } view->show(); - if (qWaitForSignal(view, SIGNAL(frameSwapped()))) + QTest::qWaitForWindowExposed(view); + if (view->isExposed()) rootobj.setWindowShown(true); if (!rootobj.hasQuit && rootobj.hasTestCase()) eventLoop.exec();