summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJiDe Zhang <zhangjide@uniontech.com>2021-03-09 16:19:54 +0800
committerJiDe Zhang <zhangjide@uniontech.com>2021-04-15 20:17:49 +0800
commit50a7eb8cf75a2f9cebde6d0d23c108e5e7f1870b (patch)
treec947e4746bb55f723c4005534cb98501f083036a /tests
parent7c8d45cb2635ab44d85d85288fd74ef72909264c (diff)
Add the "Territory" enumerated type for QLocale
The use of "Country" is misleading as some entries in the enumeration are not countries (eg, HongKong), for all that most are. The Unicode Consortium's Common Locale Data Repository (CLDR, from which QLocale's data is taken) calls these territories, so introduce territory-based names and prepare to deprecate the country-based ones in due course. [ChangeLog][QtCore][QLocale] QLocale now has Territory as an alias for its Country enumeration, and associated territory-based names to match its country-named methods, to better match the usage in relevant standards. The country-based names shall in due course be deprecated in favor of the territory-based names. Fixes: QTBUG-91686 Change-Id: Ia1ae1ad7323867016186fb775c9600cd5113aa42 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/text/qlocale/tst_qlocale.cpp194
-rw-r--r--tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp24
-rw-r--r--tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp4
-rw-r--r--tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp4
-rw-r--r--tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp4
-rw-r--r--tests/benchmarks/corelib/text/qlocale/main.cpp28
-rw-r--r--tests/manual/qlocale/info.cpp8
-rw-r--r--tests/manual/qlocale/info.h4
-rw-r--r--tests/manual/qlocale/languages.cpp2
-rw-r--r--tests/manual/qlocale/window.cpp10
10 files changed, 141 insertions, 141 deletions
diff --git a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp
index 83aa5b2c19..3700304772 100644
--- a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp
+++ b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp
@@ -225,15 +225,15 @@ void tst_QLocale::ctor()
{
QLocale default_locale = QLocale::system();
QLocale::Language default_lang = default_locale.language();
- QLocale::Country default_country = default_locale.country();
+ QLocale::Territory default_country = default_locale.territory();
qDebug("Default: %s/%s", QLocale::languageToString(default_lang).toLatin1().constData(),
- QLocale::countryToString(default_country).toLatin1().constData());
+ QLocale::territoryToString(default_country).toLatin1().constData());
{
QLocale l;
QVERIFY(l.language() == default_lang);
- QVERIFY(l.country() == default_country);
+ QVERIFY(l.territory() == default_country);
}
#define TEST_CTOR(req_lang, req_script, req_country, exp_lang, exp_script, exp_country) \
@@ -241,7 +241,7 @@ void tst_QLocale::ctor()
QLocale l(QLocale::req_lang, QLocale::req_script, QLocale::req_country); \
QCOMPARE(l.language(), QLocale::exp_lang); \
QCOMPARE(l.script(), QLocale::exp_script); \
- QCOMPARE(l.country(), QLocale::exp_country); \
+ QCOMPARE(l.territory(), QLocale::exp_country); \
} while (false)
// Exact matches
@@ -252,10 +252,10 @@ void tst_QLocale::ctor()
TEST_CTOR(Chinese, TraditionalHanScript, HongKong,
Chinese, TraditionalHanScript, HongKong);
- // Best match for AnyCountry
- TEST_CTOR(Chinese, SimplifiedHanScript, AnyCountry,
+ // Best match for AnyTerritory
+ TEST_CTOR(Chinese, SimplifiedHanScript, AnyTerritory,
Chinese, SimplifiedHanScript, China);
- TEST_CTOR(Chinese, TraditionalHanScript, AnyCountry,
+ TEST_CTOR(Chinese, TraditionalHanScript, AnyTerritory,
Chinese, TraditionalHanScript, Taiwan);
// Best match for AnyScript (and change country to supported one, if necessary)
@@ -295,36 +295,36 @@ void tst_QLocale::defaulted_ctor()
{
QLocale default_locale = QLocale::system();
QLocale::Language default_lang = default_locale.language();
- QLocale::Country default_country = default_locale.country();
+ QLocale::Territory default_country = default_locale.territory();
qDebug("Default: %s/%s", QLocale::languageToString(default_lang).toLatin1().constData(),
- QLocale::countryToString(default_country).toLatin1().constData());
+ QLocale::territoryToString(default_country).toLatin1().constData());
{
- QLocale l(QLocale::C, QLocale::AnyCountry);
+ QLocale l(QLocale::C, QLocale::AnyTerritory);
QCOMPARE(l.language(), QLocale::C);
- QCOMPARE(l.country(), QLocale::AnyCountry);
+ QCOMPARE(l.territory(), QLocale::AnyTerritory);
}
#define TEST_CTOR(req_lang, req_country, exp_lang, exp_country) \
{ \
QLocale l(QLocale::req_lang, QLocale::req_country); \
QCOMPARE((int)l.language(), (int)exp_lang); \
- QCOMPARE((int)l.country(), (int)exp_country); \
+ QCOMPARE((int)l.territory(), (int)exp_country); \
}
- TEST_CTOR(AnyLanguage, AnyCountry, default_lang, default_country)
- TEST_CTOR(C, AnyCountry, QLocale::C, QLocale::AnyCountry)
- TEST_CTOR(Aymara, AnyCountry, default_lang, default_country)
+ TEST_CTOR(AnyLanguage, AnyTerritory, default_lang, default_country)
+ TEST_CTOR(C, AnyTerritory, QLocale::C, QLocale::AnyTerritory)
+ TEST_CTOR(Aymara, AnyTerritory, default_lang, default_country)
TEST_CTOR(Aymara, France, default_lang, default_country)
- TEST_CTOR(English, AnyCountry, QLocale::English, QLocale::UnitedStates)
+ TEST_CTOR(English, AnyTerritory, QLocale::English, QLocale::UnitedStates)
TEST_CTOR(English, UnitedStates, QLocale::English, QLocale::UnitedStates)
TEST_CTOR(English, France, QLocale::English, QLocale::UnitedStates)
TEST_CTOR(English, UnitedKingdom, QLocale::English, QLocale::UnitedKingdom)
TEST_CTOR(French, France, QLocale::French, QLocale::France)
- TEST_CTOR(C, France, QLocale::C, QLocale::AnyCountry)
+ TEST_CTOR(C, France, QLocale::C, QLocale::AnyTerritory)
TEST_CTOR(Spanish, LatinAmerica, QLocale::Spanish,
QLocale::LatinAmerica)
@@ -333,94 +333,94 @@ void tst_QLocale::defaulted_ctor()
{
QLocale l;
QVERIFY(l.language() == QLocale::English);
- QVERIFY(l.country() == QLocale::UnitedStates);
+ QVERIFY(l.territory() == QLocale::UnitedStates);
}
TEST_CTOR(French, France, QLocale::French, QLocale::France)
TEST_CTOR(English, UnitedKingdom, QLocale::English, QLocale::UnitedKingdom)
TEST_CTOR(French, France, QLocale::French, QLocale::France)
- TEST_CTOR(C, AnyCountry, QLocale::C, QLocale::AnyCountry)
- TEST_CTOR(C, France, QLocale::C, QLocale::AnyCountry)
- TEST_CTOR(Aymara, AnyCountry, QLocale::English, QLocale::UnitedStates)
+ TEST_CTOR(C, AnyTerritory, QLocale::C, QLocale::AnyTerritory)
+ TEST_CTOR(C, France, QLocale::C, QLocale::AnyTerritory)
+ TEST_CTOR(Aymara, AnyTerritory, QLocale::English, QLocale::UnitedStates)
QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedKingdom));
{
QLocale l;
QVERIFY(l.language() == QLocale::English);
- QVERIFY(l.country() == QLocale::UnitedKingdom);
+ QVERIFY(l.territory() == QLocale::UnitedKingdom);
}
TEST_CTOR(French, France, QLocale::French, QLocale::France)
TEST_CTOR(English, UnitedKingdom, QLocale::English, QLocale::UnitedKingdom)
- TEST_CTOR(C, AnyCountry, QLocale::C, QLocale::AnyCountry)
- TEST_CTOR(C, France, QLocale::C, QLocale::AnyCountry)
+ TEST_CTOR(C, AnyTerritory, QLocale::C, QLocale::AnyTerritory)
+ TEST_CTOR(C, France, QLocale::C, QLocale::AnyTerritory)
QLocale::setDefault(QLocale(QLocale::Aymara, QLocale::France));
{
QLocale l;
QVERIFY(l.language() == QLocale::English);
- QVERIFY(l.country() == QLocale::UnitedKingdom);
+ QVERIFY(l.territory() == QLocale::UnitedKingdom);
}
- TEST_CTOR(Aymara, AnyCountry, QLocale::English, QLocale::UnitedKingdom)
+ TEST_CTOR(Aymara, AnyTerritory, QLocale::English, QLocale::UnitedKingdom)
TEST_CTOR(Aymara, France, QLocale::English, QLocale::UnitedKingdom)
- TEST_CTOR(English, AnyCountry, QLocale::English, QLocale::UnitedStates)
+ TEST_CTOR(English, AnyTerritory, QLocale::English, QLocale::UnitedStates)
TEST_CTOR(English, UnitedStates, QLocale::English, QLocale::UnitedStates)
TEST_CTOR(English, France, QLocale::English, QLocale::UnitedStates)
TEST_CTOR(English, UnitedKingdom, QLocale::English, QLocale::UnitedKingdom)
TEST_CTOR(French, France, QLocale::French, QLocale::France)
- TEST_CTOR(C, AnyCountry, QLocale::C, QLocale::AnyCountry)
- TEST_CTOR(C, France, QLocale::C, QLocale::AnyCountry)
+ TEST_CTOR(C, AnyTerritory, QLocale::C, QLocale::AnyTerritory)
+ TEST_CTOR(C, France, QLocale::C, QLocale::AnyTerritory)
- QLocale::setDefault(QLocale(QLocale::Aymara, QLocale::AnyCountry));
+ QLocale::setDefault(QLocale(QLocale::Aymara, QLocale::AnyTerritory));
{
QLocale l;
QVERIFY(l.language() == QLocale::English);
- QVERIFY(l.country() == QLocale::UnitedKingdom);
+ QVERIFY(l.territory() == QLocale::UnitedKingdom);
}
- TEST_CTOR(Aymara, AnyCountry, QLocale::English, QLocale::UnitedKingdom)
+ TEST_CTOR(Aymara, AnyTerritory, QLocale::English, QLocale::UnitedKingdom)
TEST_CTOR(Aymara, France, QLocale::English, QLocale::UnitedKingdom)
- TEST_CTOR(English, AnyCountry, QLocale::English, QLocale::UnitedStates)
+ TEST_CTOR(English, AnyTerritory, QLocale::English, QLocale::UnitedStates)
TEST_CTOR(English, UnitedStates, QLocale::English, QLocale::UnitedStates)
TEST_CTOR(English, France, QLocale::English, QLocale::UnitedStates)
TEST_CTOR(English, UnitedKingdom, QLocale::English, QLocale::UnitedKingdom)
TEST_CTOR(French, France, QLocale::French, QLocale::France)
- TEST_CTOR(C, AnyCountry, QLocale::C, QLocale::AnyCountry)
- TEST_CTOR(C, France, QLocale::C, QLocale::AnyCountry)
-
- TEST_CTOR(Arabic, AnyCountry, QLocale::Arabic, QLocale::Egypt)
- TEST_CTOR(Dutch, AnyCountry, QLocale::Dutch, QLocale::Netherlands)
- TEST_CTOR(German, AnyCountry, QLocale::German, QLocale::Germany)
- TEST_CTOR(Greek, AnyCountry, QLocale::Greek, QLocale::Greece)
- TEST_CTOR(Malay, AnyCountry, QLocale::Malay, QLocale::Malaysia)
- TEST_CTOR(Persian, AnyCountry, QLocale::Persian, QLocale::Iran)
- TEST_CTOR(Portuguese, AnyCountry, QLocale::Portuguese, QLocale::Brazil)
- TEST_CTOR(Serbian, AnyCountry, QLocale::Serbian, QLocale::Serbia)
- TEST_CTOR(Somali, AnyCountry, QLocale::Somali, QLocale::Somalia)
- TEST_CTOR(Spanish, AnyCountry, QLocale::Spanish, QLocale::Spain)
- TEST_CTOR(Swedish, AnyCountry, QLocale::Swedish, QLocale::Sweden)
- TEST_CTOR(Uzbek, AnyCountry, QLocale::Uzbek, QLocale::Uzbekistan)
+ TEST_CTOR(C, AnyTerritory, QLocale::C, QLocale::AnyTerritory)
+ TEST_CTOR(C, France, QLocale::C, QLocale::AnyTerritory)
+
+ TEST_CTOR(Arabic, AnyTerritory, QLocale::Arabic, QLocale::Egypt)
+ TEST_CTOR(Dutch, AnyTerritory, QLocale::Dutch, QLocale::Netherlands)
+ TEST_CTOR(German, AnyTerritory, QLocale::German, QLocale::Germany)
+ TEST_CTOR(Greek, AnyTerritory, QLocale::Greek, QLocale::Greece)
+ TEST_CTOR(Malay, AnyTerritory, QLocale::Malay, QLocale::Malaysia)
+ TEST_CTOR(Persian, AnyTerritory, QLocale::Persian, QLocale::Iran)
+ TEST_CTOR(Portuguese, AnyTerritory, QLocale::Portuguese, QLocale::Brazil)
+ TEST_CTOR(Serbian, AnyTerritory, QLocale::Serbian, QLocale::Serbia)
+ TEST_CTOR(Somali, AnyTerritory, QLocale::Somali, QLocale::Somalia)
+ TEST_CTOR(Spanish, AnyTerritory, QLocale::Spanish, QLocale::Spain)
+ TEST_CTOR(Swedish, AnyTerritory, QLocale::Swedish, QLocale::Sweden)
+ TEST_CTOR(Uzbek, AnyTerritory, QLocale::Uzbek, QLocale::Uzbekistan)
#undef TEST_CTOR
#define TEST_CTOR(req_lc, exp_lang, exp_country) \
{ \
QLocale l(req_lc); \
QVERIFY2(l.language() == QLocale::exp_lang \
- && l.country() == QLocale::exp_country, \
+ && l.territory() == QLocale::exp_country, \
QString("requested: \"" + QString(req_lc) + "\", got: " \
+ QLocale::languageToString(l.language()) \
+ QLatin1Char('/') \
- + QLocale::countryToString(l.country())).toLatin1().constData()); \
+ + QLocale::territoryToString(l.territory())).toLatin1().constData()); \
QCOMPARE(l, QLocale(QLocale::exp_lang, QLocale::exp_country)); \
QCOMPARE(qHash(l), qHash(QLocale(QLocale::exp_lang, QLocale::exp_country))); \
}
@@ -428,14 +428,14 @@ void tst_QLocale::defaulted_ctor()
QLocale::setDefault(QLocale(QLocale::C));
const QString empty;
- TEST_CTOR("C", C, AnyCountry)
- TEST_CTOR("bla", C, AnyCountry)
- TEST_CTOR("zz", C, AnyCountry)
- TEST_CTOR("zz_zz", C, AnyCountry)
- TEST_CTOR("zz...", C, AnyCountry)
- TEST_CTOR("", C, AnyCountry)
- TEST_CTOR("en/", C, AnyCountry)
- TEST_CTOR(empty, C, AnyCountry)
+ TEST_CTOR("C", C, AnyTerritory)
+ TEST_CTOR("bla", C, AnyTerritory)
+ TEST_CTOR("zz", C, AnyTerritory)
+ TEST_CTOR("zz_zz", C, AnyTerritory)
+ TEST_CTOR("zz...", C, AnyTerritory)
+ TEST_CTOR("", C, AnyTerritory)
+ TEST_CTOR("en/", C, AnyTerritory)
+ TEST_CTOR(empty, C, AnyTerritory)
TEST_CTOR("en", English, UnitedStates)
TEST_CTOR("en", English, UnitedStates)
TEST_CTOR("en.", English, UnitedStates)
@@ -480,11 +480,11 @@ void tst_QLocale::defaulted_ctor()
QLocale l(req_lc); \
QVERIFY2(l.language() == QLocale::exp_lang \
&& l.script() == QLocale::exp_script \
- && l.country() == QLocale::exp_country, \
+ && l.territory() == QLocale::exp_country, \
QString("requested: \"" + QString(req_lc) + "\", got: " \
+ QLocale::languageToString(l.language()) \
+ QLatin1Char('/') + QLocale::scriptToString(l.script()) \
- + QLatin1Char('/') + QLocale::countryToString(l.country())).toLatin1().constData()); \
+ + QLatin1Char('/') + QLocale::territoryToString(l.territory())).toLatin1().constData()); \
}
TEST_CTOR("zh_CN", Chinese, SimplifiedHanScript, China)
@@ -664,11 +664,11 @@ void tst_QLocale::legacyNames()
{ \
QLocale l(req_lc); \
QVERIFY2(l.language() == QLocale::exp_lang \
- && l.country() == QLocale::exp_country, \
+ && l.territory() == QLocale::exp_country, \
QString("requested: \"" + QString(req_lc) + "\", got: " \
+ QLocale::languageToString(l.language()) \
+ QLatin1Char('/') \
- + QLocale::countryToString(l.country())).toLatin1().constData()); \
+ + QLocale::territoryToString(l.territory())).toLatin1().constData()); \
}
TEST_CTOR("mo_MD", Romanian, Moldova)
@@ -684,9 +684,9 @@ void tst_QLocale::consistentC()
{
const QLocale c(QLocale::C);
QCOMPARE(c, QLocale::c());
- QCOMPARE(c, QLocale(QLocale::C, QLocale::AnyScript, QLocale::AnyCountry));
+ QCOMPARE(c, QLocale(QLocale::C, QLocale::AnyScript, QLocale::AnyTerritory));
QVERIFY(QLocale::matchingLocales(QLocale::AnyLanguage, QLocale::AnyScript,
- QLocale::AnyCountry).contains(c));
+ QLocale::AnyTerritory).contains(c));
}
void tst_QLocale::matchingLocales()
@@ -694,7 +694,7 @@ void tst_QLocale::matchingLocales()
const QLocale c(QLocale::C);
const QLocale ru_RU(QLocale::Russian, QLocale::Russia);
- QList<QLocale> locales = QLocale::matchingLocales(QLocale::C, QLocale::AnyScript, QLocale::AnyCountry);
+ QList<QLocale> locales = QLocale::matchingLocales(QLocale::C, QLocale::AnyScript, QLocale::AnyTerritory);
QCOMPARE(locales.size(), 1);
QVERIFY(locales.contains(c));
@@ -702,12 +702,12 @@ void tst_QLocale::matchingLocales()
QCOMPARE(locales.size(), 1);
QVERIFY(locales.contains(ru_RU));
- locales = QLocale::matchingLocales(QLocale::Russian, QLocale::AnyScript, QLocale::AnyCountry);
+ locales = QLocale::matchingLocales(QLocale::Russian, QLocale::AnyScript, QLocale::AnyTerritory);
QVERIFY(!locales.isEmpty());
QVERIFY(!locales.contains(c));
QVERIFY(locales.contains(ru_RU));
- locales = QLocale::matchingLocales(QLocale::AnyLanguage, QLocale::CyrillicScript, QLocale::AnyCountry);
+ locales = QLocale::matchingLocales(QLocale::AnyLanguage, QLocale::CyrillicScript, QLocale::AnyTerritory);
QVERIFY(!locales.isEmpty());
QVERIFY(!locales.contains(c));
QVERIFY(locales.contains(ru_RU));
@@ -721,14 +721,14 @@ void tst_QLocale::matchingLocales()
void tst_QLocale::unixLocaleName_data()
{
QTest::addColumn<QLocale::Language>("lang");
- QTest::addColumn<QLocale::Country>("land");
+ QTest::addColumn<QLocale::Territory>("land");
QTest::addColumn<QString>("expect");
#define ADDROW(nom, lang, land, name) \
QTest::newRow(nom) << QLocale::lang << QLocale::land << QStringLiteral(name)
- ADDROW("C_any", C, AnyCountry, "C");
- ADDROW("en_any", English, AnyCountry, "en_US");
+ ADDROW("C_any", C, AnyTerritory, "C");
+ ADDROW("en_any", English, AnyTerritory, "en_US");
ADDROW("en_GB", English, UnitedKingdom, "en_GB");
ADDROW("ay_GB", Aymara, UnitedKingdom, "C");
#undef ADDROW
@@ -737,7 +737,7 @@ void tst_QLocale::unixLocaleName_data()
void tst_QLocale::unixLocaleName()
{
QFETCH(QLocale::Language, lang);
- QFETCH(QLocale::Country, land);
+ QFETCH(QLocale::Territory, land);
QFETCH(QString, expect);
QLocale::setDefault(QLocale(QLocale::C));
@@ -1456,17 +1456,17 @@ void tst_QLocale::negativeZero_data()
{
QTest::addColumn<QLocale::Language>("language");
QTest::addColumn<QLocale::Script>("script");
- QTest::addColumn<QLocale::Country>("territory");
+ QTest::addColumn<QLocale::Territory>("territory");
QTest::addColumn<QStringView>("expect");
QTest::newRow("C")
- << QLocale::C << QLocale::AnyScript << QLocale::AnyCountry
+ << QLocale::C << QLocale::AnyScript << QLocale::AnyTerritory
<< QStringView(u"0");
QTest::newRow("Arabic")
- << QLocale::Arabic << QLocale::ArabicScript << QLocale::AnyCountry
+ << QLocale::Arabic << QLocale::ArabicScript << QLocale::AnyTerritory
<< QStringView(u"\u0660");
QTest::newRow("Chakma")
- << QLocale::Chakma << QLocale::ChakmaScript << QLocale::AnyCountry
+ << QLocale::Chakma << QLocale::ChakmaScript << QLocale::AnyTerritory
<< QStringView(u"\xD804\xDD36"); // A surrogate pair.
}
@@ -1474,7 +1474,7 @@ void tst_QLocale::negativeZero()
{
QFETCH(QLocale::Language, language);
QFETCH(QLocale::Script, script);
- QFETCH(QLocale::Country, territory);
+ QFETCH(QLocale::Territory, territory);
QFETCH(QStringView, expect);
QLocale locale(language, script, territory);
QCOMPARE(locale.toString(std::copysign(0.0, -1.0)), expect);
@@ -2315,7 +2315,7 @@ static const int locale_data_count = sizeof(locale_data)/sizeof(locale_data[0]);
void tst_QLocale::testNames_data()
{
QTest::addColumn<QLocale::Language>("language");
- QTest::addColumn<QLocale::Country>("country");
+ QTest::addColumn<QLocale::Territory>("country");
QLocale::setDefault(QLocale(QLocale::C)); // Ensures predictable fall-backs
@@ -2324,39 +2324,39 @@ void tst_QLocale::testNames_data()
const QByteArray lang =
QLocale::languageToString(QLocale::Language(item.m_language_id)).toLatin1();
const QByteArray land =
- QLocale::countryToString(QLocale::Country(item.m_country_id)).toLatin1();
+ QLocale::territoryToString(QLocale::Territory(item.m_territory_id)).toLatin1();
QTest::addRow("data_%d (%s/%s)", i, lang.constData(), land.constData())
- << QLocale::Language(item.m_language_id) << QLocale::Country(item.m_country_id);
+ << QLocale::Language(item.m_language_id) << QLocale::Territory(item.m_territory_id);
}
}
void tst_QLocale::testNames()
{
QFETCH(QLocale::Language, language);
- QFETCH(const QLocale::Country, country);
+ QFETCH(const QLocale::Territory, country);
const QLocale l1(language, country);
- if (language == QLocale::AnyLanguage && country == QLocale::AnyCountry)
+ if (language == QLocale::AnyLanguage && country == QLocale::AnyTerritory)
language = QLocale::C;
QCOMPARE(l1.language(), language);
- QCOMPARE(l1.country(), country);
+ QCOMPARE(l1.territory(), country);
const QString name = l1.name();
const QLocale l2(name);
QCOMPARE(l2.language(), language);
- QCOMPARE(l2.country(), country);
+ QCOMPARE(l2.territory(), country);
QCOMPARE(l2.name(), name);
const QLocale l3(name + QLatin1String("@foo"));
QCOMPARE(l3.language(), language);
- QCOMPARE(l3.country(), country);
+ QCOMPARE(l3.territory(), country);
QCOMPARE(l3.name(), name);
const QLocale l4(name + QLatin1String(".foo"));
QCOMPARE(l4.language(), language);
- QCOMPARE(l4.country(), country);
+ QCOMPARE(l4.territory(), country);
QCOMPARE(l4.name(), name);
if (language != QLocale::C) {
@@ -2915,7 +2915,7 @@ void tst_QLocale::textDirection()
QFETCH(int, script);
QFETCH(bool, rightToLeft);
- QLocale locale(QLocale::Language(language), QLocale::Script(script), QLocale::AnyCountry);
+ QLocale locale(QLocale::Language(language), QLocale::Script(script), QLocale::AnyTerritory);
QCOMPARE(locale.textDirection() == Qt::RightToLeft, rightToLeft);
}
@@ -3243,9 +3243,9 @@ void tst_QLocale::lcsToCode()
QCOMPARE(QLocale::languageToCode(QLocale::C), QString("C"));
QCOMPARE(QLocale::languageToCode(QLocale::English), QString("en"));
- QCOMPARE(QLocale::countryToCode(QLocale::AnyCountry), QString());
- QCOMPARE(QLocale::countryToCode(QLocale::UnitedStates), QString("US"));
- QCOMPARE(QLocale::countryToCode(QLocale::EuropeanUnion), QString("EU"));
+ QCOMPARE(QLocale::territoryToCode(QLocale::AnyTerritory), QString());
+ QCOMPARE(QLocale::territoryToCode(QLocale::UnitedStates), QString("US"));
+ QCOMPARE(QLocale::territoryToCode(QLocale::EuropeanUnion), QString("EU"));
QCOMPARE(QLocale::scriptToCode(QLocale::AnyScript), QString());
QCOMPARE(QLocale::scriptToCode(QLocale::SimplifiedHanScript), QString("Hans"));
@@ -3263,14 +3263,14 @@ void tst_QLocale::codeToLcs()
QCOMPARE(QLocale::codeToLanguage(QString("ha")), QLocale::Hausa);
QCOMPARE(QLocale::codeToLanguage(QString("haw")), QLocale::Hawaiian);
- QCOMPARE(QLocale::codeToCountry(QString()), QLocale::AnyCountry);
- QCOMPARE(QLocale::codeToCountry(QString("ZZ")), QLocale::AnyCountry);
- QCOMPARE(QLocale::codeToCountry(QString("US")), QLocale::UnitedStates);
- QCOMPARE(QLocale::codeToCountry(QString("us")), QLocale::UnitedStates);
- QCOMPARE(QLocale::codeToCountry(QString("USA")), QLocale::AnyCountry);
- QCOMPARE(QLocale::codeToCountry(QString("EU")), QLocale::EuropeanUnion);
- QCOMPARE(QLocale::codeToCountry(QString("001")), QLocale::World);
- QCOMPARE(QLocale::codeToCountry(QString("150")), QLocale::Europe);
+ QCOMPARE(QLocale::codeToTerritory(QString()), QLocale::AnyTerritory);
+ QCOMPARE(QLocale::codeToTerritory(QString("ZZ")), QLocale::AnyTerritory);
+ QCOMPARE(QLocale::codeToTerritory(QString("US")), QLocale::UnitedStates);
+ QCOMPARE(QLocale::codeToTerritory(QString("us")), QLocale::UnitedStates);
+ QCOMPARE(QLocale::codeToTerritory(QString("USA")), QLocale::AnyTerritory);
+ QCOMPARE(QLocale::codeToTerritory(QString("EU")), QLocale::EuropeanUnion);
+ QCOMPARE(QLocale::codeToTerritory(QString("001")), QLocale::World);
+ QCOMPARE(QLocale::codeToTerritory(QString("150")), QLocale::Europe);
QCOMPARE(QLocale::codeToScript(QString()), QLocale::AnyScript);
QCOMPARE(QLocale::codeToScript(QString("Zzzz")), QLocale::AnyScript);
diff --git a/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp b/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp
index 5e272f2400..92676108e0 100644
--- a/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp
+++ b/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp
@@ -103,7 +103,7 @@ void tst_QTimeZone::printTimeZone(const QTimeZone &tz)
qDebug() << "Is Valid = " << tz.isValid();
qDebug() << "";
qDebug() << "Zone ID = " << tz.id();
- qDebug() << "Country = " << QLocale::countryToString(tz.country());
+ qDebug() << "Territory = " << QLocale::territoryToString(tz.territory());
qDebug() << "Comment = " << tz.comment();
qDebug() << "";
qDebug() << "Locale = " << QLocale().name();
@@ -178,7 +178,7 @@ void tst_QTimeZone::createTest()
QCOMPARE((tz == other), false);
QCOMPARE((tz != other), true);
- QCOMPARE(tz.country(), QLocale::NewZealand);
+ QCOMPARE(tz.territory(), QLocale::NewZealand);
QDateTime jan = QDateTime(QDate(2012, 1, 1), QTime(0, 0, 0), Qt::UTC);
QDateTime jun = QDateTime(QDate(2012, 6, 1), QTime(0, 0, 0), Qt::UTC);
@@ -275,7 +275,7 @@ void tst_QTimeZone::nullTest()
QCOMPARE(utc.isValid(), false);
QCOMPARE(nullTz1.id(), QByteArray());
- QCOMPARE(nullTz1.country(), QLocale::AnyCountry);
+ QCOMPARE(nullTz1.territory(), QLocale::AnyTerritory);
QCOMPARE(nullTz1.comment(), QString());
QDateTime jan = QDateTime(QDate(2012, 1, 1), QTime(0, 0, 0), Qt::UTC);
@@ -359,7 +359,7 @@ void tst_QTimeZone::dataStreamTest()
}
QCOMPARE(tz2.id(), QByteArray("QST"));
QCOMPARE(tz2.comment(), QString("Qt Testing"));
- QCOMPARE(tz2.country(), QLocale::Norway);
+ QCOMPARE(tz2.territory(), QLocale::Norway);
QCOMPARE(tz2.abbreviation(QDateTime::currentDateTime()), QString("QST"));
QCOMPARE(tz2.displayName(QTimeZone::StandardTime, QTimeZone::LongName, QLocale()),
QString("Qt Standard Time"));
@@ -642,7 +642,7 @@ void tst_QTimeZone::transitionEachZone()
if (here * 1000 != stamp) {
// (The +1 is due to using _1_:30 as baseSecs.)
qDebug("Failing at half past %d UTC (offset %d in %s)", i + 1, when.offsetFromUtc(),
- QLocale::countryToString(named.country()).toUtf8().constData());
+ QLocale::territoryToString(named.territory()).toUtf8().constData());
}
QCOMPARE(stamp % 1000, 0);
QCOMPARE(here - stamp / 1000, 0);
@@ -732,7 +732,7 @@ void tst_QTimeZone::stressTest()
QCOMPARE(testZone.isValid(), true);
QCOMPARE(testZone.id(), id);
QDateTime testDate = QDateTime(QDate(2015, 1, 1), QTime(0, 0, 0), Qt::UTC);
- testZone.country();
+ testZone.territory();
testZone.comment();
testZone.displayName(testDate);
testZone.displayName(QTimeZone::DaylightTime);
@@ -783,7 +783,7 @@ void tst_QTimeZone::windowsId()
USA "America/Chicago America/Indiana/Knox America/Indiana/Tell_City America/Menominee"
"America/North_Dakota/Beulah America/North_Dakota/Center"
"America/North_Dakota/New_Salem"
- AnyCountry "CST6CDT"
+ AnyTerritory "CST6CDT"
*/
QCOMPARE(QTimeZone::ianaIdToWindowsId("America/Chicago"),
QByteArray("Central Standard Time"));
@@ -800,7 +800,7 @@ void tst_QTimeZone::windowsId()
QByteArray("America/Chicago"));
QCOMPARE(QTimeZone::windowsIdToDefaultIanaId("Central Standard Time", QLocale::Canada),
QByteArray("America/Winnipeg"));
- QCOMPARE(QTimeZone::windowsIdToDefaultIanaId("Central Standard Time", QLocale::AnyCountry),
+ QCOMPARE(QTimeZone::windowsIdToDefaultIanaId("Central Standard Time", QLocale::AnyTerritory),
QByteArray("CST6CDT"));
QCOMPARE(QTimeZone::windowsIdToDefaultIanaId(QByteArray()), QByteArray());
@@ -837,13 +837,13 @@ void tst_QTimeZone::windowsId()
list.clear();
list << "CST6CDT";
- QCOMPARE(QTimeZone::windowsIdToIanaIds("Central Standard Time", QLocale::AnyCountry),
+ QCOMPARE(QTimeZone::windowsIdToIanaIds("Central Standard Time", QLocale::AnyTerritory),
list);
// Check no windowsId return empty
list.clear();
QCOMPARE(QTimeZone::windowsIdToIanaIds(QByteArray()), list);
- QCOMPARE(QTimeZone::windowsIdToIanaIds(QByteArray(), QLocale::AnyCountry), list);
+ QCOMPARE(QTimeZone::windowsIdToIanaIds(QByteArray(), QLocale::AnyTerritory), list);
}
void tst_QTimeZone::isValidId_data()
@@ -1009,7 +1009,7 @@ void tst_QTimeZone::utcTest()
QUtcTimeZonePrivate tzp;
QCOMPARE(tzp.isValid(), true);
QCOMPARE(tzp.id(), QByteArray("UTC"));
- QCOMPARE(tzp.country(), QLocale::AnyCountry);
+ QCOMPARE(tzp.territory(), QLocale::AnyTerritory);
QCOMPARE(tzp.abbreviation(0), QString("UTC"));
QCOMPARE(tzp.displayName(QTimeZone::StandardTime, QTimeZone::LongName, QLocale()), QString("UTC"));
QCOMPARE(tzp.offsetFromUtc(0), 0);
@@ -1050,7 +1050,7 @@ void tst_QTimeZone::utcTest()
QCOMPARE(tz.isValid(), true);
QCOMPARE(tz.id(), QByteArray("QST"));
QCOMPARE(tz.comment(), QString("Qt Testing"));
- QCOMPARE(tz.country(), QLocale::Norway);
+ QCOMPARE(tz.territory(), QLocale::Norway);
QCOMPARE(tz.abbreviation(now), QString("QST"));
QCOMPARE(tz.displayName(QTimeZone::StandardTime, QTimeZone::LongName, QLocale()),
QString("Qt Standard Time"));
diff --git a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
index f9572b85e3..ffe171d5f0 100644
--- a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
+++ b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
@@ -430,7 +430,7 @@ void tst_QDateTimeEdit::initTestCase()
if (system.language() != QLocale::C && system.language() != QLocale::English)
qWarning("Running under locale %s/%s -- this test may generate failures due to language differences",
qPrintable(QLocale::languageToString(system.language())),
- qPrintable(QLocale::countryToString(system.country())));
+ qPrintable(QLocale::territoryToString(system.territory())));
testWidget = new EditorDateEdit(0);
testFocusWidget = new QWidget(0);
testFocusWidget->resize(200, 100);
@@ -3881,7 +3881,7 @@ void tst_QDateTimeEdit::setLocaleOnCalendarWidget()
QList<QLocale> allLocales = QLocale::matchingLocales(
QLocale::AnyLanguage,
QLocale::AnyScript,
- QLocale::AnyCountry);
+ QLocale::AnyTerritory);
QLocale c = QLocale::c();
dateEdit.setCalendarPopup(true);
dateEdit.setLocale(c);
diff --git a/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp b/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp
index 09fc8343b5..a3f4f353d1 100644
--- a/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp
+++ b/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp
@@ -1208,7 +1208,7 @@ void tst_QDoubleSpinBox::taskQTBUG_6496_fiddlingWithPrecision()
void tst_QDoubleSpinBox::setGroupSeparatorShown_data()
{
QTest::addColumn<QLocale::Language>("lang");
- QTest::addColumn<QLocale::Country>("country");
+ QTest::addColumn<QLocale::Territory>("country");
QTest::newRow("data0") << QLocale::English << QLocale::UnitedStates;
QTest::newRow("data1") << QLocale::Swedish << QLocale::Sweden;
@@ -1220,7 +1220,7 @@ void tst_QDoubleSpinBox::setGroupSeparatorShown_data()
void tst_QDoubleSpinBox::setGroupSeparatorShown()
{
QFETCH(QLocale::Language, lang);
- QFETCH(QLocale::Country, country);
+ QFETCH(QLocale::Territory, country);
QLocale loc(lang, country);
QLocale::setDefault(loc);
diff --git a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp
index 724eff608f..c877454440 100644
--- a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp
+++ b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp
@@ -1310,7 +1310,7 @@ void tst_QSpinBox::interpretOnLosingFocus()
void tst_QSpinBox::setGroupSeparatorShown_data()
{
QTest::addColumn<QLocale::Language>("lang");
- QTest::addColumn<QLocale::Country>("country");
+ QTest::addColumn<QLocale::Territory>("country");
QTest::newRow("data0") << QLocale::English << QLocale::UnitedStates;
QTest::newRow("data1") << QLocale::Swedish << QLocale::Sweden;
@@ -1322,7 +1322,7 @@ void tst_QSpinBox::setGroupSeparatorShown_data()
void tst_QSpinBox::setGroupSeparatorShown()
{
QFETCH(QLocale::Language, lang);
- QFETCH(QLocale::Country, country);
+ QFETCH(QLocale::Territory, country);
QLocale loc(lang, country);
QLocale::setDefault(loc);
diff --git a/tests/benchmarks/corelib/text/qlocale/main.cpp b/tests/benchmarks/corelib/text/qlocale/main.cpp
index 0ddaa33110..887053ae4a 100644
--- a/tests/benchmarks/corelib/text/qlocale/main.cpp
+++ b/tests/benchmarks/corelib/text/qlocale/main.cpp
@@ -111,11 +111,11 @@ void tst_QLocale::fromTags_data()
{
QTest::addColumn<QLocale::Language>("language");
QTest::addColumn<QLocale::Script>("script");
- QTest::addColumn<QLocale::Country>("territory");
+ QTest::addColumn<QLocale::Territory>("territory");
#define ROW(name, lang, text, land) \
QTest::newRow(name) << QLocale::lang << QLocale::text << QLocale::land
- ROW("C", C, AnyScript, AnyCountry);
+ ROW("C", C, AnyScript, AnyTerritory);
ROW("en-Latn-DE", English, LatinScript, Germany);
ROW("sd-Deva-IN", Sindhi, DevanagariScript, India);
ROW("az-Cyrl-AZ", Azerbaijani, CyrillicScript, Azerbaijan);
@@ -151,7 +151,7 @@ void tst_QLocale::fromTags()
{
QFETCH(const QLocale::Language, language);
QFETCH(const QLocale::Script, script);
- QFETCH(const QLocale::Country, territory);
+ QFETCH(const QLocale::Territory, territory);
QBENCHMARK { LOOP(QLocale loc(language, script, territory)) }
}
@@ -192,17 +192,17 @@ void tst_QLocale::fromLangScript()
{
QFETCH(const QLocale::Language, language);
QFETCH(const QLocale::Script, script);
- QBENCHMARK { LOOP(QLocale loc(language, script, QLocale::AnyCountry)) }
+ QBENCHMARK { LOOP(QLocale loc(language, script, QLocale::AnyTerritory)) }
}
void tst_QLocale::fromLangLand_data()
{
QTest::addColumn<QLocale::Language>("language");
- QTest::addColumn<QLocale::Country>("territory");
+ QTest::addColumn<QLocale::Territory>("territory");
#define ROW(name, lang, land) \
QTest::newRow(name) << QLocale::lang << QLocale::land
- ROW("C", C, AnyCountry);
+ ROW("C", C, AnyTerritory);
ROW("en-DE", English, Germany);
ROW("sd-IN", Sindhi, India);
ROW("az-AZ", Azerbaijani, Azerbaijan);
@@ -230,18 +230,18 @@ void tst_QLocale::fromLangLand_data()
void tst_QLocale::fromLangLand()
{
QFETCH(const QLocale::Language, language);
- QFETCH(const QLocale::Country, territory);
+ QFETCH(const QLocale::Territory, territory);
QBENCHMARK { LOOP(QLocale loc(language, territory)) }
}
void tst_QLocale::fromScriptLand_data()
{
QTest::addColumn<QLocale::Script>("script");
- QTest::addColumn<QLocale::Country>("territory");
+ QTest::addColumn<QLocale::Territory>("territory");
#define ROW(name, text, land) \
QTest::newRow(name) << QLocale::text << QLocale::land
- ROW("Any", AnyScript, AnyCountry);
+ ROW("Any", AnyScript, AnyTerritory);
ROW("Latn-DE", LatinScript, Germany);
ROW("Deva-IN", DevanagariScript, India);
ROW("Cyrl-AZ", CyrillicScript, Azerbaijan);
@@ -276,7 +276,7 @@ void tst_QLocale::fromScriptLand_data()
void tst_QLocale::fromScriptLand()
{
QFETCH(const QLocale::Script, script);
- QFETCH(const QLocale::Country, territory);
+ QFETCH(const QLocale::Territory, territory);
QBENCHMARK { LOOP(QLocale loc(QLocale::AnyLanguage, script, territory)) }
}
@@ -330,16 +330,16 @@ void tst_QLocale::fromScript_data()
void tst_QLocale::fromScript()
{
QFETCH(const QLocale::Script, script);
- QBENCHMARK { LOOP(QLocale loc(QLocale::AnyLanguage, script, QLocale::AnyCountry)) }
+ QBENCHMARK { LOOP(QLocale loc(QLocale::AnyLanguage, script, QLocale::AnyTerritory)) }
}
void tst_QLocale::fromLand_data()
{
- QTest::addColumn<QLocale::Country>("territory");
+ QTest::addColumn<QLocale::Territory>("territory");
#define ROW(name, land) \
QTest::newRow(name) << QLocale::land
- ROW("Any", AnyCountry);
+ ROW("Any", AnyTerritory);
ROW("DE", Germany);
ROW("IN", India);
ROW("AZ", Azerbaijan);
@@ -361,7 +361,7 @@ void tst_QLocale::fromLand_data()
void tst_QLocale::fromLand()
{
- QFETCH(const QLocale::Country, territory);
+ QFETCH(const QLocale::Territory, territory);
QBENCHMARK { LOOP(QLocale loc(QLocale::AnyLanguage, territory)) }
}
diff --git a/tests/manual/qlocale/info.cpp b/tests/manual/qlocale/info.cpp
index 4d082577d4..3f23403350 100644
--- a/tests/manual/qlocale/info.cpp
+++ b/tests/manual/qlocale/info.cpp
@@ -53,8 +53,8 @@ InfoWidget::InfoWidget()
languageName = addItem("Language name:");
nativeLanguageName = addItem("Native language name:");
scriptName = addItem("Script name:");
- countryName = addItem("Country name:");
- nativeCountryName = addItem("Native country name:");
+ territoryName = addItem("Territory name:");
+ nativeTerritoryName = addItem("Native territory name:");
}
void InfoWidget::localeChanged(QLocale locale)
@@ -65,8 +65,8 @@ void InfoWidget::localeChanged(QLocale locale)
languageName->setText(QLocale::languageToString(locale.language()));
nativeLanguageName->setText(locale.nativeLanguageName());
scriptName->setText(QLocale::scriptToString(locale.script()));
- countryName->setText(QLocale::countryToString(locale.country()));
- nativeCountryName->setText(locale.nativeCountryName());
+ territoryName->setText(QLocale::territoryToString(locale.territory()));
+ nativeTerritoryName->setText(locale.nativeTerritoryName());
}
void InfoWidget::addItem(const QString &label, QWidget *w)
diff --git a/tests/manual/qlocale/info.h b/tests/manual/qlocale/info.h
index 1003f84c4f..a477afdb55 100644
--- a/tests/manual/qlocale/info.h
+++ b/tests/manual/qlocale/info.h
@@ -55,8 +55,8 @@ private:
QLineEdit *languageName;
QLineEdit *nativeLanguageName;
QLineEdit *scriptName;
- QLineEdit *countryName;
- QLineEdit *nativeCountryName;
+ QLineEdit *territoryName;
+ QLineEdit *nativeTerritoryName;
private slots:
void localeChanged(QLocale locale);
diff --git a/tests/manual/qlocale/languages.cpp b/tests/manual/qlocale/languages.cpp
index 6a750b9f7b..e3bd8a68f2 100644
--- a/tests/manual/qlocale/languages.cpp
+++ b/tests/manual/qlocale/languages.cpp
@@ -53,7 +53,7 @@ void LanguagesWidget::localeChanged(QLocale locale)
QLocale l(lang);
if (l.language() != QLocale::C) {
QString language = QLocale::languageToString(l.language());
- QString country = QLocale::countryToString(l.country());
+ QString country = QLocale::territoryToString(l.territory());
QString tooltip = QString(QLatin1String("%1: %2/%3")).arg(l.name(), language, country);
item->setToolTip(tooltip);
}
diff --git a/tests/manual/qlocale/window.cpp b/tests/manual/qlocale/window.cpp
index 059192492c..b222fcbfd8 100644
--- a/tests/manual/qlocale/window.cpp
+++ b/tests/manual/qlocale/window.cpp
@@ -41,7 +41,7 @@ Window::Window()
localeCombo->addItem("System", QLocale::system());
- QList<QLocale> locales = QLocale::matchingLocales(QLocale::AnyLanguage, QLocale::AnyScript, QLocale::AnyCountry);
+ QList<QLocale> locales = QLocale::matchingLocales(QLocale::AnyLanguage, QLocale::AnyScript, QLocale::AnyTerritory);
foreach (const QLocale &locale, locales) {
QString label = QLocale::languageToString(locale.language());
label += QLatin1Char('/');
@@ -49,7 +49,7 @@ Window::Window()
label += QLocale::scriptToString(locale.script());
label += QLatin1Char('/');
}
- label += QLocale::countryToString(locale.country());
+ label += QLocale::territoryToString(locale.territory());
localeCombo->addItem(label, locale);
}
@@ -103,11 +103,11 @@ void Window::systemLocaleChanged()
QLocale l = QLocale::system();
QString lang = QLocale::languageToString(l.language());
QString script = QLocale::scriptToString(l.script());
- QString country = QLocale::countryToString(l.country());
+ QString territory = QLocale::territoryToString(l.territory());
if (l.script() != QLocale::AnyScript)
- localeCombo->setItemText(0, QString("System: %1-%2-%3").arg(lang, script, country));
+ localeCombo->setItemText(0, QString("System: %1-%2-%3").arg(lang, script, territory));
else
- localeCombo->setItemText(0, QString("System: %1-%2").arg(lang, country));
+ localeCombo->setItemText(0, QString("System: %1-%2").arg(lang, territory));
emit localeChanged(0);
}