Refine localeAwareCompare() test-case filtering on ICU
The code to work around setlocale() mis-describing en_US as C ensured that we didn't accept the C test-cases when the locale was really en_US; but neglected to accept the en_US test-cases when the locale really was en_US but was misdescribed as C. This lead to no tests being run when the locale was en_US. Tweak the logic of the test filtering to compare the wanted locale against the system locale both when C is wanted and when it isn't. Make the skip-messages a little more informative. Pick-to: 6.2 6.1 Change-Id: I4e072e12819144b2941b87a5f486534047d9a579 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
b41d5f6293
commit
a13942791d
|
|
@ -5949,12 +5949,14 @@ void tst_QString::localeAwareCompare_data()
|
|||
// to en.UTF-8, but setlocale() reports that as C, whose sort order is
|
||||
// simpler. Only believe we can run C tests if the environment variables
|
||||
// (which, conveniently, QLocale::system()'s Unix backend uses) say it
|
||||
// really is.
|
||||
if (current == "C" && current == wanted) {
|
||||
if (QLocale::system().name() == u"C")
|
||||
// really is. Conversely, don't reject "en_US" just because setlocale()
|
||||
// misdescribes it.
|
||||
if (current == "C") {
|
||||
const QString sys = QLocale::system().name();
|
||||
if (wanted == current ? sys == u"C" : sys.startsWith(wanted))
|
||||
return true;
|
||||
qDebug("Skipping C test-cases as we can only test in locale %s",
|
||||
QLocale::system().name().toUtf8().constData());
|
||||
qDebug("Skipping %s test-cases as we can only test in locale %s (seen as C)",
|
||||
wanted, sys.toUtf8().constData());
|
||||
return false;
|
||||
}
|
||||
# endif
|
||||
|
|
@ -5970,7 +5972,8 @@ void tst_QString::localeAwareCompare_data()
|
|||
return true;
|
||||
}
|
||||
# endif
|
||||
qDebug("Skipping %s test-cases as we can only test in locale %s", wanted, current.data());
|
||||
qDebug("Skipping %s test-cases as we can only test in locale %s (seen as %s)",
|
||||
wanted, QLocale::system().name().toUtf8().constData(), current.data());
|
||||
return false;
|
||||
};
|
||||
#else
|
||||
|
|
|
|||
Loading…
Reference in New Issue