diff options
Diffstat (limited to 'tests/auto/corelib')
12 files changed, 97 insertions, 87 deletions
diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index e5b7051997..e408cd3e48 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -3182,7 +3182,7 @@ void tst_QFile::mapResource() QCOMPARE(file.error(), error); QVERIFY((error == QFile::NoError) ? (memory != 0) : (memory == 0)); if (error == QFile::NoError) - QCOMPARE(QString(memory[0]), QString::number(offset + 1)); + QCOMPARE(QString(QChar(memory[0])), QString::number(offset + 1)); QVERIFY(file.unmap(memory)); } diff --git a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp index da9477ca84..4b77820028 100644 --- a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp +++ b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp @@ -517,23 +517,23 @@ void tst_QUrlInternal::nameprep_highcodes_data() QTest::addColumn<int>("rc"); { - QChar st[] = { '-', 0xd801, 0xdc1d, 'a' }; - QChar se[] = { '-', 0xd801, 0xdc45, 'a' }; + QChar st[] = { '-', QChar(0xd801), QChar(0xdc1d), 'a' }; + QChar se[] = { '-', QChar(0xd801), QChar(0xdc45), 'a' }; QTest::newRow("highcodes (U+1041D)") << QString(st, sizeof(st)/sizeof(st[0])) << QString(se, sizeof(se)/sizeof(se[0])) << QString() << 0 << 0; } { - QChar st[] = { 0x011C, 0xd835, 0xdf6e, 0x0110 }; - QChar se[] = { 0x011D, 0x03C9, 0x0111 }; + QChar st[] = { QChar(0x011C), QChar(0xd835), QChar(0xdf6e), QChar(0x0110) }; + QChar se[] = { QChar(0x011D), QChar(0x03C9), QChar(0x0111) }; QTest::newRow("highcodes (U+1D76E)") << QString(st, sizeof(st)/sizeof(st[0])) << QString(se, sizeof(se)/sizeof(se[0])) << QString() << 0 << 0; } { - QChar st[] = { 'D', 'o', '\'', 0x2060, 'h' }; + QChar st[] = { 'D', 'o', '\'', QChar(0x2060), 'h' }; QChar se[] = { 'd', 'o', '\'', 'h' }; QTest::newRow("highcodes (D, o, ', U+2060, h)") << QString(st, sizeof(st)/sizeof(st[0])) diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel_common/tst_qsortfilterproxymodel.cpp b/tests/auto/corelib/itemmodels/qsortfilterproxymodel_common/tst_qsortfilterproxymodel.cpp index 78749559b5..20fc5d492d 100644 --- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel_common/tst_qsortfilterproxymodel.cpp +++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel_common/tst_qsortfilterproxymodel.cpp @@ -4794,7 +4794,7 @@ void tst_QSortFilterProxyModel::filterAndInsertColumn() model.insertRows(0, 1); for (int i = 0; i < model.rowCount(); ++i) { for (int j = 0; j < model.columnCount(); ++j) - model.setData(model.index(i, j), QString('A' + j) + QString::number(i + 1)); + model.setData(model.index(i, j), QString(QChar('A' + j)) + QString::number(i + 1)); } ColumnFilterProxy proxy(filterMode); proxy.setSourceModel(&model); @@ -5048,7 +5048,7 @@ void tst_QSortFilterProxyModel::invalidateColumnsOrRowsFilter() QStandardItemModel model(10, 4); for (int i = 0; i < model.rowCount(); ++i) { for (int j = 0; j < model.columnCount(); ++j) { - model.setItem(i, j, new QStandardItem(QString('A' + j) + QString::number(i + 1))); + model.setItem(i, j, new QStandardItem(QString(QChar('A' + j)) + QString::number(i + 1))); model.item(i, 0)->appendColumn({ new QStandardItem(QString("child col %0").arg(j)) }); } } diff --git a/tests/auto/corelib/serialization/json/tst_qtjson.cpp b/tests/auto/corelib/serialization/json/tst_qtjson.cpp index 5d4a9b15b1..04411cea63 100644 --- a/tests/auto/corelib/serialization/json/tst_qtjson.cpp +++ b/tests/auto/corelib/serialization/json/tst_qtjson.cpp @@ -3229,8 +3229,8 @@ void tst_QtJson::streamSerializationQJsonValue_data() QTest::newRow("array") << QJsonValue{QJsonArray{12,1,5,6,7}}; QTest::newRow("object") << QJsonValue{QJsonObject{{"foo", 665}, {"bar", 666}}}; // test json escape sequence - QTest::newRow("array with 0xD800") << QJsonValue(QJsonArray{QString(0xD800)}); - QTest::newRow("array with 0xDF06,0xD834") << QJsonValue(QJsonArray{QString(0xDF06).append(0xD834)}); + QTest::newRow("array with 0xD800") << QJsonValue(QJsonArray{QString(QChar(0xD800))}); + QTest::newRow("array with 0xDF06,0xD834") << QJsonValue(QJsonArray{QString(QChar(0xDF06)).append(QChar(0xD834))}); } void tst_QtJson::streamSerializationQJsonValue() @@ -3323,8 +3323,8 @@ void tst_QtJson::escapeSurrogateCodePoints_data() { QTest::addColumn<QString>("str"); QTest::addColumn<QByteArray>("escStr"); - QTest::newRow("0xD800") << QString(0xD800) << QByteArray("\\ud800"); - QTest::newRow("0xDF06,0xD834") << QString(0xDF06).append(0xD834) << QByteArray("\\udf06\\ud834"); + QTest::newRow("0xD800") << QString(QChar(0xD800)) << QByteArray("\\ud800"); + QTest::newRow("0xDF06,0xD834") << QString(QChar(0xDF06)).append(QChar(0xD834)) << QByteArray("\\udf06\\ud834"); } void tst_QtJson::escapeSurrogateCodePoints() diff --git a/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp b/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp index 7249e2a6d8..b0fddf171e 100644 --- a/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp +++ b/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp @@ -2874,7 +2874,7 @@ void tst_QDataStream::status_QString_data() QString oneMbMinus1; oneMbMinus1.resize(1024 * 1024 - 1); for (int i = 0; i < oneMbMinus1.size(); ++i) - oneMbMinus1[i] = 0x1 | (8 * ((uchar)i / 9)); + oneMbMinus1[i] = QChar(0x1 | (8 * ((uchar)i / 9))); QString threeMbMinus1 = oneMbMinus1 + QChar('j') + oneMbMinus1 + QChar('k') + oneMbMinus1; QByteArray threeMbMinus1Data = qstring2qbytearray(threeMbMinus1); diff --git a/tests/auto/corelib/text/qchar/tst_qchar.cpp b/tests/auto/corelib/text/qchar/tst_qchar.cpp index b150600e36..134862f716 100644 --- a/tests/auto/corelib/text/qchar/tst_qchar.cpp +++ b/tests/auto/corelib/text/qchar/tst_qchar.cpp @@ -115,9 +115,9 @@ void tst_QChar::fromUcs4() void tst_QChar::fromWchar_t() { #if defined(Q_OS_WIN) - QChar aUmlaut = L'\u00E4'; // German small letter a-umlaut + QChar aUmlaut(L'\u00E4'); // German small letter a-umlaut QCOMPARE(aUmlaut, QChar(0xE4)); - QChar replacementCharacter = L'\uFFFD'; + QChar replacementCharacter(L'\uFFFD'); QCOMPARE(replacementCharacter, QChar(QChar::ReplacementCharacter)); #else QSKIP("This is a Windows-only test."); diff --git a/tests/auto/corelib/text/qstring/tst_qstring.cpp b/tests/auto/corelib/text/qstring/tst_qstring.cpp index 29d794490b..99f42e2815 100644 --- a/tests/auto/corelib/text/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/text/qstring/tst_qstring.cpp @@ -3991,7 +3991,7 @@ void tst_QString::check_QTextIOStream() void tst_QString::fromRawData() { - const QChar ptr[] = { 0x1234, 0x0000 }; + const QChar ptr[] = { QChar(0x1234), QChar(0x0000) }; QString cstr = QString::fromRawData(ptr, 1); QVERIFY(!cstr.isDetached()); QVERIFY(cstr.constData() == ptr); @@ -4008,8 +4008,8 @@ void tst_QString::fromRawData() void tst_QString::setRawData() { - const QChar ptr[] = { 0x1234, 0x0000 }; - const QChar ptr2[] = { 0x4321, 0x0000 }; + const QChar ptr[] = { QChar(0x1234), QChar(0x0000) }; + const QChar ptr2[] = { QChar(0x4321), QChar(0x0000) }; QString cstr; // This just tests the fromRawData() fallback @@ -4278,7 +4278,7 @@ void tst_QString::invalidToLocal8Bit_data() QTest::addColumn<QByteArray>("expect"); // Initial validly-converted prefix { - const QChar malformed[] = { 'A', 0xd800, 'B', 0 }; + const QChar malformed[] = { 'A', QChar(0xd800), 'B', '\0' }; const char expected[] = "A"; QTest::newRow("LoneHighSurrogate") << QString(malformed, sizeof(malformed) / sizeof(QChar)) @@ -4286,28 +4286,28 @@ void tst_QString::invalidToLocal8Bit_data() << QByteArray(expected, sizeof(expected) / sizeof(char) - 1); } { - const QChar malformed[] = { 'A', 0xdc00, 'B', 0 }; + const QChar malformed[] = { 'A', QChar(0xdc00), 'B', '\0' }; const char expected[] = "A"; QTest::newRow("LoneLowSurrogate") << QString(malformed, sizeof(malformed) / sizeof(QChar)) << QByteArray(expected, sizeof(expected) / sizeof(char) - 1); } { - const QChar malformed[] = { 'A', 0xd800, 0xd801, 'B', 0 }; + const QChar malformed[] = { 'A', QChar(0xd800), QChar(0xd801), 'B', '\0' }; const char expected[] = "A"; QTest::newRow("DoubleHighSurrogate") << QString(malformed, sizeof(malformed) / sizeof(QChar)) << QByteArray(expected, sizeof(expected) / sizeof(char) - 1); } { - const QChar malformed[] = { 'A', 0xdc00, 0xdc01, 'B', 0 }; + const QChar malformed[] = { 'A', QChar(0xdc00), QChar(0xdc01), 'B', '\0' }; const char expected[] = "A"; QTest::newRow("DoubleLowSurrogate") << QString(malformed, sizeof(malformed) / sizeof(QChar)) << QByteArray(expected, sizeof(expected) / sizeof(char) - 1); } { - const QChar malformed[] = { 'A', 0xdc00, 0xd800, 'B', 0 }; + const QChar malformed[] = { 'A', QChar(0xdc00), QChar(0xd800), 'B', '\0' }; const char expected[] = "A"; QTest::newRow("ReversedSurrogates") // low before high << QString(malformed, sizeof(malformed) / sizeof(QChar)) diff --git a/tests/auto/corelib/text/qstringconverter/tst_qstringconverter.cpp b/tests/auto/corelib/text/qstringconverter/tst_qstringconverter.cpp index c3ad151a51..a457744867 100644 --- a/tests/auto/corelib/text/qstringconverter/tst_qstringconverter.cpp +++ b/tests/auto/corelib/text/qstringconverter/tst_qstringconverter.cpp @@ -610,7 +610,7 @@ void tst_QStringConverter::utf8Codec_data() str = fromInvalidUtf8Sequence(utf8); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.1") << utf8 << str << -1; utf8 += char(0x30); - str += 0x30; + str += QChar(0x30); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.1-1") << utf8 << str << -1; // 3.3.2 @@ -620,7 +620,7 @@ void tst_QStringConverter::utf8Codec_data() str = fromInvalidUtf8Sequence(utf8); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.2") << utf8 << str << -1; utf8 += char(0x30); - str += 0x30; + str += QChar(0x30); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.2-1") << utf8 << str << -1; utf8.clear(); @@ -628,7 +628,7 @@ void tst_QStringConverter::utf8Codec_data() str = fromInvalidUtf8Sequence(utf8); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.2-2") << utf8 << str << -1; utf8 += 0x30; - str += 0x30; + str += QChar(0x30); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.2-3") << utf8 << str << -1; // 3.3.3 @@ -639,7 +639,7 @@ void tst_QStringConverter::utf8Codec_data() str = fromInvalidUtf8Sequence(utf8); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.3") << utf8 << str << -1; utf8 += char(0x30); - str += 0x30; + str += QChar(0x30); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.3-1") << utf8 << str << -1; utf8.clear(); @@ -647,7 +647,7 @@ void tst_QStringConverter::utf8Codec_data() str = fromInvalidUtf8Sequence(utf8); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.3-2") << utf8 << str << -1; utf8 += char(0x30); - str += 0x30; + str += QChar(0x30); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.3-3") << utf8 << str << -1; utf8.clear(); @@ -656,7 +656,7 @@ void tst_QStringConverter::utf8Codec_data() str = fromInvalidUtf8Sequence(utf8); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.3-4") << utf8 << str << -1; utf8 += char(0x30); - str += 0x30; + str += QChar(0x30); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.3-5") << utf8 << str << -1; // 3.3.4 @@ -668,7 +668,7 @@ void tst_QStringConverter::utf8Codec_data() str = fromInvalidUtf8Sequence(utf8); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.4") << utf8 << str << -1; utf8 += char(0x30); - str += 0x30; + str += QChar(0x30); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.4-1") << utf8 << str << -1; utf8.clear(); @@ -678,7 +678,7 @@ void tst_QStringConverter::utf8Codec_data() str = fromInvalidUtf8Sequence(utf8); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.4-2") << utf8 << str << -1; utf8 += char(0x30); - str += 0x30; + str += QChar(0x30); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.4-3") << utf8 << str << -1; utf8.clear(); @@ -687,7 +687,7 @@ void tst_QStringConverter::utf8Codec_data() str = fromInvalidUtf8Sequence(utf8); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.4-4") << utf8 << str << -1; utf8 += char(0x30); - str += 0x30; + str += QChar(0x30); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.4-5") << utf8 << str << -1; utf8.clear(); @@ -695,7 +695,7 @@ void tst_QStringConverter::utf8Codec_data() str = fromInvalidUtf8Sequence(utf8); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.4-6") << utf8 << str << -1; utf8 += char(0x30); - str += 0x30; + str += QChar(0x30); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.4-7") << utf8 << str << -1; // 3.3.5 @@ -708,7 +708,7 @@ void tst_QStringConverter::utf8Codec_data() str = fromInvalidUtf8Sequence(utf8); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.5") << utf8 << str << -1; utf8 += char(0x30); - str += 0x30; + str += QChar(0x30); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.5-1") << utf8 << str << -1; utf8.clear(); @@ -719,7 +719,7 @@ void tst_QStringConverter::utf8Codec_data() str = fromInvalidUtf8Sequence(utf8); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.5-2") << utf8 << str << -1; utf8 += char(0x30); - str += 0x30; + str += QChar(0x30); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.5-3") << utf8 << str << -1; utf8.clear(); @@ -729,7 +729,7 @@ void tst_QStringConverter::utf8Codec_data() str = fromInvalidUtf8Sequence(utf8); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.5-4") << utf8 << str << -1; utf8 += char(0x30); - str += 0x30; + str += QChar(0x30); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.5-5") << utf8 << str << -1; utf8.clear(); @@ -738,7 +738,7 @@ void tst_QStringConverter::utf8Codec_data() str = fromInvalidUtf8Sequence(utf8); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.5-6") << utf8 << str << -1; utf8 += char(0x30); - str += 0x30; + str += QChar(0x30); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.5-7") << utf8 << str << -1; utf8.clear(); @@ -746,7 +746,7 @@ void tst_QStringConverter::utf8Codec_data() str = fromInvalidUtf8Sequence(utf8); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.5-8") << utf8 << str << -1; utf8 += char(0x30); - str += 0x30; + str += QChar(0x30); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.5-9") << utf8 << str << -1; // 3.3.6 @@ -755,7 +755,7 @@ void tst_QStringConverter::utf8Codec_data() str = fromInvalidUtf8Sequence(utf8); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.6") << utf8 << str << -1; utf8 += char(0x30); - str += 0x30; + str += QChar(0x30); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.6-1") << utf8 << str << -1; // 3.3.7 @@ -765,7 +765,7 @@ void tst_QStringConverter::utf8Codec_data() str = fromInvalidUtf8Sequence(utf8); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.7") << utf8 << str << -1; utf8 += char(0x30); - str += 0x30; + str += QChar(0x30); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.7-1") << utf8 << str << -1; utf8.clear(); @@ -773,7 +773,7 @@ void tst_QStringConverter::utf8Codec_data() str = fromInvalidUtf8Sequence(utf8); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.7-2") << utf8 << str << -1; utf8 += char(0x30); - str += 0x30; + str += QChar(0x30); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.7-3") << utf8 << str << -1; // 3.3.8 @@ -784,7 +784,7 @@ void tst_QStringConverter::utf8Codec_data() str = fromInvalidUtf8Sequence(utf8); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.8") << utf8 << str << -1; utf8 += char(0x30); - str += 0x30; + str += QChar(0x30); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.8-1") << utf8 << str << -1; utf8.clear(); @@ -793,7 +793,7 @@ void tst_QStringConverter::utf8Codec_data() str = fromInvalidUtf8Sequence(utf8); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.8-2") << utf8 << str << -1; utf8 += char(0x30); - str += 0x30; + str += QChar(0x30); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.8-3") << utf8 << str << -1; utf8.clear(); @@ -801,7 +801,7 @@ void tst_QStringConverter::utf8Codec_data() str = fromInvalidUtf8Sequence(utf8); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.8-4") << utf8 << str << -1; utf8 += char(0x30); - str += 0x30; + str += QChar(0x30); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.8-5") << utf8 << str << -1; // 3.3.9 @@ -813,7 +813,7 @@ void tst_QStringConverter::utf8Codec_data() str = fromInvalidUtf8Sequence(utf8); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.9") << utf8 << str << -1; utf8 += char(0x30); - str += 0x30; + str += QChar(0x30); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.9-1") << utf8 << str << -1; utf8.clear(); @@ -823,7 +823,7 @@ void tst_QStringConverter::utf8Codec_data() str = fromInvalidUtf8Sequence(utf8); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.9-2") << utf8 << str << -1; utf8 += char(0x30); - str += 0x30; + str += QChar(0x30); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.9-3") << utf8 << str << -1; utf8.clear(); @@ -832,7 +832,7 @@ void tst_QStringConverter::utf8Codec_data() str = fromInvalidUtf8Sequence(utf8); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.9-4") << utf8 << str << -1; utf8 += char(0x30); - str += 0x30; + str += QChar(0x30); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.9-5") << utf8 << str << -1; utf8.clear(); @@ -840,7 +840,7 @@ void tst_QStringConverter::utf8Codec_data() str = fromInvalidUtf8Sequence(utf8); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.9-6") << utf8 << str << -1; utf8 += char(0x30); - str += 0x30; + str += QChar(0x30); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.9-7") << utf8 << str << -1; // 3.3.10 @@ -853,7 +853,7 @@ void tst_QStringConverter::utf8Codec_data() str = fromInvalidUtf8Sequence(utf8); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.10") << utf8 << str << -1; utf8 += char(0x30); - str += 0x30; + str += QChar(0x30); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.10-1") << utf8 << str << -1; utf8.clear(); @@ -864,7 +864,7 @@ void tst_QStringConverter::utf8Codec_data() str = fromInvalidUtf8Sequence(utf8); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.10-2") << utf8 << str << -1; utf8 += char(0x30); - str += 0x30; + str += QChar(0x30); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.10-3") << utf8 << str << -1; utf8.clear(); @@ -874,7 +874,7 @@ void tst_QStringConverter::utf8Codec_data() str = fromInvalidUtf8Sequence(utf8); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.10-4") << utf8 << str << -1; utf8 += char(0x30); - str += 0x30; + str += QChar(0x30); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.10-5") << utf8 << str << -1; utf8.clear(); @@ -883,7 +883,7 @@ void tst_QStringConverter::utf8Codec_data() str = fromInvalidUtf8Sequence(utf8); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.10-6") << utf8 << str << -1; utf8 += char(0x30); - str += 0x30; + str += QChar(0x30); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.10-7") << utf8 << str << -1; utf8.clear(); @@ -891,7 +891,7 @@ void tst_QStringConverter::utf8Codec_data() str = fromInvalidUtf8Sequence(utf8); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.10-8") << utf8 << str << -1; utf8 += char(0x30); - str += 0x30; + str += QChar(0x30); QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 3.3.10-9") << utf8 << str << -1; // 3.4 diff --git a/tests/auto/corelib/text/qstringview/tst_qstringview.cpp b/tests/auto/corelib/text/qstringview/tst_qstringview.cpp index 4cff432a2d..42b4767c50 100644 --- a/tests/auto/corelib/text/qstringview/tst_qstringview.cpp +++ b/tests/auto/corelib/text/qstringview/tst_qstringview.cpp @@ -666,7 +666,7 @@ template <typename Char> void tst_QStringView::fromLiteral(const Char *arg) const { const Char *null = nullptr; - const Char empty[] = { 0 }; + const Char empty[] = { Char{} }; QCOMPARE(QStringView(null).size(), qsizetype(0)); QCOMPARE(QStringView(null).data(), nullptr); diff --git a/tests/auto/corelib/text/qtextboundaryfinder/tst_qtextboundaryfinder.cpp b/tests/auto/corelib/text/qtextboundaryfinder/tst_qtextboundaryfinder.cpp index 9c212a6a0b..bd9d91580d 100644 --- a/tests/auto/corelib/text/qtextboundaryfinder/tst_qtextboundaryfinder.cpp +++ b/tests/auto/corelib/text/qtextboundaryfinder/tst_qtextboundaryfinder.cpp @@ -293,7 +293,7 @@ void tst_QTextBoundaryFinder::wordBoundaries_manual_data() QTest::addColumn<QList<int> >("expectedEndPositions"); { - QChar s[] = { 0x000D, 0x000A, 0x000A }; + QChar s[] = { QChar(0x000D), QChar(0x000A), QChar(0x000A) }; QString testString(s, sizeof(s)/sizeof(s[0])); QList<int> expectedBreakPositions, expectedStartPositions, expectedEndPositions; expectedBreakPositions << 0 << 2 << 3; @@ -302,7 +302,7 @@ void tst_QTextBoundaryFinder::wordBoundaries_manual_data() << expectedStartPositions << expectedEndPositions; } { - QChar s[] = { 0x000D, 0x0308, 0x000A, 0x000A }; + QChar s[] = { QChar(0x000D), QChar(0x0308), QChar(0x000A), QChar(0x000A) }; QString testString(s, sizeof(s)/sizeof(s[0])); QList<int> expectedBreakPositions, expectedStartPositions, expectedEndPositions; expectedBreakPositions << 0 << 1 << 2 << 3 << 4; @@ -366,7 +366,7 @@ void tst_QTextBoundaryFinder::wordBoundaries_manual_data() // Sample Strings from WordBreakTest.html { - QChar s[] = { 0x0063, 0x0061, 0x006E, 0x0027, 0x0074 }; + QChar s[] = { QChar(0x0063), QChar(0x0061), QChar(0x006E), QChar(0x0027), QChar(0x0074) }; QString testString(s, sizeof(s)/sizeof(s[0])); QList<int> expectedBreakPositions, expectedStartPositions, expectedEndPositions; expectedBreakPositions << 0 << 5; @@ -377,7 +377,7 @@ void tst_QTextBoundaryFinder::wordBoundaries_manual_data() << expectedStartPositions << expectedEndPositions; } { - QChar s[] = { 0x0063, 0x0061, 0x006E, 0x2019, 0x0074 }; + QChar s[] = { QChar(0x0063), QChar(0x0061), QChar(0x006E), QChar(0x2019), QChar(0x0074) }; QString testString(s, sizeof(s)/sizeof(s[0])); QList<int> expectedBreakPositions, expectedStartPositions, expectedEndPositions; expectedBreakPositions << 0 << 5; @@ -388,7 +388,7 @@ void tst_QTextBoundaryFinder::wordBoundaries_manual_data() << expectedStartPositions << expectedEndPositions; } { - QChar s[] = { 0x0061, 0x0062, 0x00AD, 0x0062, 0x0061 }; + QChar s[] = { QChar(0x0061), QChar(0x0062), QChar(0x00AD), QChar(0x0062), QChar(0x0061) }; QString testString(s, sizeof(s)/sizeof(s[0])); QList<int> expectedBreakPositions, expectedStartPositions, expectedEndPositions; expectedBreakPositions << 0 << 5; @@ -399,8 +399,10 @@ void tst_QTextBoundaryFinder::wordBoundaries_manual_data() << expectedStartPositions << expectedEndPositions; } { - QChar s[] = { 0x0061, 0x0024, 0x002D, 0x0033, 0x0034, 0x002C, 0x0035, 0x0036, - 0x0037, 0x002E, 0x0031, 0x0034, 0x0025, 0x0062 }; + QChar s[] = { QChar(0x0061), QChar(0x0024), QChar(0x002D), QChar(0x0033), + QChar(0x0034), QChar(0x002C), QChar(0x0035), QChar(0x0036), + QChar(0x0037), QChar(0x002E), QChar(0x0031), QChar(0x0034), + QChar(0x0025), QChar(0x0062) }; QString testString(s, sizeof(s)/sizeof(s[0])); QList<int> expectedBreakPositions, expectedStartPositions, expectedEndPositions; expectedBreakPositions << 0 << 1 << 2 << 3 << 12 << 13 << 14; @@ -411,7 +413,7 @@ void tst_QTextBoundaryFinder::wordBoundaries_manual_data() << expectedStartPositions << expectedEndPositions; } { - QChar s[] = { 0x0033, 0x0061 }; + QChar s[] = { QChar(0x0033), QChar(0x0061) }; QString testString(s, sizeof(s)/sizeof(s[0])); QList<int> expectedBreakPositions, expectedStartPositions, expectedEndPositions; expectedBreakPositions << 0 << 2; @@ -422,8 +424,9 @@ void tst_QTextBoundaryFinder::wordBoundaries_manual_data() << expectedStartPositions << expectedEndPositions; } { - QChar s[] = { 0x2060, 0x0063, 0x2060, 0x0061, 0x2060, 0x006E, 0x2060, 0x0027, - 0x2060, 0x0074, 0x2060, 0x2060 }; + QChar s[] = { QChar(0x2060), QChar(0x0063), QChar(0x2060), QChar(0x0061), + QChar(0x2060), QChar(0x006E), QChar(0x2060), QChar(0x0027), + QChar(0x2060), QChar(0x0074), QChar(0x2060), QChar(0x2060) }; QString testString(s, sizeof(s)/sizeof(s[0])); QList<int> expectedBreakPositions, expectedStartPositions, expectedEndPositions; expectedBreakPositions << 0 << 1 << 12; @@ -434,8 +437,9 @@ void tst_QTextBoundaryFinder::wordBoundaries_manual_data() << expectedStartPositions << expectedEndPositions; } { - QChar s[] = { 0x2060, 0x0063, 0x2060, 0x0061, 0x2060, 0x006E, 0x2060, 0x2019, - 0x2060, 0x0074, 0x2060, 0x2060 }; + QChar s[] = { QChar(0x2060), QChar(0x0063), QChar(0x2060), QChar(0x0061), + QChar(0x2060), QChar(0x006E), QChar(0x2060), QChar(0x2019), + QChar(0x2060), QChar(0x0074), QChar(0x2060), QChar(0x2060) }; QString testString(s, sizeof(s)/sizeof(s[0])); QList<int> expectedBreakPositions, expectedStartPositions, expectedEndPositions; expectedBreakPositions << 0 << 1 << 12; @@ -446,8 +450,9 @@ void tst_QTextBoundaryFinder::wordBoundaries_manual_data() << expectedStartPositions << expectedEndPositions; } { - QChar s[] = { 0x2060, 0x0061, 0x2060, 0x0062, 0x2060, 0x00AD, 0x2060, 0x0062, - 0x2060, 0x0061, 0x2060, 0x2060 }; + QChar s[] = { QChar(0x2060), QChar(0x0061), QChar(0x2060), QChar(0x0062), + QChar(0x2060), QChar(0x00AD), QChar(0x2060), QChar(0x0062), + QChar(0x2060), QChar(0x0061), QChar(0x2060), QChar(0x2060) }; QString testString(s, sizeof(s)/sizeof(s[0])); QList<int> expectedBreakPositions, expectedStartPositions, expectedEndPositions; expectedBreakPositions << 0 << 1 << 12; @@ -458,10 +463,14 @@ void tst_QTextBoundaryFinder::wordBoundaries_manual_data() << expectedStartPositions << expectedEndPositions; } { - QChar s[] = { 0x2060, 0x0061, 0x2060, 0x0024, 0x2060, 0x002D, 0x2060, 0x0033, - 0x2060, 0x0034, 0x2060, 0x002C, 0x2060, 0x0035, 0x2060, 0x0036, - 0x2060, 0x0037, 0x2060, 0x002E, 0x2060, 0x0031, 0x2060, 0x0034, - 0x2060, 0x0025, 0x2060, 0x0062, 0x2060, 0x2060 }; + QChar s[] = { QChar(0x2060), QChar(0x0061), QChar(0x2060), QChar(0x0024), + QChar(0x2060), QChar(0x002D), QChar(0x2060), QChar(0x0033), + QChar(0x2060), QChar(0x0034), QChar(0x2060), QChar(0x002C), + QChar(0x2060), QChar(0x0035), QChar(0x2060), QChar(0x0036), + QChar(0x2060), QChar(0x0037), QChar(0x2060), QChar(0x002E), + QChar(0x2060), QChar(0x0031), QChar(0x2060), QChar(0x0034), + QChar(0x2060), QChar(0x0025), QChar(0x2060), QChar(0x0062), + QChar(0x2060), QChar(0x2060) }; QString testString(s, sizeof(s)/sizeof(s[0])); QList<int> expectedBreakPositions, expectedStartPositions, expectedEndPositions; expectedBreakPositions << 0 << 1 << 3 << 5 << 7 << 25 << 27 << 30; @@ -472,7 +481,8 @@ void tst_QTextBoundaryFinder::wordBoundaries_manual_data() << expectedStartPositions << expectedEndPositions; } { - QChar s[] = { 0x2060, 0x0033, 0x2060, 0x0061, 0x2060, 0x2060 }; + QChar s[] = { QChar(0x2060), QChar(0x0033), QChar(0x2060), QChar(0x0061), + QChar(0x2060), QChar(0x2060) }; QString testString(s, sizeof(s)/sizeof(s[0])); QList<int> expectedBreakPositions, expectedStartPositions, expectedEndPositions; expectedBreakPositions << 0 << 1 << 6; @@ -502,7 +512,7 @@ void tst_QTextBoundaryFinder::sentenceBoundaries_manual_data() QTest::addColumn<QList<int> >("expectedBreakPositions"); { - QChar s[] = { 0x000D, 0x000A, 0x000A }; + QChar s[] = { QChar(0x000D), QChar(0x000A), QChar(0x000A) }; QString testString(s, sizeof(s)/sizeof(s[0])); QList<int> expectedBreakPositions; expectedBreakPositions << 0 << 2 << 3; @@ -510,7 +520,7 @@ void tst_QTextBoundaryFinder::sentenceBoundaries_manual_data() QTest::newRow("+CRxLF+LF+") << testString << expectedBreakPositions; } { - QChar s[] = { 0x000D, 0x0308, 0x000A, 0x000A }; + QChar s[] = { QChar(0x000D), QChar(0x0308), QChar(0x000A), QChar(0x000A) }; QString testString(s, sizeof(s)/sizeof(s[0])); QList<int> expectedBreakPositions; expectedBreakPositions << 0 << 1 << 3 << 4; @@ -587,7 +597,7 @@ void tst_QTextBoundaryFinder::lineBoundaries_manual_data() } { - QChar s[] = { 0x000D, 0x0308, 0x000A, 0x000A, 0x0020 }; + QChar s[] = { QChar(0x000D), QChar(0x0308), QChar(0x000A), QChar(0x000A), QChar(0x0020) }; QString testString(s, sizeof(s)/sizeof(s[0])); QList<int> expectedBreakPositions, expectedMandatoryBreakPositions; expectedBreakPositions << 0 << 1 << 3 << 4 << 5; @@ -597,7 +607,7 @@ void tst_QTextBoundaryFinder::lineBoundaries_manual_data() << expectedMandatoryBreakPositions; } { - QChar s[] = { 0x000A, 0x2E80, 0x0308, 0x0023, 0x0023 }; + QChar s[] = { QChar(0x000A), QChar(0x2E80), QChar(0x0308), QChar(0x0023), QChar(0x0023) }; QString testString(s, sizeof(s)/sizeof(QChar)); QList<int> expectedBreakPositions, expectedMandatoryBreakPositions; expectedBreakPositions << 0 << 1 << 3 << 5; @@ -607,7 +617,7 @@ void tst_QTextBoundaryFinder::lineBoundaries_manual_data() << expectedMandatoryBreakPositions; } { - QChar s[] = { 0x000A, 0x0308, 0x0023, 0x0023 }; + QChar s[] = { QChar(0x000A), QChar(0x0308), QChar(0x0023), QChar(0x0023) }; QString testString(s, sizeof(s)/sizeof(QChar)); QList<int> expectedBreakPositions, expectedMandatoryBreakPositions; expectedBreakPositions << 0 << 1 << 4; @@ -618,7 +628,7 @@ void tst_QTextBoundaryFinder::lineBoundaries_manual_data() } { - QChar s[] = { 0x0061, 0x00AD, 0x0062, 0x0009, 0x0063, 0x0064 }; + QChar s[] = { QChar(0x0061), QChar(0x00AD), QChar(0x0062), QChar(0x0009), QChar(0x0063), QChar(0x0064) }; QString testString(s, sizeof(s)/sizeof(s[0])); QList<int> expectedBreakPositions, expectedMandatoryBreakPositions; expectedBreakPositions << 0 << 2 << 4 << 6; diff --git a/tests/auto/corelib/tools/collections/tst_collections.cpp b/tests/auto/corelib/tools/collections/tst_collections.cpp index 85c6f7e6e1..50f9f155d0 100644 --- a/tests/auto/corelib/tools/collections/tst_collections.cpp +++ b/tests/auto/corelib/tools/collections/tst_collections.cpp @@ -1121,17 +1121,17 @@ void tst_Collections::hash() Hash hash; QString key = QLatin1String(" "); for (int i = 0; i < 10; ++i) { - key[0] = i + '0'; + key[0] = QChar(i + '0'); for (int j = 0; j < 10; ++j) { - key[1] = j + '0'; + key[1] = QChar(j + '0'); hash.insert(key, "V" + key); } } for (int i = 0; i < 10; ++i) { - key[0] = i + '0'; + key[0] = QChar(i + '0'); for (int j = 0; j < 10; ++j) { - key[1] = j + '0'; + key[1] = QChar(j + '0'); hash.remove(key); } } diff --git a/tests/auto/corelib/tools/qhash/tst_qhash.cpp b/tests/auto/corelib/tools/qhash/tst_qhash.cpp index 359095c3d0..f61dfda720 100644 --- a/tests/auto/corelib/tools/qhash/tst_qhash.cpp +++ b/tests/auto/corelib/tools/qhash/tst_qhash.cpp @@ -309,17 +309,17 @@ void tst_QHash::insert1() Hash hash; QString key = QLatin1String(" "); for (int i = 0; i < 10; ++i) { - key[0] = i + '0'; + key[0] = QChar(i + '0'); for (int j = 0; j < 10; ++j) { - key[1] = j + '0'; + key[1] = QChar(j + '0'); hash.insert(key, "V" + key); } } for (int i = 0; i < 10; ++i) { - key[0] = i + '0'; + key[0] = QChar(i + '0'); for (int j = 0; j < 10; ++j) { - key[1] = j + '0'; + key[1] = QChar(j + '0'); hash.remove(key); } } |