summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2019-11-26 13:44:30 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2019-11-28 14:16:33 +0100
commitcfd2f3c46eaefcaa8795a777d5e01fa85dd850a8 (patch)
treeab555fd72bc2001e93cfc7a023683d2918f03ddc /tests
parent2a4dd69499cb85695ede86ac7244fe6e1c274834 (diff)
Work around macOS's inconsistency in naming of India's time-zone
macOS fails to create a zone for the name its own systemTimeZone claims to have (see new comment). So make sure we do consistently recognize the name systemTimeZoneId() returns, using systemTimeZone from which we got its name. Add minimal testing of system time-zone. Fixes: QTBUG-80173 Change-Id: I42f21efbd7c439158fee954d555414bb180e7f8f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp b/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp
index f425691d9c..4fdcbc7809 100644
--- a/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp
+++ b/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp
@@ -46,6 +46,7 @@ private slots:
// Public class default system tests
void createTest();
void nullTest();
+ void systemZone();
void dataStreamTest();
void isTimeZoneIdAvailable();
void availableTimeZoneIds();
@@ -315,6 +316,14 @@ void tst_QTimeZone::nullTest()
QCOMPARE(data.daylightTimeOffset, std::numeric_limits<int>::min());
}
+void tst_QTimeZone::systemZone()
+{
+ const QTimeZone zone = QTimeZone::systemTimeZone();
+ QVERIFY(zone.isValid());
+ QCOMPARE(zone.id(), QTimeZone::systemTimeZoneId());
+ QCOMPARE(zone, QTimeZone(QTimeZone::systemTimeZoneId()));
+}
+
void tst_QTimeZone::dataStreamTest()
{
// Test the OffsetFromUtc backend serialization. First with a custom timezone: