summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/tools/testrunner/testrunner.cpp6
-rw-r--r--src/tools/testrunner/testrunner_p.h1
-rw-r--r--tests/qml/configs/tst_configs.qml17
3 files changed, 19 insertions, 5 deletions
diff --git a/src/tools/testrunner/testrunner.cpp b/src/tools/testrunner/testrunner.cpp
index 7402adad..d8837b01 100644
--- a/src/tools/testrunner/testrunner.cpp
+++ b/src/tools/testrunner/testrunner.cpp
@@ -43,6 +43,7 @@
#include "testrunner.h"
#include <QCoreApplication>
+#include <QAbstractEventDispatcher>
#include <QEventLoop>
#include <QQmlEngine>
#include <QRegExp>
@@ -130,6 +131,11 @@ int AmTest::observeObjectDestroyed(QObject *obj)
return index;
}
+void AmTest::aboutToBlock()
+{
+ emit QAbstractEventDispatcher::instance()->aboutToBlock();
+}
+
QTestRootObject::QTestRootObject(QObject *parent)
: QObject(parent)
diff --git a/src/tools/testrunner/testrunner_p.h b/src/tools/testrunner/testrunner_p.h
index cf00f516..3c4cbde0 100644
--- a/src/tools/testrunner/testrunner_p.h
+++ b/src/tools/testrunner/testrunner_p.h
@@ -100,6 +100,7 @@ public:
Q_INVOKABLE void ignoreMessage(MsgType type, const char* msg);
Q_INVOKABLE void ignoreMessage(MsgType type, const QRegExp &expression);
Q_INVOKABLE int observeObjectDestroyed(QObject *obj);
+ Q_INVOKABLE void aboutToBlock();
Q_SIGNALS:
void objectDestroyed(int index);
diff --git a/tests/qml/configs/tst_configs.qml b/tests/qml/configs/tst_configs.qml
index 7e92e89f..6acbb67c 100644
--- a/tests/qml/configs/tst_configs.qml
+++ b/tests/qml/configs/tst_configs.qml
@@ -42,6 +42,7 @@
import QtQuick 2.4
import QtTest 1.0
+import QtApplicationManager 2.0
import QtApplicationManager.SystemUI 2.0
@@ -68,6 +69,13 @@ TestCase {
SignalSpy {
id: windowPropertyChangedSpy
+ // Workaround to flush Wayland messages, see https://bugreports.qt.io/browse/AUTOSUITE-709
+ // A proper solution in QtWayland is sought here: https://bugreports.qt.io/browse/QTBUG-83422
+ function aboutToBlockWait(timeout)
+ {
+ AmTest.aboutToBlock();
+ wait(timeout);
+ }
target: WindowManager
signalName: "windowPropertyChanged"
}
@@ -109,13 +117,12 @@ TestCase {
}
window.setWindowProperty("trigger", "now");
- windowPropertyChangedSpy.wait();
+ windowPropertyChangedSpy.aboutToBlockWait();
compare(windowPropertyChangedSpy.signalArguments[0][0], window);
compare(window.windowProperty("trigger"), "now");
- // The following would only work in single-process mode (see https://bugreports.qt.io/browse/AUTOSUITE-709)
- // windowPropertyChangedSpy.wait();
- // compare(windowPropertyChangedSpy.signalArguments[1][0], window);
- // compare(window.windowProperty("ack"), "done");
+ windowPropertyChangedSpy.wait();
+ compare(windowPropertyChangedSpy.signalArguments[1][0], window);
+ compare(window.windowProperty("ack"), "done");
}
}