summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRohan McGovern <rohan.mcgovern@nokia.com>2012-06-05 04:24:18 (GMT)
committerQt by Nokia <qt-info@nokia.com>2012-08-28 20:34:15 (GMT)
commit8ec8439755e33aee40db14f8a2b5073e420294e7 (patch)
tree6be66531709759139b16de2d75f9d4add4f299ef /tests
parent9520674b0f02aac55da6d98a6c56c74ce240cca6 (diff)
downloadQt-8ec8439755e33aee40db14f8a2b5073e420294e7.zip
Qt-8ec8439755e33aee40db14f8a2b5073e420294e7.tar.gz
Qt-8ec8439755e33aee40db14f8a2b5073e420294e7.tar.bz2
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> (cherry picked from commit 4eecbf3b842afcfb91d78552ce19d2c0b8f8c53a) Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qtoolbutton/tst_qtoolbutton.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/auto/qtoolbutton/tst_qtoolbutton.cpp b/tests/auto/qtoolbutton/tst_qtoolbutton.cpp
index 98a673e..1a9e7cb 100644
--- a/tests/auto/qtoolbutton/tst_qtoolbutton.cpp
+++ b/tests/auto/qtoolbutton/tst_qtoolbutton.cpp
@@ -224,8 +224,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)));
}