Correctly determine if posix collator is used in tst_qcollator

qcollator_posix.cpp is included if ICU is not used and the OS is not
Win nor macOS. Reflect that fact in tst_qcollator instead of using
alternative means which breaks with new platforms that use the
posix collator.

Task-number: QTBUG-109954
Change-Id: I592500ce9626efbcc9377cecf6641967f978c6da
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Mikolaj Boc 2023-01-09 16:05:48 +01:00
parent 7f1d3c09c9
commit a071bd674a
1 changed files with 3 additions and 3 deletions

View File

@ -52,7 +52,7 @@ void tst_QCollator::basics()
// posix implementation supports only C and default locale,
// so update it for Android and INTEGRITY builds
#if defined(Q_OS_ANDROID) || defined(Q_OS_INTEGRITY)
#if !QT_CONFIG(icu) && !defined(Q_OS_WIN) && !defined(Q_OS_MACOS)
c3.setLocale(QLocale());
#endif
QCollatorSortKey key1 = c3.sortKey("test");
@ -87,7 +87,7 @@ void tst_QCollator::moveSemantics()
// test QCollatorSortKey move assignment
// posix implementation supports only C and default locale,
// so update it for Android and INTEGRITY builds
#if defined(Q_OS_ANDROID) || defined(Q_OS_INTEGRITY)
#if !QT_CONFIG(icu) && !defined(Q_OS_WIN) && !defined(Q_OS_MACOS)
c1.setLocale(QLocale());
#endif
QCollatorSortKey key1 = c1.sortKey("1");
@ -264,7 +264,7 @@ void tst_QCollator::compare()
return compared < 0 ? -1 : compared > 0 ? 1 : 0;
};
#if defined(Q_OS_ANDROID) || defined(Q_OS_INTEGRITY)
#if !QT_CONFIG(icu) && !defined(Q_OS_WIN) && !defined(Q_OS_MACOS)
if (collator.locale() != QLocale::c() && collator.locale() != QLocale::system().collation())
QSKIP("POSIX implementation of collation only supports C and system collation locales");
#endif