summaryrefslogtreecommitdiffstats
path: root/tests/qml
diff options
context:
space:
mode:
authorBernd Weimer <bernd.weimer@pelagicore.com>2020-04-09 15:23:04 +0200
committerBernd Weimer <bernd.weimer@pelagicore.com>2020-04-15 17:33:19 +0200
commitda49b8bb9363216192e8acdde2f5941bb7f29cd7 (patch)
tree94ec40052bb2a9954cd1a7b49443004b96230c57 /tests/qml
parent84f83d69323271c0677abd983c64507e96181002 (diff)
Flush Wayland messages in test case
A SignalSpy in QML tests frequently calls processEvents(), which unfortunately doesn't lead to a flush of the Wayland message queue. A workaround is implemented that forces flushing by manually emitting the aboutToBlock signal. Task-number: AUTOSUITE-709 Change-Id: I1480d756d9eb00d16181c9c747a3f27bce88891d Reviewed-by: Robert Griebl <robert.griebl@qt.io>
Diffstat (limited to 'tests/qml')
-rw-r--r--tests/qml/configs/tst_configs.qml17
1 files changed, 12 insertions, 5 deletions
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");
}
}