From ab2f768a8f1e1e43e70de4129b2ca9422f5f2dce Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 28 Apr 2016 22:35:14 -0700 Subject: Autotest: fix the QTimeZone::tzTest failure when database contains LMT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Tony Sarajärvi --- tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp') 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::min()); - QCOMPARE(dat.standardTimeOffset, std::numeric_limits::min()); - QCOMPARE(dat.daylightTimeOffset, std::numeric_limits::min()); + // Test previous to low value is invalid + dat = tzp.previousTransition(-9999999999999); + QCOMPARE(dat.atMSecsSinceEpoch, std::numeric_limits::min()); + QCOMPARE(dat.standardTimeOffset, std::numeric_limits::min()); + QCOMPARE(dat.daylightTimeOffset, std::numeric_limits::min()); + } dat = tzp.nextTransition(-9999999999999); QCOMPARE(dat.atMSecsSinceEpoch, (qint64)-2422054408000); -- cgit v1.2.3