diff options
author | Liang Qi <liang.qi@nokia.com> | 2010-07-05 13:35:51 (GMT) |
---|---|---|
committer | Liang Qi <liang.qi@nokia.com> | 2010-07-05 13:43:56 (GMT) |
commit | fa650284ad6a838118946be88ac9c73a83361391 (patch) | |
tree | ae837e5b5551244c06af700f9bc01abcb9f2972b /tests/auto/qdatetime | |
parent | 4e349cbea021bd504eb8c1575463fd8ee9ba937b (diff) | |
download | Qt-fa650284ad6a838118946be88ac9c73a83361391.zip Qt-fa650284ad6a838118946be88ac9c73a83361391.tar.gz Qt-fa650284ad6a838118946be88ac9c73a83361391.tar.bz2 |
Support time zone designator in QDateTime::fromString() based on ISO 8601-2004 standard.
Task-number: QTBUG-11623
Reviewed-by: Denis Dzyubenko
Reviewed-by: David Boddie
Diffstat (limited to 'tests/auto/qdatetime')
-rw-r--r-- | tests/auto/qdatetime/tst_qdatetime.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/auto/qdatetime/tst_qdatetime.cpp b/tests/auto/qdatetime/tst_qdatetime.cpp index 47c54a5..0900b35 100644 --- a/tests/auto/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/qdatetime/tst_qdatetime.cpp @@ -1456,6 +1456,12 @@ void tst_QDateTime::fromString() dt = QDateTime::fromString("2002-10-01", Qt::ISODate); QCOMPARE(dt, QDateTime(QDate(2002, 10, 1), QTime(0, 0, 0, 0))); + dt = QDateTime::fromString("1987-02-13T13:24:51+01:00", Qt::ISODate); + QCOMPARE(dt, QDateTime(QDate(1987, 2, 13), QTime(12, 24, 51), Qt::UTC)); + + dt = QDateTime::fromString("1987-02-13T13:24:51-01:00", Qt::ISODate); + QCOMPARE(dt, QDateTime(QDate(1987, 2, 13), QTime(14, 24, 51), Qt::UTC)); + dt = QDateTime::fromString("Thu Jan 1 00:12:34 1970 GMT"); QCOMPARE(dt.toUTC(), QDateTime(QDate(1970, 1, 1), QTime(0, 12, 34), Qt::UTC)); |