diff options
Diffstat (limited to 'tests/auto/corelib/text/qcollator')
-rw-r--r-- | tests/auto/corelib/text/qcollator/CMakeLists.txt | 8 | ||||
-rw-r--r-- | tests/auto/corelib/text/qcollator/tst_qcollator.cpp | 21 |
2 files changed, 19 insertions, 10 deletions
diff --git a/tests/auto/corelib/text/qcollator/CMakeLists.txt b/tests/auto/corelib/text/qcollator/CMakeLists.txt index c935df0dac..c9f5f0e9ca 100644 --- a/tests/auto/corelib/text/qcollator/CMakeLists.txt +++ b/tests/auto/corelib/text/qcollator/CMakeLists.txt @@ -1,12 +1,16 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: BSD-3-Clause -# Generated from qcollator.pro. - ##################################################################### ## tst_qcollator Test: ##################################################################### +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qcollator LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + qt_internal_add_test(tst_qcollator SOURCES tst_qcollator.cpp diff --git a/tests/auto/corelib/text/qcollator/tst_qcollator.cpp b/tests/auto/corelib/text/qcollator/tst_qcollator.cpp index 0a019404b6..b6da8a3899 100644 --- a/tests/auto/corelib/text/qcollator/tst_qcollator.cpp +++ b/tests/auto/corelib/text/qcollator/tst_qcollator.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2021 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> @@ -9,6 +9,7 @@ #include <QScopeGuard> #include <cstring> +#include <iostream> class tst_QCollator : public QObject { @@ -52,7 +53,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 +88,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"); @@ -263,8 +264,12 @@ void tst_QCollator::compare() auto asSign = [](int compared) { return compared < 0 ? -1 : compared > 0 ? 1 : 0; }; - -#if defined(Q_OS_ANDROID) || defined(Q_OS_INTEGRITY) +#if defined(Q_OS_WASM) + if (strcmp(QTest::currentDataTag(), "english5") == 0 + || strcmp(QTest::currentDataTag(), "english8") == 0) + QSKIP("Some en-us locale tests have issues on WASM"); +#endif // Q_OS_WASM +#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 @@ -272,9 +277,9 @@ void tst_QCollator::compare() if (numericMode) collator.setNumericMode(true); - int keyCompareResult = result; - [[maybe_unused]]int keyCompareCaseInsensitiveResult = caseInsensitiveResult; - [[maybe_unused]]int keyComparePunctuationResultResult = punctuationResult; + [[maybe_unused]] int keyCompareResult = result; + [[maybe_unused]] int keyCompareCaseInsensitiveResult = caseInsensitiveResult; + [[maybe_unused]] int keyComparePunctuationResultResult = punctuationResult; // trying to deal with special behavior of different OS-dependent collators if (collator.locale() == QLocale("C")) { |