diff options
author | axis <qt-info@nokia.com> | 2009-06-08 06:51:51 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2009-06-08 06:51:51 (GMT) |
commit | d4257360234a967bfbacde92ec2bb1ac8979b793 (patch) | |
tree | a907ea5fe0d3142ecefce50b79c735554efdf39b /tests/auto/qtextcodec | |
parent | 5163d6e1a36f48bf9d8483d3ca23ec730b5188c0 (diff) | |
parent | 3b2b9d727f0fadf607968c73003e7550c8bd0296 (diff) | |
download | Qt-d4257360234a967bfbacde92ec2bb1ac8979b793.zip Qt-d4257360234a967bfbacde92ec2bb1ac8979b793.tar.gz Qt-d4257360234a967bfbacde92ec2bb1ac8979b793.tar.bz2 |
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt
Conflicts:
tests/auto/qlocalsocket/tst_qlocalsocket.cpp
Diffstat (limited to 'tests/auto/qtextcodec')
-rw-r--r-- | tests/auto/qtextcodec/tst_qtextcodec.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/auto/qtextcodec/tst_qtextcodec.cpp b/tests/auto/qtextcodec/tst_qtextcodec.cpp index ff4b4bb..fa41f43 100644 --- a/tests/auto/qtextcodec/tst_qtextcodec.cpp +++ b/tests/auto/qtextcodec/tst_qtextcodec.cpp @@ -1537,7 +1537,7 @@ void tst_QTextCodec::utfHeaders_data() << QByteArray("\xef\xbb\xbfhello") << (QString(QChar(0xfeff)) + QString::fromLatin1("hello")) << true; - QTest::newRow("utf8 nobom") + QTest::newRow("utf8 nobom ignore header") << QByteArray("UTF-8") << (int)QTextCodec::IgnoreHeader << QByteArray("hello") @@ -1719,14 +1719,23 @@ void tst_QTextCodec::utfHeaders() QFETCH(bool, toUnicode); + QLatin1String ignoreReverseTestOn = (QSysInfo::ByteOrder == QSysInfo::BigEndian) ? QLatin1String(" le") : QLatin1String(" be"); + QString rowName(QTest::currentDataTag()); + for (int i = 0; i < encoded.length(); ++i) qDebug() << hex << " " << (uint)(uchar)encoded.at(i); if (toUnicode) { QString result = codec->toUnicode(encoded.constData(), encoded.length(), &state); - for (int i = 0; i < result.length(); ++i) - qDebug() << hex << " " << (uint)result.at(i).unicode(); + for (int i = 0; i < result.length(); ++i) + qDebug() << hex << " " << (uint)result.at(i).unicode(); QCOMPARE(result.length(), unicode.length()); QCOMPARE(result, unicode); + + if (!rowName.endsWith("nobom") && !rowName.contains(ignoreReverseTestOn)) { + QTextCodec::ConverterState state2(cFlags); + QByteArray reencoded = codec->fromUnicode(unicode.unicode(), unicode.length(), &state2); + QCOMPARE(reencoded, encoded); + } } else { QByteArray result = codec->fromUnicode(unicode.unicode(), unicode.length(), &state); QCOMPARE(result, encoded); |