diff options
-rw-r--r-- | tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp | 9 |
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))); } |