summaryrefslogtreecommitdiffstats
path: root/tests/auto/utf8
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-08-18 19:15:33 +0200
committerThiago Macieira <thiago.macieira@nokia.com>2009-08-18 20:18:38 +0200
commit8bea43ccb0f53234f87e4aa4d27371b741005222 (patch)
treed649be015e14b0513e7282540abec178cb2ee1ca /tests/auto/utf8
parentd313b5c43f83d69d9a9009dfa0bb29afa9276768 (diff)
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/auto/utf8')
-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 0d754b0c88..f255e6e8b1 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)