summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/text/qlocale/tst_qlocale.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/text/qlocale/tst_qlocale.cpp')
-rw-r--r--tests/auto/corelib/text/qlocale/tst_qlocale.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp
index 33fcb156b6..84901f8f75 100644
--- a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp
+++ b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2020 The Qt Company Ltd.
+** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@@ -1778,7 +1778,8 @@ void tst_QLocale::toDateTime_data()
QTest::addColumn<QDateTime>("result");
QTest::addColumn<QString>("format");
QTest::addColumn<QString>("string");
- QTest::addColumn<bool>("clean"); // No non-format letters in format string
+ // No non-format letters in format string, no time-zone (t format):
+ QTest::addColumn<bool>("clean");
QTest::newRow("1C") << "C" << QDateTime(QDate(1974, 12, 1), QTime(5, 14, 0))
<< "d/M/yyyy hh:h:mm" << "1/12/1974 05:5:14" << true;
@@ -1832,6 +1833,21 @@ void tst_QLocale::toDateTime_data()
QTest::newRow("12no_NO") << "no_NO" << QDateTime(QDate(1974, 12, 1), QTime(15, 0, 0))
<< "d'd'dd/M/yyh" << "1d01/12/7415" << false;
+ QTest::newRow("short-ss") // QTBUG-102199: trips over an assert in CET
+ << "C" << QDateTime() // Single-digit seconds does not match ss format.
+ << QStringLiteral("ddd, d MMM yyyy HH:mm:ss")
+ << QStringLiteral("Sun, 29 Mar 2020 02:26:3") << true;
+
+ QTest::newRow("short-ss-Z") // Same, but with a valid date-time:
+ << "C" << QDateTime()
+ << QStringLiteral("ddd, d MMM yyyy HH:mm:ss t")
+ << QStringLiteral("Sun, 29 Mar 2020 02:26:3 Z") << false;
+
+ QTest::newRow("s-Z") // Same, but with a format that accepts the single digit:
+ << "C" << QDateTime(QDate(2020, 3, 29), QTime(2, 26, 3), Qt::UTC)
+ << QStringLiteral("ddd, d MMM yyyy HH:mm:s t")
+ << QStringLiteral("Sun, 29 Mar 2020 02:26:3 Z") << false;
+
QTest::newRow("RFC-1123")
<< "C" << QDateTime(QDate(2007, 11, 1), QTime(18, 8, 30))
<< "ddd, dd MMM yyyy hh:mm:ss 'GMT'" << "Thu, 01 Nov 2007 18:08:30 GMT" << false;