From 9972e034854e156619135eff79bbee47fddab8d4 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 19 Jul 2023 17:17:49 +0200 Subject: [PATCH] Rename test using MySystemLocale and fix its #if-ery Although QSystemLocale is (to make its query enum usable) defined despite the QT_NO_SYSTEMLOCALE define, it's not used in that case, so tests based on it won't work. So extend the reach of the #if-ery to include the test using a custom class based on it. Also rename the test from systemLocale(), as that's the name the emptyCtor() test really should have. Change-Id: Ief69bf161251cde47ee45014cc2627d42cfcc526 Reviewed-by: Thiago Macieira Reviewed-by: Konrad Kujawa --- .../auto/corelib/text/qlocale/tst_qlocale.cpp | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp index 97eb99d3a1..daf198b918 100644 --- a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp @@ -124,12 +124,12 @@ private slots: void bcp47Name_data(); void bcp47Name(); -#ifdef QT_BUILD_INTERNAL - void systemLocale_data(); - void systemLocale(); -#endif - #ifndef QT_NO_SYSTEMLOCALE +# ifdef QT_BUILD_INTERNAL + void mySystemLocale_data(); + void mySystemLocale(); +# endif + void systemLocaleDayAndMonthNames_data(); void systemLocaleDayAndMonthNames(); #endif @@ -3428,7 +3428,7 @@ void tst_QLocale::uiLanguages_data() void tst_QLocale::uiLanguages() { - // Compare systemLocale(), which tests the same for a stub system locale. + // Compare mySystemLocale(), which tests the same for a custom system locale. QFETCH(const QLocale, locale); QFETCH(const QStringList, all); auto reporter = qScopeGuard([&locale]() { @@ -3714,7 +3714,8 @@ void tst_QLocale::bcp47Name() QCOMPARE(QLocale(QLatin1String(QTest::currentDataTag())).bcp47Name(), expect); } -#ifdef QT_BUILD_INTERNAL +#ifndef QT_NO_SYSTEMLOCALE +# ifdef QT_BUILD_INTERNAL class MySystemLocale : public QSystemLocale { public: @@ -3754,7 +3755,7 @@ private: const QLocale m_locale; }; -void tst_QLocale::systemLocale_data() +void tst_QLocale::mySystemLocale_data() { // Test uses MySystemLocale, so is platform-independent. QTest::addColumn("name"); @@ -3829,7 +3830,7 @@ void tst_QLocale::systemLocale_data() // shi_{Tfng,Latn}_MA, vai_{Vaii,Latn}_LR, zh_{Hant,Hans}_{MO,HK} } -void tst_QLocale::systemLocale() +void tst_QLocale::mySystemLocale() { // Compare uiLanguages(), which tests this for CLDR-derived locales. QLocale originalLocale; @@ -3854,9 +3855,7 @@ void tst_QLocale::systemLocale() QCOMPARE(QLocale(), originalLocale); QCOMPARE(QLocale::system(), originalSystemLocale); } -#endif // QT_BUILD_INTERNAL - -#ifndef QT_NO_SYSTEMLOCALE +# endif // QT_BUILD_INTERNAL void tst_QLocale::systemLocaleDayAndMonthNames_data() {