summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp
diff options
context:
space:
mode:
authorAndreas Buhr <andreas.buhr@qt.io>2020-09-04 15:54:19 +0200
committerAndreas Buhr <andreas.buhr@qt.io>2020-10-30 17:19:27 +0100
commit91140eb7268bc36efceef0459e7b124ce333829e (patch)
treea9c69248e57d2f02e1636e380ef8e22eeb1015e4 /tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp
parent2da301fe46450eedabfde7860338a2c0066c550b (diff)
Adapt QDate::fromString() to accept negative year numbers
The documentation states that QDate::fromString() accepts negative year numbers, but it did not. This patch adds support for negative year numbers to QDate::fromString() and corresponding unit tests. Furthermore, tests are added for positive signs (+) in date strings. Fixes: QTBUG-84334 Task-number: QTBUG-84349 Change-Id: I575291e7b8317055d4bb530011d7b10c9cd37ae1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp')
-rw-r--r--tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp
index 82db37638e..7e56421543 100644
--- a/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp
+++ b/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp
@@ -2797,6 +2797,11 @@ void tst_QDateTime::fromStringStringFormat_data()
QTest::newRow("unicode handling") << QString(u8"2005🤣06🤣28T07🤣57🤣30.001Z")
<< QString(u8"yyyy🤣MM🤣ddThh🤣mm🤣ss.zt")
<< QDateTime(QDate(2005, 06, 28), QTime(07, 57, 30, 1), Qt::UTC);
+
+ // QTBUG-84349
+ QTest::newRow("QTBUG-84349: positive sign in month")
+ << QStringLiteral("9922+221102233Z") << QStringLiteral("yyyyMMddHHmmsst")
+ << QDateTime();
}
void tst_QDateTime::fromStringStringFormat()