diff options
Diffstat (limited to 'tests/auto/corelib/text/qcollator/tst_qcollator.cpp')
-rw-r--r-- | tests/auto/corelib/text/qcollator/tst_qcollator.cpp | 48 |
1 files changed, 14 insertions, 34 deletions
diff --git a/tests/auto/corelib/text/qcollator/tst_qcollator.cpp b/tests/auto/corelib/text/qcollator/tst_qcollator.cpp index 5e2c7f1b53..b6da8a3899 100644 --- a/tests/auto/corelib/text/qcollator/tst_qcollator.cpp +++ b/tests/auto/corelib/text/qcollator/tst_qcollator.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QTest> @@ -34,6 +9,7 @@ #include <QScopeGuard> #include <cstring> +#include <iostream> class tst_QCollator : public QObject { @@ -77,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"); @@ -112,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"); @@ -288,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 @@ -297,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")) { |