summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtextcodec
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2010-03-08 13:59:56 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2010-03-08 14:22:47 (GMT)
commit2e8ee73bd681cfe5898b8c054b0cb4df51663c91 (patch)
tree88db08a2cf2c041454d52ddd26155c55b4e78b80 /tests/auto/qtextcodec
parentbe87fa060360139c64dea6854e7667914db47bf4 (diff)
downloadQt-2e8ee73bd681cfe5898b8c054b0cb4df51663c91.zip
Qt-2e8ee73bd681cfe5898b8c054b0cb4df51663c91.tar.gz
Qt-2e8ee73bd681cfe5898b8c054b0cb4df51663c91.tar.bz2
Autotest: Fix failing QTextCodec tests
Diffstat (limited to 'tests/auto/qtextcodec')
-rw-r--r--tests/auto/qtextcodec/tst_qtextcodec.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/tests/auto/qtextcodec/tst_qtextcodec.cpp b/tests/auto/qtextcodec/tst_qtextcodec.cpp
index aa97e87..86aa38a 100644
--- a/tests/auto/qtextcodec/tst_qtextcodec.cpp
+++ b/tests/auto/qtextcodec/tst_qtextcodec.cpp
@@ -384,9 +384,12 @@ void tst_QTextCodec::flagCodepointFFFF() const
Q_ASSERT(codec);
const QByteArray asDecoded(codec->fromUnicode(input));
+ QCOMPARE(asDecoded, QByteArray("?"));
+
+ QByteArray ffff("\357\277\277");
QTextCodec::ConverterState state(QTextCodec::ConvertInvalidToNull);
- QVERIFY(codec->toUnicode(asDecoded.constData(), asDecoded.length(), &state) == QChar(0));
- QVERIFY(codec->toUnicode(asDecoded) == QChar(0xfffd));
+ QVERIFY(codec->toUnicode(ffff.constData(), ffff.length(), &state) == QChar(0));
+ QVERIFY(codec->toUnicode(ffff) == QChar(0xfffd));
}
void tst_QTextCodec::flagF7808080() const
@@ -447,12 +450,11 @@ void tst_QTextCodec::flagEFBFBF() const
/* When 0xEFBFBF is preceeded by what seems to be an arbitrary character,
* QTextCodec fails to flag it. */
{
- QEXPECT_FAIL("", "This is a bug and needs to be fixed.", Continue);
QByteArray start("B");
start.append(invalidInput);
QTextCodec::ConverterState state(QTextCodec::ConvertInvalidToNull);
- QVERIFY(codec->toUnicode(start.constData(), start.length(), &state) == QChar(0));
+ QVERIFY(codec->toUnicode(start.constData(), start.length(), &state) == QString::fromLatin1("B\0", 2));
}
}
@@ -695,15 +697,15 @@ void tst_QTextCodec::utf8Codec_data()
str = QChar(QChar::ReplacementCharacter);
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 2.3.3") << utf8 << str << -1;
- // 2.3.4 U+0010FFFF
+ // 2.3.4 U+0010FFFD
utf8.clear();
utf8 += char(0xf4);
utf8 += char(0x8f);
utf8 += char(0xbf);
- utf8 += char(0xbf);
+ utf8 += char(0xbd);
str.clear();
str += QChar(0xdbff);
- str += QChar(0xdfff);
+ str += QChar(0xdffd);
QTest::newRow("http://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html 2.3.4") << utf8 << str << -1;
// 2.3.5 U+00110000