diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2020-07-27 16:39:07 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2020-09-14 09:47:51 +0200 |
commit | 533df067e9869522b348d172fee85b2a501540b6 (patch) | |
tree | 6e8472798e855a5206f357317f9267b8042cfffe /tests/auto/corelib/text | |
parent | c4378b8620453cd4bfaf12e45f623b3bdc1038e2 (diff) |
Purge Q_{STDLIB,COMPILER}_UNICODE_STRINGS
These were now always defined, hence redundant.
Leave the #define in place so that we can verify we actually do always
define it, in a #else of an existing #if check on it.
Change-Id: Iea4c3dbc8f9982268bcf81da5ef17fe2ebf5c462
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/text')
-rw-r--r-- | tests/auto/corelib/text/qchar/tst_qchar.cpp | 4 | ||||
-rw-r--r-- | tests/auto/corelib/text/qstring/tst_qstring.cpp | 20 | ||||
-rw-r--r-- | tests/auto/corelib/text/qstringbuilder/qstringbuilder1/stringbuilder.cpp | 8 |
3 files changed, 2 insertions, 30 deletions
diff --git a/tests/auto/corelib/text/qchar/tst_qchar.cpp b/tests/auto/corelib/text/qchar/tst_qchar.cpp index 806e84c397..b150600e36 100644 --- a/tests/auto/corelib/text/qchar/tst_qchar.cpp +++ b/tests/auto/corelib/text/qchar/tst_qchar.cpp @@ -78,14 +78,10 @@ private slots: void tst_QChar::fromChar16_t() { -#if defined(Q_COMPILER_UNICODE_STRINGS) QChar aUmlaut = u'\u00E4'; // German small letter a-umlaut QCOMPARE(aUmlaut, QChar(0xE4)); QChar replacementCharacter = u'\uFFFD'; QCOMPARE(replacementCharacter, QChar(QChar::ReplacementCharacter)); -#else - QSKIP("This test requires C++11 char16_t support enabled in the compiler."); -#endif } void tst_QChar::fromUcs4_data() diff --git a/tests/auto/corelib/text/qstring/tst_qstring.cpp b/tests/auto/corelib/text/qstring/tst_qstring.cpp index 319d429c10..74a6ba3e4e 100644 --- a/tests/auto/corelib/text/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/text/qstring/tst_qstring.cpp @@ -541,7 +541,8 @@ private slots: void split_regularexpression(); void fromUtf16_data(); void fromUtf16(); - void fromUtf16_char16_data(); + void fromUtf16_char16_data() { fromUtf16_data(); } + void fromUtf16_char16(); void latin1String(); void nanAndInf(); @@ -4506,7 +4507,6 @@ void tst_QString::fromUcs4() QVERIFY( !s.isNull() ); QCOMPARE( s.size(), 2 ); -#ifdef Q_COMPILER_UNICODE_STRINGS static const char32_t str1[] = U"Hello Unicode World"; s = QString::fromUcs4(str1, sizeof(str1) / sizeof(str1[0]) - 1); QCOMPARE(s, QString("Hello Unicode World")); @@ -4519,7 +4519,6 @@ void tst_QString::fromUcs4() s = QString::fromUcs4(U"\u221212\U000020AC\U00010000"); QCOMPARE(s, QString::fromUtf8("\342\210\222" "12" "\342\202\254" "\360\220\200\200")); -#endif // QTBUG-62011: don't mistake ZWNBS for BOM // Start with one BOM, to ensure we use the right endianness: @@ -5687,29 +5686,17 @@ void tst_QString::fromUtf16() QCOMPARE(QString::fromUtf16(ucs2.utf16(), len), res); } -void tst_QString::fromUtf16_char16_data() -{ -#ifdef Q_COMPILER_UNICODE_STRINGS - fromUtf16_data(); -#else - QSKIP("Compiler does not support C++11 unicode strings"); -#endif -} - void tst_QString::fromUtf16_char16() { -#ifdef Q_COMPILER_UNICODE_STRINGS QFETCH(QString, ucs2); QFETCH(QString, res); QFETCH(int, len); QCOMPARE(QString::fromUtf16(reinterpret_cast<const char16_t *>(ucs2.utf16()), len), res); -#endif } void tst_QString::unicodeStrings() { -#ifdef Q_STDLIB_UNICODE_STRINGS QString s1, s2; static const std::u16string u16str1(u"Hello Unicode World"); static const std::u32string u32str1(U"Hello Unicode World"); @@ -5723,9 +5710,6 @@ void tst_QString::unicodeStrings() s1 = QString::fromStdU32String(std::u32string(U"\u221212\U000020AC\U00010000")); QCOMPARE(s1, QString::fromUtf8("\342\210\222" "12" "\342\202\254" "\360\220\200\200")); -#else - QSKIP("Standard Library does not support C++11 unicode strings"); -#endif } void tst_QString::latin1String() diff --git a/tests/auto/corelib/text/qstringbuilder/qstringbuilder1/stringbuilder.cpp b/tests/auto/corelib/text/qstringbuilder/qstringbuilder1/stringbuilder.cpp index e0a261efd0..c1a208bc62 100644 --- a/tests/auto/corelib/text/qstringbuilder/qstringbuilder1/stringbuilder.cpp +++ b/tests/auto/corelib/text/qstringbuilder/qstringbuilder1/stringbuilder.cpp @@ -38,12 +38,10 @@ #define UTF8_LITERAL_LEN (sizeof(UTF8_LITERAL)-1) #define UTF8_LITERAL_EXTRA "s\xc3\xb6m\xc3\xab l\xc3\xaft\xc3\xabr\xc3\xa4l" "EXTRA" -#ifdef Q_COMPILER_UNICODE_STRINGS // "some literal", but replacing all vocals by their umlauted UTF-8 string :) #define UNICODE_LITERAL u"s\u00f6m\u00eb l\u00eft\u00ebr\u00e4l" #define UNICODE_LITERAL_LEN ((sizeof(UNICODE_LITERAL) - 1) / 2) #define UNICODE_LITERAL_EXTRA u"s\u00f6m\u00eb l\u00eft\u00ebr\u00e4l" "EXTRA" -#endif #ifndef P # error You need to define P @@ -64,11 +62,9 @@ template <> QString toQString(const QLatin1String &l) { return l; } template <> QString toQString(const QLatin1Char &l) { return QChar(l); } template <> QString toQString(const QChar &c) { return c; } template <> QString toQString(const QChar::SpecialCharacter &c) { return QChar(c); } -#ifdef Q_COMPILER_UNICODE_STRINGS template <> QString toQString(char16_t * const &p) { return QStringView(p).toString(); } template <size_t N> QString toQString(const char16_t (&a)[N]) { return QStringView(a).toString(); } template <> QString toQString(const char16_t &c) { return QChar(c); } -#endif template <typename T> QByteArray toQByteArray(const T &t); @@ -87,12 +83,10 @@ void runScenario() QLatin1Char lchar('c'); QChar qchar(lchar); QChar::SpecialCharacter special(QChar::Nbsp); -#ifdef Q_COMPILER_UNICODE_STRINGS char16_t u16char = UNICODE_LITERAL[0]; char16_t u16chararray[] = { u's', 0xF6, u'm', 0xEB, u' ', u'l', 0xEF, u't', 0xEB, u'r', 0xE4, u'l', 0x00 }; QCOMPARE(QStringView(u16chararray), QStringView(UNICODE_LITERAL)); char16_t *u16charstar = u16chararray; -#endif #define CHECK(QorP, a1, a2) \ do { \ @@ -214,11 +208,9 @@ void runScenario() r = lchar + r; QCOMPARE(r, QString(lchar P stringview)); -#ifdef Q_COMPILER_UNICODE_STRINGS r = QStringLiteral(UNICODE_LITERAL); r = r Q QStringLiteral(UNICODE_LITERAL); QCOMPARE(r, r3); -#endif #ifndef QT_NO_CAST_FROM_ASCII r = string P LITERAL; |