Add tests that zh-TW now correctly prefers zh-TW over zh translation
The bug, QTBUG-121418, was actually fixed earlier by commit 84afaafc9c6968dd76fcadc5392065d340543521 (or, for 6.8, commit 8c40e8cf12bb931149367677c56816864265249c), but escaped our attention at the time. On picking to 6.8, where the issue is fixed in QTranslator rather than QLocale::uiLanguages(), omit the truncated entries from tests of the latter. Also add commit 84afaafc9c6968dd76fcadc5392065d340543521's new tst_QTranslator::loadLocale_data() "System, mixed dialects" test-case, which commit 8c40e8cf12bb931149367677c56816864265249c skipped, despite actually making it work. Fixes: QTBUG-121418 Change-Id: Ie24eb172674189079aede7a39584ea760aac1b0c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 12f8ebf5cbdc9089564a93001926d20908bd1785) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit ee65d651a4cda48a9ed9636aecd45306d0f737d0) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
4dfbbe66b1
commit
ccffe9b8ca
@ -174,6 +174,7 @@ void tst_QTranslator::loadLocale_data()
|
|||||||
QTest::addRow("Australia")
|
QTest::addRow("Australia")
|
||||||
<< QLocale("en-AU")
|
<< QLocale("en-AU")
|
||||||
<< QStringList{"en-Latn-AU", "en-AU", "en"};
|
<< QStringList{"en-Latn-AU", "en-AU", "en"};
|
||||||
|
QTest::addRow("Taiwan") << QLocale("zh-TW") << QStringList{"zh-TW", "zh"};
|
||||||
|
|
||||||
// This produces a QLocale::uiLanguages list of
|
// This produces a QLocale::uiLanguages list of
|
||||||
// {"en-NO", "en-Latn-NO", "nb-NO", "nb-Latn-NO", "nb",
|
// {"en-NO", "en-Latn-NO", "nb-NO", "nb-Latn-NO", "nb",
|
||||||
@ -181,6 +182,10 @@ void tst_QTranslator::loadLocale_data()
|
|||||||
QTest::addRow("System, mixed languages")
|
QTest::addRow("System, mixed languages")
|
||||||
<< QLocale::system()
|
<< QLocale::system()
|
||||||
<< QStringList{"en-NO", "nb-NO", "de-DE", "zh-Hant-NO"};
|
<< QStringList{"en-NO", "nb-NO", "de-DE", "zh-Hant-NO"};
|
||||||
|
QTest::addRow("System, mixed dialects")
|
||||||
|
<< QLocale::system()
|
||||||
|
<< QStringList{"en-AU", "en-NZ", "de-DE", "en-GB"};
|
||||||
|
QTest::addRow("System, Taiwan") << QLocale::system() << QStringList{"zh-TW", "zh"};
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QTranslator::loadLocale()
|
void tst_QTranslator::loadLocale()
|
||||||
|
@ -3711,6 +3711,9 @@ void tst_QLocale::uiLanguages_data()
|
|||||||
QTest::newRow("zh_Hant")
|
QTest::newRow("zh_Hant")
|
||||||
<< QLocale("zh_Hant")
|
<< QLocale("zh_Hant")
|
||||||
<< QStringList{QString("zh-Hant-TW"), QString("zh-TW")};
|
<< QStringList{QString("zh-Hant-TW"), QString("zh-TW")};
|
||||||
|
QTest::newRow("zh_TW")
|
||||||
|
<< QLocale("zh_TW")
|
||||||
|
<< QStringList{u"zh-Hant-TW"_s, u"zh-TW"_s};
|
||||||
|
|
||||||
QTest::newRow("zh_Hans_CN")
|
QTest::newRow("zh_Hans_CN")
|
||||||
<< QLocale(QLocale::Chinese, QLocale::SimplifiedHanScript, QLocale::China)
|
<< QLocale(QLocale::Chinese, QLocale::SimplifiedHanScript, QLocale::China)
|
||||||
@ -4143,6 +4146,9 @@ void tst_QLocale::mySystemLocale_data()
|
|||||||
QTest::addRow("chinese-full")
|
QTest::addRow("chinese-full")
|
||||||
<< QString("zh-Hans-CN") << QLocale::Chinese
|
<< QString("zh-Hans-CN") << QLocale::Chinese
|
||||||
<< QStringList{QStringLiteral("zh-Hans-CN"), QStringLiteral("zh-CN"), QStringLiteral("zh")};
|
<< QStringList{QStringLiteral("zh-Hans-CN"), QStringLiteral("zh-CN"), QStringLiteral("zh")};
|
||||||
|
QTest::addRow("chinese-taiwan")
|
||||||
|
<< u"zh-TW"_s << QLocale::Chinese
|
||||||
|
<< QStringList{u"zh-TW"_s, u"zh-Hant-TW"_s};
|
||||||
|
|
||||||
// For C, it should preserve what the system gave us but only add "C", never anything more:
|
// For C, it should preserve what the system gave us but only add "C", never anything more:
|
||||||
QTest::addRow("C") << QString("C") << QLocale::C << QStringList{QStringLiteral("C")};
|
QTest::addRow("C") << QString("C") << QLocale::C << QStringList{QStringLiteral("C")};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user