diff options
author | Cesar Garcia Naranjo <cesarg9@gmail.com> | 2015-07-06 13:23:10 +0000 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2015-07-21 22:50:39 +0000 |
commit | 5c67ce5d6da11b8c4e445bba2a3ffb7b6e7f45d9 (patch) | |
tree | a560631109aac3817a9f05dd90f9e5ad9c82a25b /tests | |
parent | 9072edb5f7f2b9f634fac5b5de7090e94ee491f7 (diff) |
QTimeZone: Convert fractional timezones properly.
[ChangeLog][QtCore][QTimeZone] Fixed a wrong timezone conversion when
the POSIX timezone rule contains a fractional timezone (e.g. VET4:30).
Task-number: QTBUG-47037
Change-Id: I5d9052929bbcde174614ccf07c329264603e6431
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp index 2af37eb86e..b511abf670 100644 --- a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp +++ b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp @@ -823,6 +823,24 @@ void tst_QTimeZone::tzTest() QCOMPARE(dat.offsetFromUtc, 3600); QCOMPARE(dat.standardTimeOffset, 3600); QCOMPARE(dat.daylightTimeOffset, 0); + + // Test TZ timezone vs UTC timezone for fractionary negative offset + QTzTimeZonePrivate tztz1("America/Caracas"); + QUtcTimeZonePrivate tzutc1("UTC-04:30"); + QVERIFY(tztz1.isValid()); + QVERIFY(tzutc1.isValid()); + QTzTimeZonePrivate::Data datatz1 = tztz1.data(std); + QTzTimeZonePrivate::Data datautc1 = tzutc1.data(std); + QCOMPARE(datatz1.offsetFromUtc, datautc1.offsetFromUtc); + + // Test TZ timezone vs UTC timezone for fractionary positive offset + QTzTimeZonePrivate tztz2("Asia/Calcutta"); + QUtcTimeZonePrivate tzutc2("UTC+05:30"); + QVERIFY(tztz2.isValid()); + QVERIFY(tzutc2.isValid()); + QTzTimeZonePrivate::Data datatz2 = tztz2.data(std); + QTzTimeZonePrivate::Data datautc2 = tzutc2.data(std); + QCOMPARE(datatz2.offsetFromUtc, datautc2.offsetFromUtc); #endif // Q_OS_UNIX } |