aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmltest
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@digia.com>2013-01-17 12:41:53 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-01-17 15:31:04 +0100
commitfc0e916784b88a3a9ad12263ecc617c0a383664e (patch)
tree974aaafa26a16a8bea2834b31682985d38b6ec37 /src/qmltest
parent559851ef0c06e31b5b844d027ff3a8c500f2863c (diff)
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 <samuel.rodal@digia.com>
Diffstat (limited to 'src/qmltest')
-rw-r--r--src/qmltest/quicktest.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp
index 705908c3c4..ce44bc48a9 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();