qt6-bb10/tests/auto
Volker Hilsheimer 8352306cdc QTranslator: fix loading order when loading from locale
A locale's UI language includes the script, e.g. the QLocale::uiLanguage
list for the Australian locale en_AU is {"en_Latn_AU", "en_AU", "en"}.
The old code iterated over each language in the outer loop, and for each
language tried several times, removing a segment from the back with each
try in the inner loop. The de-facto search order was then

en_Latn_AU
en_latn_au
en_Latn
en_latn
en
en_AU
en_au
en

Usually, translation files are provided for country_Territory, i.e.
en_AU. But if an en file (for a generic English translation) was also
present, then en_AU was never tried.

Fix this by breaking the logic into two loops: first, create a list of
candidates by removing segments from each UI Language. Then sort that
list of candidates so that entries with more segments come first. The
search order is now:

en_Latn_AU
en_latn_au
en_Latn
en_latn
en_AU
en_au
en

This way, en_AU gets loaded correctly, before en is tried.

Adjust the test, which was essentially duplicating the logic from
QTranslator to generate files. This only tested that two identical loops
result in the same thing. Instead of using the system locale, make the
test data-driven, and explicitly try en_US and en_AU, with candidate
files generated based on a hardcoded list for each data row.

Pick-to: 6.7 6.5
Fixes: QTBUG-124898
Change-Id: I6bdcff289d2843e61c9053c116e955b79e09e95a
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit 9a11273b745a30cebb5cd648c89eb224e9704492)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-06-20 19:30:33 +00:00
..
bic/data Add binary compatibility file for 6.7.0 2024-04-17 10:18:37 +00:00
cmake Remove GENERATE_CPP_EXPORTS argument 2024-06-13 14:39:17 +00:00
concurrent Fix truncation warning in generation_helpers 2024-03-18 20:10:34 +01:00
corelib QTranslator: fix loading order when loading from locale 2024-06-20 19:30:33 +00:00
dbus QDBusSignature: accept empty strings as valid 2024-05-10 13:17:20 -07:00
gui tst_QEventDispatcher: port to QTEST_THROW_ON_FAIL 2024-06-18 08:09:13 +00:00
guiapplauncher Convert "Color Editor Factory" Example to snippets 2024-04-19 13:39:41 +02:00
network Add move semantics autotest for QFormDataBuilder 2024-06-20 19:30:13 +00:00
opengl tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00
other a11y: Notify of name change when setting window title used as a11y name 2024-05-22 08:50:31 +02:00
printsupport Change license for tests files 2024-02-04 09:56:42 +01:00
shared Introduce flag to use typographical line metrics for fonts 2024-05-31 19:30:53 +02:00
sql SQL/IBase: add partial support for SQL_INT128 datatype 2024-06-05 13:16:46 +00:00
testlib Fix misspelled QTEST_THROW_ON_FAILURE 2024-06-17 23:17:50 +00:00
tools tst_moc: fix 'inline function used but never defined' GCC warning 2024-06-18 08:09:09 +00:00
wasm Add copyright and licensing to build system files missing it 2024-05-21 17:23:21 +02:00
widgets Include horizontal scrollbar's size in sizehint 2024-06-20 06:54:30 +00:00
xml Add copyright and licensing to build system files missing it 2024-05-21 17:23:21 +02:00
CMakeLists.txt wasm: Enable qstandardpaths test 2024-05-06 16:01:28 +02:00
network-settings.h Change license for tests files 2024-02-04 09:56:42 +01:00