Remove #if 0 usage in QElapsedTimer autotest.
authorLeonard Lee <leonard.lee@digia.com>
Wed, 3 Oct 2012 12:06:07 +0000 (14:06 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Thu, 4 Oct 2012 01:03:35 +0000 (03:03 +0200)
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>
tests/auto/corelib/tools/qelapsedtimer/tst_qelapsedtimer.cpp

index 907885c..6902d41 100644 (file)
@@ -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);