QDateTime: fix tests with Qt6
In Qt6 there is a behavior change with extra stuff after the seconds -
it's no longer allowed and will result in an invalid QDateTime.
This was introduced with bf65c27789 but
the autotests were not adjusted for it.
Change-Id: Iee6a9a7ac6cbb2754a68e082bb7074d17fac9d9c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
bb10
parent
51df9bd251
commit
cf033b32b5
|
|
@ -2243,8 +2243,12 @@ void tst_QDateTime::fromStringDateFormat_data()
|
|||
// Spaces as separators:
|
||||
QTest::newRow("sec-milli space")
|
||||
<< QString("2000-01-02 03:04:05 678") << Qt::ISODate
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
|
||||
<< invalidDateTime();
|
||||
#else
|
||||
// Should be invalid, but we ignore trailing cruft (in some cases)
|
||||
<< QDateTime(QDate(2000, 1, 2), QTime(3, 4, 5));
|
||||
#endif
|
||||
QTest::newRow("min-sec space")
|
||||
<< QString("2000-01-02 03:04 05.678") << Qt::ISODate << QDateTime();
|
||||
QTest::newRow("hour-min space")
|
||||
|
|
@ -2332,7 +2336,11 @@ void tst_QDateTime::fromStringDateFormat_data()
|
|||
<< Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 0, 0), Qt::LocalTime);
|
||||
// Test invalid characters (should ignore invalid characters at end of string).
|
||||
QTest::newRow("ISO invalid character at end") << QString::fromLatin1("2012-01-01T08:00:00!")
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
|
||||
<< Qt::ISODate << invalidDateTime();
|
||||
#else
|
||||
<< Qt::ISODate << QDateTime(QDate(2012, 1, 1), QTime(8, 0, 0, 0), Qt::LocalTime);
|
||||
#endif
|
||||
QTest::newRow("ISO invalid character at front") << QString::fromLatin1("!2012-01-01T08:00:00")
|
||||
<< Qt::ISODate << invalidDateTime();
|
||||
QTest::newRow("ISO invalid character both ends") << QString::fromLatin1("!2012-01-01T08:00:00!")
|
||||
|
|
|
|||
Loading…
Reference in New Issue