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>bb10
parent
a3768cb3bd
commit
4eecbf3b84
|
|
@ -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)));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue