summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2019-10-04 11:29:34 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2019-10-25 11:41:30 +0200
commit946c7018838a1d6c62b0a1b1baf3ad6a960d2e00 (patch)
tree1c4b2971b66aed84bbf14cc4fa8f9dcc0cf69581 /tests
parent6acab25f97820023b9998359e6ca79cf11a4ab5c (diff)
Move a test for feature ICU from .pro to .cpp
Test QT_CONFIG(icu) in the code instead of testing qtConfig(icu) in the profile and setting an extra define just to shadow what's already defined. Also remove the matching define from qcollator.pro, whose test code didn't use it. Noticed while reviewing the conversions to CMake. Change-Id: I19d3b1026b2a8f50ec424c450614e721500fd38a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/text/qcollator/qcollator.pro1
-rw-r--r--tests/auto/corelib/text/qstring/qstring.pro1
-rw-r--r--tests/auto/corelib/text/qstring/tst_qstring.cpp21
3 files changed, 11 insertions, 12 deletions
diff --git a/tests/auto/corelib/text/qcollator/qcollator.pro b/tests/auto/corelib/text/qcollator/qcollator.pro
index 2f3995a75f..b7aa256ded 100644
--- a/tests/auto/corelib/text/qcollator/qcollator.pro
+++ b/tests/auto/corelib/text/qcollator/qcollator.pro
@@ -3,4 +3,3 @@ TARGET = tst_qcollator
QT = core-private testlib
SOURCES = tst_qcollator.cpp
DEFINES += QT_NO_CAST_TO_ASCII
-qtConfig(icu): DEFINES += QT_USE_ICU
diff --git a/tests/auto/corelib/text/qstring/qstring.pro b/tests/auto/corelib/text/qstring/qstring.pro
index ec8a9b5df5..3a8c98cd6c 100644
--- a/tests/auto/corelib/text/qstring/qstring.pro
+++ b/tests/auto/corelib/text/qstring/qstring.pro
@@ -3,7 +3,6 @@ TARGET = tst_qstring
QT = core-private testlib
SOURCES = tst_qstring.cpp
DEFINES += QT_NO_CAST_TO_ASCII
-qtConfig(icu): DEFINES += QT_USE_ICU
qtConfig(c++11): CONFIG += c++11
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/corelib/text/qstring/tst_qstring.cpp b/tests/auto/corelib/text/qstring/tst_qstring.cpp
index c96210f53d..2108e99f20 100644
--- a/tests/auto/corelib/text/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/text/qstring/tst_qstring.cpp
@@ -37,6 +37,7 @@
# undef QT_ASCII_CAST_WARNINGS
#endif
+#include <private/qglobal_p.h> // for the icu feature test
#include <QtTest/QtTest>
#include <qregexp.h>
#include <qregularexpression.h>
@@ -577,7 +578,7 @@ private slots:
void repeated_data() const;
void compareRef();
void arg_locale();
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
void toUpperLower_icu();
#endif
#if !defined(QT_NO_UNICODE_LITERAL)
@@ -2235,7 +2236,7 @@ void tst_QString::toUpper()
upper += QChar(QChar::highSurrogate(0x10428));
QCOMPARE(lower.toUpper(), upper);
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
// test doesn't work with ICU support, since QChar is unaware of any locale
QEXPECT_FAIL("", "test doesn't work with ICU support, since QChar is unaware of any locale", Continue);
QVERIFY(false);
@@ -2247,7 +2248,7 @@ void tst_QString::toUpper()
if (upper.length() == 1)
QVERIFY(upper == QString(1, QChar(i).toUpper()));
}
-#endif
+#endif // icu
}
void tst_QString::toLower()
@@ -2295,7 +2296,7 @@ void tst_QString::toLower()
upper += QChar(QChar::highSurrogate(0x10400));
QCOMPARE( upper.toLower(), lower);
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
// test doesn't work with ICU support, since QChar is unaware of any locale
QEXPECT_FAIL("", "test doesn't work with ICU support, since QChar is unaware of any locale", Continue);
QVERIFY(false);
@@ -2307,7 +2308,7 @@ void tst_QString::toLower()
if (lower.length() == 1)
QVERIFY(str.toLower() == QString(1, QChar(i).toLower()));
}
-#endif
+#endif // icu
}
void tst_QString::isUpper()
@@ -5623,7 +5624,7 @@ void tst_QString::localeAwareCompare()
QStringRef r2(&s2, 0, s2.length());
if (!locale.isEmpty()) {
-#if defined (Q_OS_DARWIN) || defined(QT_USE_ICU)
+#if defined (Q_OS_DARWIN) || QT_CONFIG(icu)
QSKIP("Setting the locale is not supported on OS X or ICU (you can set the C locale, but that won't affect localeAwareCompare)");
#else
const char *newLocale = setlocale(LC_ALL, locale.toLatin1());
@@ -5631,10 +5632,10 @@ void tst_QString::localeAwareCompare()
setlocale(LC_ALL, "");
QSKIP("Please install the proper locale on this machine to test properly");
}
-#endif
+#endif // Darwin || icu
}
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
// ### for c1, ICU disagrees with libc on how to compare
QEXPECT_FAIL("c1", "ICU disagrees with test", Abort);
#endif
@@ -6592,7 +6593,7 @@ void tst_QString::arg_locale()
}
-#ifdef QT_USE_ICU
+#if QT_CONFIG(icu)
// Qt has to be built with ICU support
void tst_QString::toUpperLower_icu()
{
@@ -6626,7 +6627,7 @@ void tst_QString::toUpperLower_icu()
QCOMPARE(l.toLower(sup), sup);
QCOMPARE(l.toLower(QString::fromLatin1("i")), QString::fromLatin1("i"));
}
-#endif
+#endif // icu
#if !defined(QT_NO_UNICODE_LITERAL)
// Only tested on c++0x compliant compiler or gcc