aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-07-22 17:30:21 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-07-22 15:41:00 +0000
commitf48f317f4ad9a9173eb1edcb2d06ac200a1dd7c7 (patch)
treedb26e58f98c60d712c21080967eb758de72c1e43
parent9fc9bedb2a74940bf8a4f6f55a7b59e435f2acab (diff)
tst_button: stabilize auto-repeat tests
In a busy CI environment, the wait loop of tryCompare/Verify(), which is based on timers, may slip through more auto-repeats than expected. Ideally the repeat count should match the expected value of 2, of course, but we can accept the result as long as there are at least 2 repeats that verifies that the button actually starts repeating. It now throws warnings when it happens, which it has now done several times in the CI recently. It should basically never happen when running the tests locally (neither has the test failed when run locally). Change-Id: I2a7faaca7f11094512d68955b581fdf71b014d92 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
-rw-r--r--tests/auto/controls/data/tst_button.qml14
1 files changed, 10 insertions, 4 deletions
diff --git a/tests/auto/controls/data/tst_button.qml b/tests/auto/controls/data/tst_button.qml
index 3b241090..cc588016 100644
--- a/tests/auto/controls/data/tst_button.qml
+++ b/tests/auto/controls/data/tst_button.qml
@@ -210,8 +210,11 @@ TestCase {
control.spy.expectedSequence = repeatSequence
mousePress(control)
compare(control.pressed, true)
- tryCompare(clickSpy, "count", repeatCount)
- verify(control.spy.success)
+ tryVerify(function() { return clickSpy.count >= repeatCount })
+ if (clickSpy.count > repeatCount)
+ warn("Expected auto-repeat count " + repeatCount + " exceeded (" + clickSpy.count + ") - busy CI?")
+ else
+ verify(control.spy.success)
control.spy.expectedSequence = [["pressedChanged", { "pressed": false }],
["downChanged", { "down": false }],
@@ -226,8 +229,11 @@ TestCase {
control.spy.expectedSequence = repeatSequence
keyPress(Qt.Key_Space)
compare(control.pressed, true)
- tryCompare(clickSpy, "count", repeatCount)
- verify(control.spy.success)
+ tryVerify(function() { return clickSpy.count >= repeatCount })
+ if (clickSpy.count > repeatCount)
+ warn("Expected auto-repeat count " + repeatCount + " exceeded (" + clickSpy.count + ") - busy CI?")
+ else
+ verify(control.spy.success)
control.spy.expectedSequence = [["pressedChanged", { "pressed": false }],
["downChanged", { "down": false }],