diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2023-09-14 11:15:24 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2023-09-15 21:53:36 +0200 |
commit | 9c0def81e4e5f473e6abe4a61c94df51a78beb63 (patch) | |
tree | 99d4f30191291c37bb5a846fd2ac411f1bc51f82 /tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp | |
parent | 59bf9160cc285bac1732fd3ade2ac033b2348b28 (diff) |
Warn on failure to construct valid system time zone object
Also move some docs from asBackendZone() to systemTimeZone(), making
clear that the system zone object is current at the time of creation
and won't be updated if the system is reconfigured. Adapt some tests
to fail and make clear that the system is misconfigured if no valid
system zone is found.
[ChangeLog][QtCore][QTimeZone] If systemTimeZone() is unable to
identify a valid system time zone, it now produces a warning the first
time it encounters the problem.
Task-number: QTBUG-116017
Change-Id: Ia437d8a03ff3cbf2b2cd98e8a8c3aebe50c1ee32
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp')
-rw-r--r-- | tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp b/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp index 7d60f5d0ff..ff6f96c1a0 100644 --- a/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp +++ b/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp @@ -507,7 +507,9 @@ void tst_QTimeZone::asBackendZone() void tst_QTimeZone::systemZone() { const QTimeZone zone = QTimeZone::systemTimeZone(); - QVERIFY2(zone.isValid(), "Invalid system zone setting, tests are doomed."); + QVERIFY2(zone.isValid(), + "Invalid system zone setting, tests are doomed on misconfigured system."); + // This may fail on Windows if CLDR data doesn't map system MS ID to IANA ID: QCOMPARE(zone.id(), QTimeZone::systemTimeZoneId()); QCOMPARE(zone, QTimeZone(QTimeZone::systemTimeZoneId())); // Check it behaves the same as local-time: |