qt5base-lts/tests/auto/corelib
Edward Welbourne cc64959602 Tidy up tst_QString::localeAwareCompare()
It was suppressed unconditionally (albeit in different places and with
different levels of obviousness) almost everywhere, due to inability
to set the system locale in use by the implementation. Several
test-cases used ISO-8859-1 encoding on Q_OS_MAC, where the tests were
all suppressed anyway. A block of no_NO tests was #if 0'd out; and
should, in any case, have been nb_NO. Tests of any locale but en_US
were skipped on Q_OS_WIN because we can't set the locale (but
including the tests of en_US tacitly assumed that's the system
locale). If setlocale() failed, for ICU or DARWIN, the test was
skipped; but we might as well check for this in the _data() to save
repetition.

The test was laboriously going through the sign cases; relocate the
QString::compare() test's sign() function so that we can use it here,
too, and simply QCOMPARE() signs. Introduce a TransientLocale class,
copied from tst_QLocale, to take care of setting and restoring the
locale using setlocale(). Change the locale name to a QByteArray so
that we save having to convert it to one in order to pass it to
setlocale(). Since that changed every _data() row, reformat those rows
in the process - most of them were long lines.

On the systems where we can't set the locale used by the function
being tested, condition each block of tests in the _data() on whether
LC_COLLATE looks like the locale to be tested, and report how a
determined developer at least can (by repeatedly running the test with
different locales set) test all the cases; and we'll attempt the ones
that we can, when one of the relevant locales is in use. If that
leaves us with no tests we can do, QSKIP() in the _data() to avoid an
assert failure for "Test data requested, but no testdata available."

Change-Id: I75709fda8827dcbe74f80c4136042054da6fcb13
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-06-16 17:42:37 +02:00
..
animation Avoid use after free in tst_qsequentialanimationgroup 2021-06-02 16:45:23 +02:00
global Prefer QFAIL("Informative message") over QVERIFY(false) 2021-06-14 15:57:16 +02:00
io QLoggingSettingsParser: port setContent() to QStringView 2021-06-16 13:22:18 +02:00
itemmodels QSortFilterProxyModel: create mappings on demand again 2021-06-03 00:53:08 +02:00
kernel Apple: Use POSIX IPC instead of System V in sandboxed applications 2021-06-16 15:53:23 +02:00
mimetypes Fix BASE argument of qt_add_resources 2021-05-18 16:02:52 +02:00
platform Android: Add runOnMainAndroidThread() under QNativeInterface 2021-05-26 23:24:11 +00:00
plugin Fix BASE argument of qt_add_resources 2021-05-18 16:02:52 +02:00
serialization Prefer QFAIL("Informative message") over QVERIFY(false) 2021-06-14 15:57:16 +02:00
text Tidy up tst_QString::localeAwareCompare() 2021-06-16 17:42:37 +02:00
thread QTestlib: Add formatting for QObject * in QCOMPARE 2021-05-26 11:02:48 +00:00
time Fix and clean up utterly confused (and confusing) transition tests 2021-06-15 16:58:46 +02:00
tools String API Symmetry: test for indexOf with large negative offset 2021-06-11 22:04:04 +00:00
CMakeLists.txt Add tests for QAndroidApplication's sdkVersion and activity 2021-05-13 01:41:36 +03:00