summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-08-18 17:15:33 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2009-08-18 18:18:38 (GMT)
commit8bea43ccb0f53234f87e4aa4d27371b741005222 (patch)
treed649be015e14b0513e7282540abec178cb2ee1ca /tests
parentd313b5c43f83d69d9a9009dfa0bb29afa9276768 (diff)
downloadQt-8bea43ccb0f53234f87e4aa4d27371b741005222.zip
Qt-8bea43ccb0f53234f87e4aa4d27371b741005222.tar.gz
Qt-8bea43ccb0f53234f87e4aa4d27371b741005222.tar.bz2
Autotest: accept that the platform's UTF-8 codec can be buggy.
We shouldn't fail in our autotests because the platform is buggy. But note the problem. We should report the bugs upstream...
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/utf8/tst_utf8.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/auto/utf8/tst_utf8.cpp b/tests/auto/utf8/tst_utf8.cpp
index 0d754b0..f255e6e 100644
--- a/tests/auto/utf8/tst_utf8.cpp
+++ b/tests/auto/utf8/tst_utf8.cpp
@@ -299,10 +299,19 @@ void tst_Utf8::invalidUtf8_data()
void tst_Utf8::invalidUtf8()
{
QFETCH(QByteArray, utf8);
+ QFETCH_GLOBAL(bool, useLocale);
QSharedPointer<QTextDecoder> decoder = QSharedPointer<QTextDecoder>(codec->makeDecoder());
QString decoded = decoder->toUnicode(utf8);
- QVERIFY(decoder->hasFailure());
+
+ // Only enforce correctness on our UTF-8 decoder
+ // The system's UTF-8 codec is sometimes buggy
+ // GNU libc's iconv is known to accept U+FFFF and U+FFFE encoded as UTF-8
+ // OS X's iconv is known to accept those, plus surrogates and codepoints above U+10FFFF
+ if (!useLocale)
+ QVERIFY(decoder->hasFailure());
+ else if (!decoder->hasFailure())
+ qWarning("System codec does not report failure when it should. Should report bug upstream.");
}
QTEST_MAIN(tst_Utf8)