From 91a71bce9c633934540e9f06fb081e3b89259ff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 12 Feb 2019 14:19:19 +0100 Subject: Defer QML testing until event loop has started MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Tor Arne Vestbø --- src/qmltest/quicktest.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/qmltest') 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 #include #include +#include #include #include #include @@ -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! " -- cgit v1.2.3