diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-02-07 11:11:18 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-02-12 12:47:42 +0100 |
commit | d34e3445bd1482bf79f1fb6b2bf5a1c324e05c13 (patch) | |
tree | c95037080c9a41fcba9c6b1ac00e177afb2588fd /tests/auto/qml | |
parent | b9de07daebebe879fd793b278cad3b205f207c99 (diff) |
Stabilize tst_qqmltimer::restart()
Double the intervals. Some operating systems are sloppier with
scheduling and we apparently trigger the timer a third time during the
wait interval. We waited 600ms + 300ms = 900ms and expected the 500ms
timer to hit only once before the restart. That was probably too tight.
We also lower the second wait time by 100ms to allow for some more time
skew, and check all intermediate states of the trigger counter.
Change-Id: I2f83ffb0e05f1939d3525cd649322a4331986c3c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Diffstat (limited to 'tests/auto/qml')
-rw-r--r-- | tests/auto/qml/qqmltimer/tst_qqmltimer.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp b/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp index 4e42d02514..0168663cf2 100644 --- a/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp +++ b/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp @@ -311,7 +311,7 @@ void tst_qqmltimer::restart() { QQmlEngine engine; QQmlComponent component(&engine); - component.setData(QByteArray("import QtQml 2.0\nTimer { interval: 500; repeat: true; running: true }"), QUrl::fromLocalFile("")); + component.setData(QByteArray("import QtQml 2.0\nTimer { interval: 1000; repeat: true; running: true }"), QUrl::fromLocalFile("")); QQmlTimer *timer = qobject_cast<QQmlTimer*>(component.create()); QVERIFY(timer != nullptr); @@ -319,14 +319,16 @@ void tst_qqmltimer::restart() connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout())); QCOMPARE(helper.count, 0); - consistentWait(600); + consistentWait(1200); QCOMPARE(helper.count, 1); - consistentWait(300); + consistentWait(500); + QCOMPARE(helper.count, 1); timer->restart(); + QCOMPARE(helper.count, 1); - consistentWait(700); + consistentWait(1400); QCOMPARE(helper.count, 2); QVERIFY(timer->isRunning()); |