diff options
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r-- | tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp | 4 | ||||
-rw-r--r-- | tests/auto/corelib/text/qstring/tst_qstring.cpp | 10 |
2 files changed, 11 insertions, 3 deletions
diff --git a/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp b/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp index e1fd7a7147..f9de9eeebf 100644 --- a/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp +++ b/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp @@ -2125,9 +2125,9 @@ void tst_QTextStream::generateStringData(bool for_QString) if (!for_QString) { QTest::newRow("utf16-BE (empty)") << QByteArray("\xff\xfe", 2) << QByteArray() << QString(); - QTest::newRow("utf16-BE (corrupt)") << QByteArray("\xff", 1) << QByteArray("\xff") << QString::fromLatin1("\xff"); + QTest::newRow("utf16-BE (corrupt)") << QByteArray("\xff", 1) << QByteArray("\xc3\xbf") << QString::fromUtf8("\xc3\xbf"); QTest::newRow("utf16-LE (empty)") << QByteArray("\xfe\xff", 2) << QByteArray() << QString(); - QTest::newRow("utf16-LE (corrupt)") << QByteArray("\xfe", 1) << QByteArray("\xfe") << QString::fromLatin1("\xfe"); + QTest::newRow("utf16-LE (corrupt)") << QByteArray("\xfe", 1) << QByteArray("\xc3\xbe") << QString::fromUtf8("\xc3\xbe"); } } diff --git a/tests/auto/corelib/text/qstring/tst_qstring.cpp b/tests/auto/corelib/text/qstring/tst_qstring.cpp index 8f77d03226..6e1b47a839 100644 --- a/tests/auto/corelib/text/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/text/qstring/tst_qstring.cpp @@ -3963,8 +3963,16 @@ void tst_QString::check_QTextIOStream() { a=""; QTextStream ts(&a); + // invalid Utf8 ts << "pi \261= " << 3.125; - QCOMPARE(a, QString::fromLatin1("pi \261= 3.125")); + QCOMPARE(a, QString::fromUtf16(u"pi \xfffd= 3.125")); + } + { + a=""; + QTextStream ts(&a); + // valid Utf8 + ts << "pi ø= " << 3.125; + QCOMPARE(a, QString::fromUtf16(u"pi ø= 3.125")); } { a="123 456"; |