summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2016-04-28 22:35:14 -0700
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2016-04-29 08:23:11 +0000
commitab2f768a8f1e1e43e70de4129b2ca9422f5f2dce (patch)
treedb1c1f6bcadab6b6db1c34da01b33606f538cf74 /tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
parent89d1c7c179aea55bd991b524bdcc9c3e265510fa (diff)
Autotest: fix the QTimeZone::tzTest failure when database contains LMT
On some operating systems, tzdata files carry the Local Mean Time (LMT) for the city in question, which better represents how time was tracked before standard, hourly timezones were introduced in the early 20th century. The test was asking for the data for 1653-02-09 and assumed that it would find the first Central European Time (CET) rule, which Germany didn't start using until 1893-04-01. This fix allows us to remove the blacklist that had been applied to this test without investigation. It wasn't related to OpenSUSE, aside from the fact that OpenSUSE tzdata carries the LMT data. Change-Id: Id5480807d25e49e78b79ffff1449bdaf46901367 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com> Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
Diffstat (limited to 'tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp')
-rw-r--r--tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
index 32bb2aa394..ea835108ee 100644
--- a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
+++ b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
@@ -767,16 +767,22 @@ void tst_QTimeZone::tzTest()
// Warning: This could vary depending on age of TZ file!
// Test low date uses first rule found
+ // Note: Depending on the OS in question, the database may be carrying the
+ // Local Mean Time. which for Berlin is 0:53:28
QTimeZonePrivate::Data dat = tzp.data(-9999999999999);
QCOMPARE(dat.atMSecsSinceEpoch, (qint64)-9999999999999);
- QCOMPARE(dat.standardTimeOffset, 3600);
QCOMPARE(dat.daylightTimeOffset, 0);
+ if (dat.abbreviation == "LMT") {
+ QCOMPARE(dat.standardTimeOffset, 3208);
+ } else {
+ QCOMPARE(dat.standardTimeOffset, 3600);
- // Test previous to low value is invalid
- dat = tzp.previousTransition(-9999999999999);
- QCOMPARE(dat.atMSecsSinceEpoch, std::numeric_limits<qint64>::min());
- QCOMPARE(dat.standardTimeOffset, std::numeric_limits<int>::min());
- QCOMPARE(dat.daylightTimeOffset, std::numeric_limits<int>::min());
+ // Test previous to low value is invalid
+ dat = tzp.previousTransition(-9999999999999);
+ QCOMPARE(dat.atMSecsSinceEpoch, std::numeric_limits<qint64>::min());
+ QCOMPARE(dat.standardTimeOffset, std::numeric_limits<int>::min());
+ QCOMPARE(dat.daylightTimeOffset, std::numeric_limits<int>::min());
+ }
dat = tzp.nextTransition(-9999999999999);
QCOMPARE(dat.atMSecsSinceEpoch, (qint64)-2422054408000);