summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@nokia.com>2012-06-04 16:59:46 +0200
committerQt by Nokia <qt-info@nokia.com>2012-06-05 06:12:37 +0200
commitd8e457323c2d2ef72ab81838ba82300672e4e26e (patch)
tree17ab60a827fcd059ffb2ef689b34bf8511ade217 /tests
parent1668c47608dc2b83c62ef76e97361b11b35a92a7 (diff)
Allow 24:00:00 for ISO dates in QDateTime::fromString().
ISO 8601 section 4.2.3 states that "The end of one calendar day [24:00] coincides with [00:00] at the start of the next calendar day", so fromString() was updated to account for this. Task-number: QTBUG-25387 Change-Id: I391db0da755dbc822ba0820c302a2c10391e1f3b Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
index eb6af23ba5..e4cdb1a5c8 100644
--- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
+++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
@@ -1268,6 +1268,22 @@ void tst_QDateTime::fromStringTextDate_data()
<< 28 << 6 << 2005 << 7 << 57 << 30 << 110
<< int(Qt::LocalTime);
+ // Should be next day according to ISO 8601 section 4.2.3.
+ QTest::newRow("ISO date 24:00") << QString("2012-06-04T24:00:00")
+ << int(Qt::ISODate)
+ << 5 << 6 << 2012 << 0 << 0 << 0 << 0
+ << int(Qt::LocalTime);
+
+ QTest::newRow("ISO date 24:00 end of month") << QString("2012-06-30T24:00:00")
+ << int(Qt::ISODate)
+ << 1 << 7 << 2012 << 0 << 0 << 0 << 0
+ << int(Qt::LocalTime);
+
+ QTest::newRow("ISO date 24:00 end of month and year") << QString("2012-12-31T24:00:00")
+ << int(Qt::ISODate)
+ << 1 << 1 << 2013 << 0 << 0 << 0 << 0
+ << int(Qt::LocalTime);
+
QTest::newRow("Year 0999") << QString("Tue Jun 17 08:00:10 0999")
<< int(Qt::TextDate)
<< 17 << 6 << 999 << 8 << 0 << 10 << 0