From 8bea43ccb0f53234f87e4aa4d27371b741005222 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 18 Aug 2009 19:15:33 +0200 Subject: 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... --- tests/auto/utf8/tst_utf8.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 decoder = QSharedPointer(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) -- cgit v0.12