aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2019-02-12 14:19:19 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2019-02-12 15:06:28 +0000
commit91a71bce9c633934540e9f06fb081e3b89259ff3 (patch)
tree59f505d591c65a84e8bddd68b5373854e560cb12
parenteeedd26f35369a61d66283b8e2994a6e87c314fe (diff)
Defer QML testing until event loop has started
Executing the event loop means we get various things set up properly, such as runloop auto-release pools on macOS. If not, the whole test suite will be run as a result of the setWindowShown call. Change-Id: Ie217d803208134c5be7db0ee04fbfab86702b521 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
-rw-r--r--src/qmltest/quicktest.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp
index 8fe9da5e09..1a5cad5d5a 100644
--- a/src/qmltest/quicktest.cpp
+++ b/src/qmltest/quicktest.cpp
@@ -57,6 +57,7 @@
#include <QtCore/qdebug.h>
#include <QtCore/qeventloop.h>
#include <QtCore/qtextstream.h>
+#include <QtCore/qtimer.h>
#include <QtGui/qtextdocument.h>
#include <stdio.h>
#include <QtGui/QGuiApplication>
@@ -577,7 +578,10 @@ int quick_test_main_with_setup(int argc, char **argv, const char *name, const ch
<< "Test '" << QDir::toNativeSeparators(path) << "' window not active after requestActivate().";
}
if (view.isExposed()) {
- QTestRootObject::instance()->setWindowShown(true);
+ // Defer property update until event loop has started
+ QTimer::singleShot(0, []() {
+ QTestRootObject::instance()->setWindowShown(true);
+ });
} else {
qWarning().nospace()
<< "Test '" << QDir::toNativeSeparators(path) << "' window was never exposed! "