diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-04-13 23:31:53 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-04-13 23:31:53 (GMT) |
commit | 6ee86ddfcf5ff5fe0aadc835101c1e6f46b2a126 (patch) | |
tree | c7847f428c83592747b62cef82906d458bc136c9 /tests/auto/qelapsedtimer | |
parent | 9416f29a3ee7511c182eaa68f5523132ff64921d (diff) | |
parent | a5e9e86a6daddde6fb906cbf09bf562e50b17698 (diff) | |
download | Qt-6ee86ddfcf5ff5fe0aadc835101c1e6f46b2a126.zip Qt-6ee86ddfcf5ff5fe0aadc835101c1e6f46b2a126.tar.gz Qt-6ee86ddfcf5ff5fe0aadc835101c1e6f46b2a126.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'tests/auto/qelapsedtimer')
-rw-r--r-- | tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp b/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp index 9ea422c..87df57d 100644 --- a/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp +++ b/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp @@ -46,6 +46,17 @@ static const int minResolution = 50; // the minimum resolution for the tests +QDebug operator<<(QDebug s, const QElapsedTimer &t) +{ + union { + QElapsedTimer t; + struct { qint64 t1, t2; } i; + } copy; + copy.t = t; + s.nospace() << "(" << copy.i.t1 << ", " << copy.i.t2 << ")"; + return s.space(); +} + class tst_QElapsedTimer : public QObject { Q_OBJECT @@ -110,15 +121,17 @@ void tst_QElapsedTimer::basics() #endif quint64 value1 = t1.msecsSinceReference(); + qDebug() << value1 << t1; qint64 elapsed = t1.restart(); QVERIFY(elapsed < minResolution); quint64 value2 = t1.msecsSinceReference(); + qDebug() << value2 << t1 << elapsed; // in theory, elapsed == value2 - value1 // However, since QElapsedTimer keeps internally the full resolution, // we have here a rounding error due to integer division - QVERIFY(qAbs(elapsed - qint64(value2 - value1)) < 1); + QVERIFY(qAbs(elapsed - qint64(value2 - value1)) <= 1); } void tst_QElapsedTimer::elapsed() |