From 9b599c6cea0a7f265caf6db09dccd31f0c805ff9 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Thu, 28 Aug 2014 12:53:43 +0200 Subject: [PATCH] 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 --- tests/auto/widgets/widgets/qstatusbar/tst_qstatusbar.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/auto/widgets/widgets/qstatusbar/tst_qstatusbar.cpp b/tests/auto/widgets/widgets/qstatusbar/tst_qstatusbar.cpp index 7c3ef3613b..38eae1d19d 100644 --- a/tests/auto/widgets/widgets/qstatusbar/tst_qstatusbar.cpp +++ b/tests/auto/widgets/widgets/qstatusbar/tst_qstatusbar.cpp @@ -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