diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2021-02-24 12:15:47 +0100 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2021-03-18 15:30:48 +0100 |
commit | 9d3a7c72ad5308d016bf1315f6eaed0b51a72f65 (patch) | |
tree | 1161d3bca130e5d3ee8d6ad52df28b5ef5db2b3b /tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp | |
parent | eb3395328aa408f7639c0852a6a9690045670092 (diff) |
Extend system zone test to check it matches LocalTime
Test we get the same starts of various days. Some coming changes shall
break some of these, but they should all be back to working by the
time we're taking account of DST before 1970 as well as after.
The first two or three test-cases work by accident in most zones, at
present, due to the zone-based code-path ignoring the LMT period
before the zone's first transition; but Europe/Helsinki had a renaming
transition in 1878, so does see its pre-zone offset between then and
the switch to UTC+2 in 1921, leading to failures in exactly the zone
Coin tests. So suppress these three test-cases pending later fixes.
On Windows, the next text (still pre-epoch) gets bogus zone data for
its LocalTime, so suppress that likewise.
Task-number: QTBUG-80421
Change-Id: I2264e0e436d92112b03264faa410e30057b8f73b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp')
-rw-r--r-- | tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp b/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp index ca7ddf0c2d..f20f338517 100644 --- a/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp +++ b/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp @@ -325,6 +325,21 @@ void tst_QTimeZone::systemZone() QVERIFY(zone.isValid()); QCOMPARE(zone.id(), QTimeZone::systemTimeZoneId()); QCOMPARE(zone, QTimeZone(QTimeZone::systemTimeZoneId())); + // Check it behaves the same as local-time: + const QDate dates[] = { +#if 0 // QTBUG-80421 + QDate::fromJulianDay(0), // far in the distant past (LMT) + QDate(1625, 6, 8), // Before time-zones (date of Cassini's birth) + QDate(1901, 12, 13), // Last day before 32-bit time_t's range +#elif !defined(Q_OS_WIN) + QDate(1969, 12, 31), // Last day before the epoch +#endif + QDate(1970, 0, 0), // Start of epoch + QDate(2000, 2, 29), // An anomalous leap day + QDate(2038, 1, 20) // First day after 32-bit time_t's range + }; + for (const auto &date : dates) + QCOMPARE(date.startOfDay(Qt::LocalTime), date.startOfDay(zone)); } void tst_QTimeZone::dataStreamTest() |