diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2020-07-16 13:57:37 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2020-08-07 17:44:01 +0200 |
commit | 7ce27430a7a9e13cd9ea1f851a75d094cd3d769e (patch) | |
tree | 3bb410e62089a0c5459d1204bdcf94043e7de961 /tests | |
parent | 74a35a509c77f82f9de9b4a9d365cf9640c1cbf3 (diff) |
tst_QStringConverter: fix some deprecation warnings
QString's fromUtf16() prefers char16_t data over ushort.
Change-Id: Ib20c5afa09ceabb4e91fe434b6a057edb4739a53
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/corelib/text/qstringconverter/tst_qstringconverter.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/tests/auto/corelib/text/qstringconverter/tst_qstringconverter.cpp b/tests/auto/corelib/text/qstringconverter/tst_qstringconverter.cpp index 9c2f5badc6..dcb6bbd419 100644 --- a/tests/auto/corelib/text/qstringconverter/tst_qstringconverter.cpp +++ b/tests/auto/corelib/text/qstringconverter/tst_qstringconverter.cpp @@ -1274,24 +1274,24 @@ void tst_QStringConverter::utf8bom_data() << QString::fromLatin1("\240"); { - static const ushort data[] = { 0x201d }; + static const char16_t data[] = { 0x201d }; QTest::newRow("nobom 2") << QByteArray("\342\200\235", 3) - << QString::fromUtf16(data, sizeof(data)/sizeof(short)); + << QString::fromUtf16(data, std::size(data)); } { - static const ushort data[] = { 0xf000 }; + static const char16_t data[] = { 0xf000 }; QTest::newRow("bom1") << QByteArray("\357\200\200", 3) - << QString::fromUtf16(data, sizeof(data)/sizeof(short)); + << QString::fromUtf16(data, std::size(data)); } { - static const ushort data[] = { 0xfec0 }; + static const char16_t data[] = { 0xfec0 }; QTest::newRow("bom2") << QByteArray("\357\273\200", 3) - << QString::fromUtf16(data, sizeof(data)/sizeof(short)); + << QString::fromUtf16(data, std::size(data)); } { @@ -1301,17 +1301,18 @@ void tst_QStringConverter::utf8bom_data() } { // test the non-SIMD code-path - static const ushort data[] = { 0x61, 0xfeff, 0x62 }; + static const char16_t data[] = { 0x61, 0xfeff, 0x62 }; QTest::newRow("middle-bom (non SIMD)") << QByteArray("a\357\273\277b") - << QString::fromUtf16(data, sizeof(data)/sizeof(short)); + << QString::fromUtf16(data, std::size(data)); } { // test the SIMD code-path - static const ushort data[] = { 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0xfeff, 0x6d }; + static const char16_t data[] = { 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0xfeff, 0x6d }; QTest::newRow("middle-bom (SIMD)") << QByteArray("abcdefghijkl\357\273\277m") - << QString::fromUtf16(data, sizeof(data)/sizeof(short)); + << QString::fromUtf16(data, std::size(data)); } } QT_WARNING_POP |