diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2021-03-16 16:05:20 +0100 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2021-06-16 17:42:37 +0200 |
commit | cc64959602ca0655d523337446bf8af9605056cc (patch) | |
tree | 4225311e0af0501e34a437f25d91ce4702da64a1 /src/3rdparty/libgq/gconf/gq-gconf.pc.in | |
parent | 5fb99e3860eb43f4bacacec7f4a4626cb0159b14 (diff) |
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>
Diffstat (limited to 'src/3rdparty/libgq/gconf/gq-gconf.pc.in')
0 files changed, 0 insertions, 0 deletions