tst_qstatusbar: Allow a little more leeway in timer checking.

Timer granularity means that sometimes this won't wait the full timeout before
vanishing the message. Add some extra tolerance so we don't unnecessarily fail
integrations.

Change-Id: I203ac16cda7bd1f0437dd3febc0509c17e86c25a
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
Robin Burchell 2014-08-28 12:53:43 +02:00 committed by Marc Mutz
parent 6f52256dc2
commit 9b599c6cea

View File

@ -294,7 +294,12 @@ void tst_QStatusBar::QTBUG25492_msgtimeout()
// Message disappears after 2 seconds
QTRY_VERIFY(testWidget->currentMessage().isNull());
QVERIFY2(t.elapsed() >= 2000, qPrintable("Timer was " + QString::number(t.elapsed())));
qint64 ts = t.elapsed();
// XXX: ideally ts should be 2000, but sometimes it appears to go away early, probably due to timer granularity.
QVERIFY2(ts >= 1800, qPrintable("Timer was " + QString::number(ts)));
if (ts < 2000)
qWarning("QTBUG25492_msgtimeout: message vanished early, should be >= 2000, was %lld", ts);
QVERIFY(currentMessage.isNull());
// Set display message for 2 seconds first