50 ms isn't enough for the CI, so increase to 100 ms

This should reduce the failure rate. We're still doing qSleep of the
same amount of time, but we now only fail if the slip is over 100 ms.

Task-number: QTBUG-58713
Change-Id: I536c32a88bff44dab37afffd14a1afdf0b2e522a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
Thiago Macieira 2017-02-09 09:52:04 -08:00 committed by David Faure
parent b58af67d7b
commit cab4d495b2

View File

@ -31,7 +31,7 @@
#include <QtCore/QElapsedTimer>
#include <QtTest/QtTest>
static const int minResolution = 50; // the minimum resolution for the tests
static const int minResolution = 100; // the minimum resolution for the tests
QDebug operator<<(QDebug s, const QElapsedTimer &t)
{
@ -107,7 +107,7 @@ void tst_QElapsedTimer::elapsed()
QElapsedTimer t1;
t1.start();
QTest::qSleep(4*minResolution);
QTest::qSleep(2*minResolution);
QElapsedTimer t2;
t2.start();
@ -128,8 +128,8 @@ void tst_QElapsedTimer::elapsed()
QVERIFY(!t2.hasExpired(-1));
qint64 elapsed = t1.restart();
QVERIFY(elapsed > 3*minResolution);
QVERIFY(elapsed < 5*minResolution);
QVERIFY(elapsed > minResolution);
QVERIFY(elapsed < 3*minResolution);
qint64 diff = t2.msecsTo(t1);
QVERIFY(diff < minResolution);
}