diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-08-18 11:20:35 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-08-18 11:21:31 (GMT) |
commit | e1c9136214532cc41074449e3a894fdea020a41e (patch) | |
tree | 7fd4b6d3f76bfdd1558d9d5b6ad1cf3819569868 /tests | |
parent | 7d2fb4f6dfbfe843ec2d101c06b891230a49d20a (diff) | |
download | Qt-e1c9136214532cc41074449e3a894fdea020a41e.zip Qt-e1c9136214532cc41074449e3a894fdea020a41e.tar.gz Qt-e1c9136214532cc41074449e3a894fdea020a41e.tar.bz2 |
Fix autotest: on windows, timers are not accurate enough
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qtoolbutton/tst_qtoolbutton.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/auto/qtoolbutton/tst_qtoolbutton.cpp b/tests/auto/qtoolbutton/tst_qtoolbutton.cpp index 6376c5d..aca9a20 100644 --- a/tests/auto/qtoolbutton/tst_qtoolbutton.cpp +++ b/tests/auto/qtoolbutton/tst_qtoolbutton.cpp @@ -222,8 +222,10 @@ void tst_QToolButton::task176137_autoRepeatOfAction() tb.setAutoRepeat (true); QSignalSpy repeatSpy(&action,SIGNAL(triggered())); // new spy QTest::mousePress ( &tb, Qt::LeftButton); - QTest::mouseRelease ( &tb, Qt::LeftButton, 0, QPoint (), 2000); - QCOMPARE (repeatSpy.count(), (2000 - tb.autoRepeatDelay()) / tb.autoRepeatInterval() + 1); + QTest::mouseRelease ( &tb, Qt::LeftButton, 0, QPoint (), 3000); + qreal expected = (3000 - tb.autoRepeatDelay()) / tb.autoRepeatInterval() + 1; + //we check that the difference is less than 10% (on some systems timers are not super accurate) + QVERIFY ( qAbs( (expected - repeatSpy.count()) / expected) < 0.1); } |