summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/time/qdate/tst_qdate.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/time/qdate/tst_qdate.cpp')
-rw-r--r--tests/auto/corelib/time/qdate/tst_qdate.cpp47
1 files changed, 31 insertions, 16 deletions
diff --git a/tests/auto/corelib/time/qdate/tst_qdate.cpp b/tests/auto/corelib/time/qdate/tst_qdate.cpp
index 63fdbbbe92..dd2cb3eea8 100644
--- a/tests/auto/corelib/time/qdate/tst_qdate.cpp
+++ b/tests/auto/corelib/time/qdate/tst_qdate.cpp
@@ -1159,17 +1159,23 @@ void tst_QDate::fromStringDateFormat_data()
<< Qt::RFC2822Date << QDate();
QTest::newRow("RFC 2822 invalid year") << QString::fromLatin1("13 Fev 0000 13:24:51 +0100")
<< Qt::RFC2822Date << QDate();
- // Test invalid characters (should ignore invalid characters at end of string).
- QTest::newRow("RFC 2822 invalid character at end") << QString::fromLatin1("01 Jan 2012 08:00:00 +0100!")
+ // Test invalid characters (currently ignoring trailing junk, but see QTBUG-80038).
+ QTest::newRow("RFC 2822 invalid character at end")
+ << QString::fromLatin1("01 Jan 2012 08:00:00 +0100!")
+ << Qt::RFC2822Date << QDate(2012, 1, 1);
+ QTest::newRow("RFC 2822 invalid character at front")
+ << QString::fromLatin1("!01 Jan 2012 08:00:00 +0100") << Qt::RFC2822Date << QDate();
+ QTest::newRow("RFC 2822 invalid character both ends")
+ << QString::fromLatin1("!01 Jan 2012 08:00:00 +0100!") << Qt::RFC2822Date << QDate();
+ QTest::newRow("RFC 2822 invalid character at front, 2 at back")
+ << QString::fromLatin1("!01 Jan 2012 08:00:00 +0100..") << Qt::RFC2822Date << QDate();
+ QTest::newRow("RFC 2822 invalid character 2 at front")
+ << QString::fromLatin1("!!01 Jan 2012 08:00:00 +0100") << Qt::RFC2822Date << QDate();
+ // The common date text used by the "invalid character" tests, just to be
+ // sure *it's* not what's invalid:
+ QTest::newRow("RFC 2822 (not invalid)")
+ << QString::fromLatin1("01 Jan 2012 08:00:00 +0100")
<< Qt::RFC2822Date << QDate(2012, 1, 1);
- QTest::newRow("RFC 2822 invalid character at front") << QString::fromLatin1("!01 Jan 2012 08:00:00 +0000")
- << Qt::RFC2822Date << QDate();
- QTest::newRow("RFC 2822 invalid character both ends") << QString::fromLatin1("!01 Jan 2012 08:00:00 +0000!")
- << Qt::RFC2822Date << QDate();
- QTest::newRow("RFC 2822 invalid character at front, 2 at back") << QString::fromLatin1("!01 Jan 2012 08:00:00 +0000..")
- << Qt::RFC2822Date << QDate();
- QTest::newRow("RFC 2822 invalid character 2 at front") << QString::fromLatin1("!!01 Jan 2012 08:00:00 +0000")
- << Qt::RFC2822Date << QDate();
// Test Qt::RFC2822Date format (RFC 850 and 1036, permissive).
QTest::newRow("RFC 850 and 1036") << QString::fromLatin1("Fri Feb 13 13:24:51 1987 +0100")
@@ -1183,17 +1189,26 @@ void tst_QDate::fromStringDateFormat_data()
// No time specified
QTest::newRow("RFC 850 and 1036 date only") << QString::fromLatin1("Fri Nov 01 2002")
<< Qt::RFC2822Date << QDate(2002, 11, 1);
- // Test invalid characters (should ignore invalid characters at end of string).
- QTest::newRow("RFC 850 and 1036 invalid character at end") << QString::fromLatin1("Sun Jan 01 08:00:00 2012 +0100!")
+ // Test invalid characters (currently ignoring trailing junk, but see QTBUG-80038).
+ QTest::newRow("RFC 850 and 1036 invalid character at end")
+ << QString::fromLatin1("Sun Jan 01 08:00:00 2012 +0100!")
<< Qt::RFC2822Date << QDate(2012, 1, 1);
- QTest::newRow("RFC 850 and 1036 invalid character at front") << QString::fromLatin1("!Sun Jan 01 08:00:00 2012 +0000")
+ QTest::newRow("RFC 850 and 1036 invalid character at front")
+ << QString::fromLatin1("!Sun Jan 01 08:00:00 2012 +0100")
<< Qt::RFC2822Date << QDate();
- QTest::newRow("RFC 850 and 1036 invalid character both ends") << QString::fromLatin1("!Sun Jan 01 08:00:00 2012 +0000!")
+ QTest::newRow("RFC 850 and 1036 invalid character both ends")
+ << QString::fromLatin1("!Sun Jan 01 08:00:00 2012 +0100!")
<< Qt::RFC2822Date << QDate();
- QTest::newRow("RFC 850 and 1036 invalid character at front, 2 at back") << QString::fromLatin1("!Sun Jan 01 08:00:00 2012 +0000..")
+ QTest::newRow("RFC 850 and 1036 invalid character at front, 2 at back")
+ << QString::fromLatin1("!Sun Jan 01 08:00:00 2012 +0100..")
<< Qt::RFC2822Date << QDate();
- QTest::newRow("RFC 850 and 1036 invalid character 2 at front") << QString::fromLatin1("!!Sun Jan 01 08:00:00 2012 +0000")
+ QTest::newRow("RFC 850 and 1036 invalid character 2 at front")
+ << QString::fromLatin1("!!Sun Jan 01 08:00:00 2012 +0100")
<< Qt::RFC2822Date << QDate();
+ // Again, check the text in the "invalid character" tests isn't the source of invalidity:
+ QTest::newRow("RFC 850 and 1036 (not invalid)")
+ << QString::fromLatin1("Sun Jan 01 08:00:00 2012 +0100")
+ << Qt::RFC2822Date << QDate(2012, 1, 1);
QTest::newRow("RFC empty") << QString::fromLatin1("") << Qt::RFC2822Date << QDate();
}