diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2019-03-26 19:20:24 +0100 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2019-04-01 14:39:34 +0000 |
commit | f3002b6e205463305502600df95b1ae509e47a9b (patch) | |
tree | c5406585bd37677355973deee1a90d57a8bb0d4f /tests/auto/corelib/tools/qtime | |
parent | ad313595e0662fa2e91676feef65aad5b4525a86 (diff) |
Use the QTime API less clumsily
Various patterns seem to have been copied, notably counting time from
QTime(0, 0) rather than using QTime::msecsSinceStartOfDay() and its
setter. Unsuitable value types also put in an appearance, and
QTime()'s parameters after the first two default to 0 anyway.
Corrected a lie in QTime()'s default constructor doc; it does not work
the same as QTime(0, 0) at all.
Change-Id: Icf1a10052a049e68fd0f665958f36dbe75ac46d5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/tools/qtime')
-rw-r--r-- | tests/auto/corelib/tools/qtime/tst_qtime.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/auto/corelib/tools/qtime/tst_qtime.cpp b/tests/auto/corelib/tools/qtime/tst_qtime.cpp index 3e5724213e..3403c5bf7f 100644 --- a/tests/auto/corelib/tools/qtime/tst_qtime.cpp +++ b/tests/auto/corelib/tools/qtime/tst_qtime.cpp @@ -95,8 +95,9 @@ void tst_QTime::addSecs_data() QTest::newRow("Data0") << QTime(0,0,0) << 200 << QTime(0,3,20); QTest::newRow("Data1") << QTime(0,0,0) << 20 << QTime(0,0,20); - QTest::newRow("overflow") << QTime(0,0,0) << (INT_MAX / 1000 + 1) - << QTime(0,0,0).addSecs((INT_MAX / 1000 + 1) % 86400); + QTest::newRow("overflow") + << QTime(0,0,0) << (INT_MAX / 1000 + 1) + << QTime::fromMSecsSinceStartOfDay(((INT_MAX / 1000 + 1) % 86400) * 1000); } void tst_QTime::addSecs() |