diff options
Diffstat (limited to 'tests/auto/corelib/text/qlocale/tst_qlocale.cpp')
-rw-r--r-- | tests/auto/corelib/text/qlocale/tst_qlocale.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp index 4dd2cf6aff..4897218fcc 100644 --- a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp @@ -13,7 +13,9 @@ # include <QProcess> #endif #include <QScopedArrayPointer> +#if QT_CONFIG(timezone) #include <QTimeZone> +#endif #include <private/qlocale_p.h> #include <private/qlocale_tools_p.h> @@ -1493,8 +1495,7 @@ void tst_QLocale::fpExceptions() # define _EM_INEXACT 0x00000001 # endif _clearfp(); - unsigned int oldbits = _controlfp(0, 0); - _controlfp( 0 | _EM_INEXACT, _MCW_EM ); + unsigned int oldbits = _controlfp(0 | _EM_INEXACT, _MCW_EM); #endif #ifdef QT_USE_FENV @@ -1512,7 +1513,7 @@ void tst_QLocale::fpExceptions() #ifdef Q_OS_WIN _clearfp(); - _controlfp(oldbits, 0xFFFFF); + _controlfp(oldbits, _MCW_EM); #endif #ifdef QT_USE_FENV @@ -2313,7 +2314,7 @@ void tst_QLocale::windowsDefaultLocale() locale.toString(QDate(1974, 12, 1), QLocale::ShortFormat)); QCOMPARE(locale.toString(QDate(1974, 12, 1), QLocale::LongFormat), QStringView(u"\u3021@\u3021\u3022@\u3021\u3029\u3027\u3024")); - const QString expectedFormattedShortTime = QStringView(u"\u3021^\u3022").toString(); + const QString expectedFormattedShortTime = QStringView(u"\u3021^\u3022^\u3023").toString(); QCOMPARE(locale.toString(QTime(1,2,3), QLocale::ShortFormat), expectedFormattedShortTime); QCOMPARE(locale.toString(QTime(1,2,3), QLocale::NarrowFormat), locale.toString(QTime(1,2,3), QLocale::ShortFormat)); @@ -3237,7 +3238,12 @@ public: QVariant query(QueryType type, QVariant /*in*/) const override { - return type == UILanguages ? QVariant(QStringList{m_name}) : QVariant(); + if (type == UILanguages) { + if (m_name == u"en-DE") // QTBUG-104930: simulate macOS's list not including m_name. + return QVariant(QStringList{QStringLiteral("en-GB"), QStringLiteral("de-DE")}); + return QVariant(QStringList{m_name}); + } + return QVariant(); } QLocale fallbackLocale() const override @@ -3266,6 +3272,12 @@ void tst_QLocale::systemLocale_data() QTest::addRow("ukrainian") << QString("uk") << QLocale::Ukrainian << QStringList{QStringLiteral("uk"), QStringLiteral("uk-Cyrl-UA"), QStringLiteral("uk-UA")}; + QTest::addRow("english-germany") + << QString("en-DE") << QLocale::English + // First two were missed out before fix to QTBUG-104930: + << QStringList{QStringLiteral("en-DE"), QStringLiteral("en-Latn-DE"), + QStringLiteral("en-GB"), QStringLiteral("en-Latn-GB"), + QStringLiteral("de-DE"), QStringLiteral("de-Latn-DE"), QStringLiteral("de")}; QTest::addRow("german") << QString("de") << QLocale::German << QStringList{QStringLiteral("de"), QStringLiteral("de-Latn-DE"), QStringLiteral("de-DE")}; @@ -3290,7 +3302,11 @@ void tst_QLocale::systemLocale() MySystemLocale sLocale(name); QCOMPARE(QLocale().language(), language); QCOMPARE(QLocale::system().language(), language); + auto reporter = qScopeGuard([]() { + qDebug("\n\t%s", qPrintable(QLocale::system().uiLanguages().join(u"\n\t"))); + }); QCOMPARE(QLocale::system().uiLanguages(), uiLanguages); + reporter.dismiss(); } QCOMPARE(QLocale(), originalLocale); |