summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2020-01-22 16:12:24 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2020-01-31 19:20:43 +0100
commitd6d98f782aeb798649c2bf5f7744065b7e86c035 (patch)
tree8f05dd4cd59bcc73d5023205109755a5cff5387c /tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp
parent05ce1821cd18e745f7d126ed93ab0c68125993b6 (diff)
Deprecate locale-related DateFormat enum members
Qt 6 shall remove all locale-dependence from Q(Date|Time)+. Task-number: QTBUG-80441 Change-Id: Iebaaa2bd776bccfe0d73c15f36cbdd456b71ca59 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp')
-rw-r--r--tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp
index ec5f65ee56..26ad91271d 100644
--- a/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp
+++ b/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp
@@ -127,8 +127,10 @@ private slots:
#ifdef Q_OS_WIN
void fromString_LOCALE_ILDATE();
#endif
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
void fromStringToStringLocale_data();
void fromStringToStringLocale();
+#endif // ### Qt 6: remove
void offsetFromUtc();
void setOffsetFromUtc();
@@ -295,9 +297,9 @@ void tst_QDateTime::initTestCase()
void tst_QDateTime::init()
{
-#if defined(Q_OS_WIN32)
+#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
SetThreadLocale(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT));
-#endif
+#endif // ### Qt 6: remove
}
QString tst_QDateTime::str( int y, int month, int d, int h, int min, int s )
@@ -834,8 +836,10 @@ void tst_QDateTime::toString_isoDate()
QFETCH(Qt::DateFormat, format);
QFETCH(QString, expected);
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QLocale oldLocale;
QLocale::setDefault(QLocale("en_US"));
+#endif // ### Qt 6: remove
QString result = datetime.toString(format);
QCOMPARE(result, expected);
@@ -854,7 +858,9 @@ void tst_QDateTime::toString_isoDate()
QCOMPARE(resultDatetime, QDateTime());
}
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QLocale::setDefault(oldLocale);
+#endif // ### Qt 6: remove
}
void tst_QDateTime::toString_isoDate_extra()
@@ -1763,7 +1769,7 @@ void tst_QDateTime::daylightSavingsTimeChange()
// because some functions did not reset the flag when moving in or out of DST.
// WARNING: This only tests anything if there's a Daylight Savings Time change
- // in the current locale between inDST and outDST.
+ // in the current time-zone between inDST and outDST.
// This is true for Central European Time and may be elsewhere.
QFETCH(QDate, inDST);
@@ -2612,6 +2618,9 @@ void tst_QDateTime::fromString_LOCALE_ILDATE()
}
#endif
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+QT_WARNING_PUSH QT_WARNING_DISABLE_DEPRECATED
+
void tst_QDateTime::fromStringToStringLocale_data()
{
QTest::addColumn<QLocale>("locale");
@@ -2643,6 +2652,8 @@ void tst_QDateTime::fromStringToStringLocale()
#undef ROUNDTRIP
QLocale::setDefault(def);
}
+QT_WARNING_POP
+#endif // ### Qt 6: remove
void tst_QDateTime::offsetFromUtc()
{