diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2014-04-23 11:05:00 -0700 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-25 01:27:33 +0200 |
commit | ec74461e9dd80d9f857038dc74cecfad1827f606 (patch) | |
tree | 8506bb0591dbe3cba3cc7a798775214633f4ae49 /tests | |
parent | 9a07ea69d678515d88068b7453afe378704abfc2 (diff) |
Ensure we try the UTF-8 conversions with longer strings
The SSE2-based conversion only kicks in with strings with 8 characters
or more in length.
Change-Id: Ic1daad0845571be03547553cc001d83550f0c89c
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/corelib/codecs/utf8/tst_utf8.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/auto/corelib/codecs/utf8/tst_utf8.cpp b/tests/auto/corelib/codecs/utf8/tst_utf8.cpp index 8755e65d0c..d1aadab7d8 100644 --- a/tests/auto/corelib/codecs/utf8/tst_utf8.cpp +++ b/tests/auto/corelib/codecs/utf8/tst_utf8.cpp @@ -117,10 +117,10 @@ void tst_Utf8::roundTrip_data() QTest::newRow("nul") << QByteArray("", 1) << QString(QChar(QChar::Null)); static const char ascii[] = "This is a standard US-ASCII message"; - QTest::newRow("ascii") << QByteArray(ascii) << ascii; + QTest::newRow("ascii") << QByteArray(ascii) << QString::fromLatin1(ascii); static const char ascii2[] = "\1This\2is\3an\4US-ASCII\020 message interspersed with control chars"; - QTest::newRow("ascii2") << QByteArray(ascii2) << ascii2; + QTest::newRow("ascii2") << QByteArray(ascii2) << QString::fromLatin1(ascii2); static const char utf8_1[] = "\302\240"; // NBSP QTest::newRow("utf8_1") << QByteArray(utf8_1) << QString(QChar(QChar::Nbsp)); @@ -169,6 +169,15 @@ void tst_Utf8::roundTrip() QCOMPARE(to8Bit(from8Bit(utf8)), utf8); QCOMPARE(from8Bit(to8Bit(utf16)), utf16); + + // repeat with a longer message + utf8.prepend("12345678901234"); + utf16.prepend(QLatin1String("12345678901234")); + QCOMPARE(to8Bit(utf16), utf8); + QCOMPARE(from8Bit(utf8), utf16); + + QCOMPARE(to8Bit(from8Bit(utf8)), utf8); + QCOMPARE(from8Bit(to8Bit(utf16)), utf16); } void tst_Utf8::charByChar_data() |