diff options
author | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2022-04-07 15:21:56 +0300 |
---|---|---|
committer | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2022-04-07 15:21:56 +0300 |
commit | e89a6f03c4d24f18db36a906a7320035388504ba (patch) | |
tree | 47f7edb9faa26f6f4e2d3f2eea12133933d86e45 /tests/auto/corelib/time/qdate/tst_qdate.cpp | |
parent | c8989ca20fa5798f7853f07df6e150cc407c64a4 (diff) | |
parent | 69b8ab23c93785dc69ae43ea04d5620656a4af44 (diff) |
Merge remote-tracking branch 'origin/tqtc/lts-5.15.4' into tqtc/lts-5.15-opensource
Change-Id: I3d223d54a832c8365fec4b399550da79f4c1abbb
Diffstat (limited to 'tests/auto/corelib/time/qdate/tst_qdate.cpp')
-rw-r--r-- | tests/auto/corelib/time/qdate/tst_qdate.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/tests/auto/corelib/time/qdate/tst_qdate.cpp b/tests/auto/corelib/time/qdate/tst_qdate.cpp index 274bf4f6f0..f94f1c5fa6 100644 --- a/tests/auto/corelib/time/qdate/tst_qdate.cpp +++ b/tests/auto/corelib/time/qdate/tst_qdate.cpp @@ -90,7 +90,6 @@ private slots: void yearsZeroToNinetyNine(); void printNegativeYear_data() const; void printNegativeYear() const; - void roundtripGermanLocale() const; #if QT_CONFIG(textdate) && QT_DEPRECATED_SINCE(5, 10) void shortDayName() const; void standaloneShortDayName() const; @@ -100,6 +99,7 @@ private slots: void standaloneShortMonthName() const; void longMonthName() const; void standaloneLongMonthName() const; + void roundtripString() const; #endif // textdate void roundtrip() const; void qdebug() const; @@ -1484,16 +1484,6 @@ void tst_QDate::printNegativeYear() const QCOMPARE(date.toString(QLatin1String("yyyy")), expect); } -void tst_QDate::roundtripGermanLocale() const -{ - /* This code path should not result in warnings. */ - const QDate theDate(QDate::currentDate()); - theDate.fromString(theDate.toString(Qt::TextDate), Qt::TextDate); - - const QDateTime theDateTime(QDateTime::currentDateTime()); - theDateTime.fromString(theDateTime.toString(Qt::TextDate), Qt::TextDate); -} - #if QT_CONFIG(textdate) && QT_DEPRECATED_SINCE(5, 10) QT_WARNING_PUSH // the methods tested here are all deprecated QT_WARNING_DISABLE_GCC("-Wdeprecated-declarations") @@ -1626,6 +1616,17 @@ void tst_QDate::standaloneLongMonthName() const } } QT_WARNING_POP + +void tst_QDate::roundtripString() const +{ + /* This code path should not result in warnings, no matter what locale is set. */ + const QDate date(QDate::currentDate()); + QCOMPARE(date.fromString(date.toString(Qt::TextDate), Qt::TextDate), date); + + const QDateTime now(QDateTime::currentDateTime()); + const QDateTime when = now.addMSecs(-now.time().msec()); // TextDate rounds to whole seconds. + QCOMPARE(when.fromString(when.toString(Qt::TextDate), Qt::TextDate), when); +} #endif // textdate void tst_QDate::roundtrip() const |