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 <thiago.macieira@intel.com>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
This commit is contained in:
Edward Welbourne 2023-07-19 17:17:49 +02:00
parent 74a60ebf31
commit 9972e03485

View File

@ -124,12 +124,12 @@ private slots:
void bcp47Name_data();
void bcp47Name();
#ifndef QT_NO_SYSTEMLOCALE
# ifdef QT_BUILD_INTERNAL
void systemLocale_data();
void systemLocale();
void mySystemLocale_data();
void mySystemLocale();
# endif
#ifndef QT_NO_SYSTEMLOCALE
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,6 +3714,7 @@ void tst_QLocale::bcp47Name()
QCOMPARE(QLocale(QLatin1String(QTest::currentDataTag())).bcp47Name(), expect);
}
#ifndef QT_NO_SYSTEMLOCALE
# ifdef QT_BUILD_INTERNAL
class MySystemLocale : public QSystemLocale
{
@ -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<QString>("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;
@ -3856,8 +3857,6 @@ void tst_QLocale::systemLocale()
}
# endif // QT_BUILD_INTERNAL
#ifndef QT_NO_SYSTEMLOCALE
void tst_QLocale::systemLocaleDayAndMonthNames_data()
{
QTest::addColumn<QByteArray>("locale");