diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-11-10 15:30:22 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-11-17 19:55:04 +0100 |
commit | f5010c49a37729375e37e6fe8cea60dd4b880d83 (patch) | |
tree | f4f8b1498114e3d88ae19c61b6cfb58e792550a8 /tests/auto/widgets/widgets | |
parent | 1d8dd9a02c9715561b365007f1520e41fe64e703 (diff) |
QTest: don't wait before sending mouse event: increment the timestamp
Tests can run faster now, but we still expect calculations based on
the timestamp (such as QEventPoint::velocity()) to be correct.
Change-Id: Ie962604c9ebd139384dcd89a157de66b4b773cc9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests/auto/widgets/widgets')
-rw-r--r-- | tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp b/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp index 32003f2124..9c3b1066a7 100644 --- a/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp +++ b/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp @@ -206,14 +206,16 @@ void tst_QToolButton::task176137_autoRepeatOfAction() QSignalSpy spy(&action,SIGNAL(triggered())); QTest::mousePress (toolButton, Qt::LeftButton); - QTest::mouseRelease (toolButton, Qt::LeftButton, {}, QPoint (), 2000); + QTest::qWait(2000); + QTest::mouseRelease (toolButton, Qt::LeftButton, {}, {}); QCOMPARE(spy.count(),1); // try again with auto repeat toolButton->setAutoRepeat (true); QSignalSpy repeatSpy(&action,SIGNAL(triggered())); // new spy QTest::mousePress (toolButton, Qt::LeftButton); - QTest::mouseRelease (toolButton, Qt::LeftButton, {}, QPoint (), 3000); + QTest::qWait(3000); + QTest::mouseRelease (toolButton, Qt::LeftButton, {}, {}); const qreal expected = (3000 - toolButton->autoRepeatDelay()) / toolButton->autoRepeatInterval() + 1; //we check that the difference is small (on some systems timers are not super accurate) qreal diff = (expected - repeatSpy.count()) / expected; |