tst_QLocale: add some basic endonym tests
Actually triggered by investigating QTBUG-121485, where the issue turns out to be at construction time, but the complete lack of any testing of endonyms clearly needed addressed in any case. In the process, break up the long list of private slots in the test-class declaration. Task-number: QTBUG-121485 Change-Id: I49021f78d3bea2e1e55b2755a45943ab3fc23722 Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
e657c31e33
commit
904f1d3b13
@ -67,6 +67,7 @@ private slots:
|
||||
void fpExceptions();
|
||||
void negativeZero_data();
|
||||
void negativeZero();
|
||||
|
||||
void dayOfWeek();
|
||||
void dayOfWeek_data();
|
||||
void formatDate();
|
||||
@ -82,6 +83,7 @@ private slots:
|
||||
void toDate();
|
||||
void toTime_data();
|
||||
void toTime();
|
||||
|
||||
void doubleRoundTrip_data();
|
||||
void doubleRoundTrip();
|
||||
void integerRoundTrip_data();
|
||||
@ -106,6 +108,8 @@ private slots:
|
||||
void scriptToString();
|
||||
void territoryToString_data();
|
||||
void territoryToString();
|
||||
void endonym_data();
|
||||
void endonym();
|
||||
|
||||
void defaultNumberingSystem_data();
|
||||
void defaultNumberingSystem();
|
||||
@ -3499,6 +3503,37 @@ void tst_QLocale::territoryToString()
|
||||
QCOMPARE(QLocale::territoryToString(territory), name);
|
||||
}
|
||||
|
||||
void tst_QLocale::endonym_data()
|
||||
{
|
||||
QTest::addColumn<QLocale>("locale");
|
||||
QTest::addColumn<QString>("language");
|
||||
QTest::addColumn<QString>("territory");
|
||||
|
||||
QTest::newRow("en")
|
||||
<< QLocale(QLocale::English, QLocale::UnitedStates)
|
||||
<< u"American English"_s << u"United States"_s;
|
||||
QTest::newRow("en_GB")
|
||||
<< QLocale(QLocale::English, QLocale::UnitedKingdom)
|
||||
<< u"British English"_s << u"United Kingdom"_s; // So inaccurate
|
||||
}
|
||||
|
||||
void tst_QLocale::endonym()
|
||||
{
|
||||
QFETCH(const QLocale, locale);
|
||||
|
||||
auto report = qScopeGuard([locale]() {
|
||||
qDebug()
|
||||
<< "Failed for" << locale.name()
|
||||
<< "with language" << QLocale::languageToString(locale.language())
|
||||
<< "for territory" << QLocale::territoryToString(locale.territory())
|
||||
<< "in script" << QLocale::scriptToString(locale.script());
|
||||
});
|
||||
|
||||
QTEST(locale.nativeLanguageName(), "language");
|
||||
QTEST(locale.nativeTerritoryName(), "territory");
|
||||
report.dismiss();
|
||||
}
|
||||
|
||||
void tst_QLocale::currency()
|
||||
{
|
||||
const QLocale c(QLocale::C);
|
||||
|
Loading…
x
Reference in New Issue
Block a user