diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2019-12-30 22:24:25 +0100 |
---|---|---|
committer | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2020-01-02 13:07:05 +0100 |
commit | cf033b32b56f82cbace1525394f32199cd3a32f7 (patch) | |
tree | d028da7df609daf87b2ad5d705a67fe971eb48bb /tests | |
parent | 51df9bd251b8f47c1b119048e2b7c2d549bc07ae (diff) |
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 bf65c277892f6f322fa689c06d81ba9b1d9a8038 but
the autotests were not adjusted for it.
Change-Id: Iee6a9a7ac6cbb2754a68e082bb7074d17fac9d9c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp index c03d112560..6aae91f62f 100644 --- a/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp @@ -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!") |