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>
This commit is contained in:
parent
eeedd26f35
commit
91a71bce9c
|
@ -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! "
|
||||
|
|
Loading…
Reference in New Issue