summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qdate/tst_qdate.cpp
diff options
context:
space:
mode:
authorJohn Layt <jlayt@kde.org>2014-01-06 20:03:37 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-11 20:45:22 +0100
commit684ebc66481eb095bac1aea4db5ae5a41aabd604 (patch)
tree42380e23b798005ba345765df2d357fa1e4440c9 /tests/auto/corelib/tools/qdate/tst_qdate.cpp
parenta41a5f6671616128eed650ad4742842b8e81a6ff (diff)
QDate - Fix parsing Qt::ISODate
Fix parsing of ISO Date from being totally lenient to being semi-strict by requiring the separator positions to be non-numeric. [ChangeLog][Important Behavior Changes] Parsing of Qt::ISODate by QDate::fromString() and QDateTime()::fromString() is not as lenient as before, the date component separators are now required to be non-numeric. This means a string like "2000901901" will no longer be recognized as a valid ISO Date, but "2000/01/01" will still be even though it doesn't strictly meet the ISO format of "2000-01-01". Task-number: QTBUG-34141 Change-Id: I0e481144136c60d4cac61364b9b2c1d2cd1e78fc Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/tools/qdate/tst_qdate.cpp')
-rw-r--r--tests/auto/corelib/tools/qdate/tst_qdate.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qdate/tst_qdate.cpp b/tests/auto/corelib/tools/qdate/tst_qdate.cpp
index b91de092e8..807dcf5cbe 100644
--- a/tests/auto/corelib/tools/qdate/tst_qdate.cpp
+++ b/tests/auto/corelib/tools/qdate/tst_qdate.cpp
@@ -944,6 +944,13 @@ void tst_QDate::fromStringDateFormat_data()
QTest::newRow("iso2") << QDate(1999, 11, 14).toString(Qt::ISODate) << Qt::ISODate << QDate(1999, 11, 14);
QTest::newRow("iso3") << QString("0999-01-01") << Qt::ISODate << QDate(999, 1, 1);
QTest::newRow("iso3b") << QString("0999-01-01") << Qt::ISODate << QDate(999, 1, 1);
+ QTest::newRow("iso4") << QString("2000101101") << Qt::ISODate << QDate();
+ QTest::newRow("iso5") << QString("2000/01/01") << Qt::ISODate << QDate(2000, 1, 1);
+ QTest::newRow("iso6") << QString("2000-01-01 blah") << Qt::ISODate << QDate(2000, 1, 1);
+ QTest::newRow("iso7") << QString("2000-01-011blah") << Qt::ISODate << QDate();
+ QTest::newRow("iso8") << QString("2000-01-01blah") << Qt::ISODate << QDate(2000, 1, 1);
+ QTest::newRow("iso9") << QString("-001-01-01") << Qt::ISODate << QDate();
+ QTest::newRow("iso10") << QString("99999-01-01") << Qt::ISODate << QDate();
// Test Qt::RFC2822Date format (RFC 2822).
QTest::newRow("RFC 2822") << QString::fromLatin1("13 Feb 1987 13:24:51 +0100")