summaryrefslogtreecommitdiff
path: root/tests
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
parent8e6258f059140ce735391b6438d5976dc9469e95 (diff)
downloadqtbase-6ad97bfa736c97b50019d0192f55959848e7067a.tar.gz
qtbase-6ad97bfa736c97b50019d0192f55959848e7067a.tar.bz2
qtbase-6ad97bfa736c97b50019d0192f55959848e7067a.zip
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')
-rw-r--r--tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp6
-rw-r--r--tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp4
2 files changed, 10 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
diff --git a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
index cfb20f51e4..d7643ff55d 100644
--- a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
+++ b/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp
@@ -409,6 +409,10 @@ void tst_QTimeZone::stressTest()
qDebug() << "Stress test calculating transistions for" << testZone.id();
testZone.transitions(lowDate1, highDate1);
}
+ testDate.setTimeZone(testZone);
+ testDate.isValid();
+ testDate.offsetFromUtc();
+ testDate.timeZoneAbbreviation();
}
}