summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorRohan McGovern <rohan.mcgovern@nokia.com>2012-06-05 14:24:18 +1000
committerQt by Nokia <qt-info@nokia.com>2012-06-05 09:21:36 +0200
commit4eecbf3b842afcfb91d78552ce19d2c0b8f8c53a (patch)
treecd863a169f89372cb125d1a3d5fb2b5768e44c8c /tests/auto
parenta3768cb3bd27213a262518535d2d9edc88754dd9 (diff)
tst_qtoolbutton: stabilize and improve failure message
Allow for a little more leeway in timers. Task-number: QTBUG-26004 Change-Id: I59936d0f675b7f734e04b3f5e63631c74ca4f163 Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com> Reviewed-by: Kalle Lehtonen <kalle.ju.lehtonen@nokia.com>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp b/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp
index df4efd658a..97c740ba7b 100644
--- a/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp
+++ b/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp
@@ -218,8 +218,13 @@ void tst_QToolButton::task176137_autoRepeatOfAction()
QTest::mousePress ( &tb, Qt::LeftButton);
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);
+ //we check that the difference is small (on some systems timers are not super accurate)
+ qreal diff = (expected - repeatSpy.count()) / expected;
+ QVERIFY2(qAbs(diff) < 0.2, qPrintable(
+ QString("expected: %1, actual: %2, diff (fraction): %3")
+ .arg(expected)
+ .arg(repeatSpy.count())
+ .arg(diff)));
}