diff options
author | Robin Burchell <robin+qt@viroteck.net> | 2013-05-09 11:42:05 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@digia.com> | 2014-09-03 13:19:35 +0200 |
commit | 3006bd2d44298babd1339c3fc3a67ad0696bcefc (patch) | |
tree | 985bec0889f7d2dfbcde59848aeac9e0ea42df2a /tests/auto/corelib/tools/qelapsedtimer | |
parent | 8d0e6000cb326130605b2b5e688e9cdc65950794 (diff) |
Make QElapsedTimer default to invalid (and now non-POD).
The practical uses of a POD QElapsedTimer are not really that clear, and the
number of misuses of this API are quite high. Default the state to invalid to
prevent against mistakes.
[ChangeLog][QtCore][QElapsedTimer] Is no longer a POD.
Change-Id: I267292acf2bfca7404e3e449dd04410441d7ce26
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'tests/auto/corelib/tools/qelapsedtimer')
-rw-r--r-- | tests/auto/corelib/tools/qelapsedtimer/tst_qelapsedtimer.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/tests/auto/corelib/tools/qelapsedtimer/tst_qelapsedtimer.cpp b/tests/auto/corelib/tools/qelapsedtimer/tst_qelapsedtimer.cpp index f2852f6a50..48e3745be4 100644 --- a/tests/auto/corelib/tools/qelapsedtimer/tst_qelapsedtimer.cpp +++ b/tests/auto/corelib/tools/qelapsedtimer/tst_qelapsedtimer.cpp @@ -48,12 +48,7 @@ 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 << ")"; + s.nospace() << "(" << t.msecsSinceReference() << ")"; return s.space(); } @@ -81,8 +76,7 @@ void tst_QElapsedTimer::validity() { QElapsedTimer t; - t.invalidate(); - QVERIFY(!t.isValid()); + QVERIFY(!t.isValid()); // non-POD now, it should always start invalid t.start(); QVERIFY(t.isValid()); |