summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qdatetime
diff options
context:
space:
mode:
authorJohn Layt <jlayt@kde.org>2013-11-02 18:53:32 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-21 09:25:23 +0100
commit6ad97bfa736c97b50019d0192f55959848e7067a (patch)
treef0ce0c8a5808b19a1a08d8df934af0d927fca5d2 /tests/auto/corelib/tools/qdatetime
parent8e6258f059140ce735391b6438d5976dc9469e95 (diff)
QTimeZone - Fix dateForLocalTime() to check validity of next transition
The private method dateForLocalTime() was not checking that transitions were valid, resulting in infinite looping when a time zone didn't have any future transitions. Change-Id: I0e5d07063861778dd86056a80c36fdd9f9d36133 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'tests/auto/corelib/tools/qdatetime')
-rw-r--r--tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
index 1e2b0ed649..6c80c5ff47 100644
--- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
+++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
@@ -2903,6 +2903,12 @@ void tst_QDateTime::timeZones() const
// - Test 03:00:00 = 1 hour after tran
hourAfterStd = QDateTime(QDate(2013, 10, 27), QTime(3, 0, 0), cet);
QCOMPARE(hourAfterStd.toMSecsSinceEpoch(), dstToStdMSecs + 3600000);
+
+ // Test Time Zone that has transitions but no future transitions afer a given date
+ QTimeZone sgt("Asia/Singapore");
+ QDateTime future(QDate(2015, 1, 1), QTime(0, 0, 0), sgt);
+ QVERIFY(future.isValid());
+ QCOMPARE(future.offsetFromUtc(), 28800);
}
void tst_QDateTime::invalid() const