mirror of
https://github.com/simonbrunel/qtpromise.git
synced 2024-11-22 02:34:30 +08:00
Relax timing constraints when checking timeout in tst_timeout
This commit is contained in:
parent
efb6001b9d
commit
8da467e9da
@ -34,8 +34,12 @@ void tst_qpromise_delay::fulfilled()
|
||||
|
||||
QCOMPARE(waitForValue(p, -1), 42);
|
||||
QCOMPARE(p.isFulfilled(), true);
|
||||
QVERIFY(elapsed >= 1000 * 0.95); // Qt::CoarseTimer (default) Coarse timers try to
|
||||
QVERIFY(elapsed <= 1000 * 1.05); // keep accuracy within 5% of the desired interval.
|
||||
|
||||
// Qt::CoarseTimer (default) Coarse timers try to
|
||||
// keep accuracy within 5% of the desired interval.
|
||||
// Require accuracy within 6% for passing the test.
|
||||
QVERIFY(elapsed >= 1000 * 0.94);
|
||||
QVERIFY(elapsed <= 1000 * 1.06);
|
||||
}
|
||||
|
||||
void tst_qpromise_delay::rejected()
|
||||
@ -51,5 +55,5 @@ void tst_qpromise_delay::rejected()
|
||||
|
||||
QCOMPARE(waitForError(p, QString()), QString("foo"));
|
||||
QCOMPARE(p.isRejected(), true);
|
||||
QVERIFY(elapsed < 5);
|
||||
QVERIFY(elapsed <= 10);
|
||||
}
|
||||
|
@ -87,6 +87,10 @@ void tst_qpromise_timeout::timeout()
|
||||
QCOMPARE(waitForValue(p, -1), -1);
|
||||
QCOMPARE(p.isRejected(), true);
|
||||
QCOMPARE(failed, true);
|
||||
QVERIFY(elapsed >= 2000 * 0.95); // Qt::CoarseTimer (default) Coarse timers try to
|
||||
QVERIFY(elapsed <= 2000 * 1.05); // keep accuracy within 5% of the desired interval.
|
||||
|
||||
// Qt::CoarseTimer (default) Coarse timers try to
|
||||
// keep accuracy within 5% of the desired interval.
|
||||
// Require accuracy within 6% for passing the test.
|
||||
QVERIFY(elapsed >= 2000 * 0.94);
|
||||
QVERIFY(elapsed <= 2000 * 1.06);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user