Remove #if 0 usage in QElapsedTimer autotest.
Given QElapsedTimer t1, t2 variable, the t1-t2, t1+1000 (add 1 second) operations not supported. Task-number: QTBUG-22446 Change-Id: Idd87f778c212831aa7f92242452538d113c9cfcf Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
679a4e98c7
commit
122b09c1d0
@ -103,32 +103,17 @@ void tst_QElapsedTimer::basics()
|
||||
QVERIFY(!(t1 < t1));
|
||||
QCOMPARE(t1.msecsTo(t1), qint64(0));
|
||||
QCOMPARE(t1.secsTo(t1), qint64(0));
|
||||
// QCOMPARE(t1 + 0, t1);
|
||||
// QCOMPARE(t1 - 0, t1);
|
||||
|
||||
#if 0
|
||||
QElapsedTimer t2 = t1;
|
||||
t2 += 1000; // so we can use secsTo
|
||||
|
||||
QVERIFY(t1 != t2);
|
||||
QVERIFY(!(t1 == t2));
|
||||
QVERIFY(t1 < t2);
|
||||
QVERIFY(!(t2 < t1));
|
||||
QCOMPARE(t1.msecsTo(t2), qint64(1000));
|
||||
QCOMPARE(t1.secsTo(t2), qint64(1));
|
||||
// QCOMPARE(t2 - t1, qint64(1000));
|
||||
// QCOMPARE(t1 - t2, qint64(-1000));
|
||||
#endif
|
||||
|
||||
quint64 value1 = t1.msecsSinceReference();
|
||||
qDebug() << value1 << t1;
|
||||
qDebug() << "value1:" << value1 << "t1:" << t1;
|
||||
qint64 nsecs = t1.nsecsElapsed();
|
||||
qint64 elapsed = t1.restart();
|
||||
QVERIFY(elapsed < minResolution);
|
||||
QVERIFY(nsecs / 1000000 < minResolution);
|
||||
|
||||
quint64 value2 = t1.msecsSinceReference();
|
||||
qDebug() << value2 << t1 << elapsed << nsecs;
|
||||
qDebug() << "value2:" << value2 << "t1:" << t1
|
||||
<< "elapsed:" << elapsed << "nsecs:" << nsecs;
|
||||
// in theory, elapsed == value2 - value1
|
||||
|
||||
// However, since QElapsedTimer keeps internally the full resolution,
|
||||
@ -149,8 +134,6 @@ void tst_QElapsedTimer::elapsed()
|
||||
QVERIFY(!(t1 == t2));
|
||||
QVERIFY(t1 < t2);
|
||||
QVERIFY(t1.msecsTo(t2) > 0);
|
||||
// don't check: t1.secsTo(t2)
|
||||
// QVERIFY(t1 - t2 < 0);
|
||||
|
||||
QVERIFY(t1.nsecsElapsed() > 0);
|
||||
QVERIFY(t1.elapsed() > 0);
|
||||
|
Loading…
Reference in New Issue
Block a user