summaryrefslogtreecommitdiffstats
path: root/tests/auto/testlib/selftests/badxml/tst_badxml.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/testlib/selftests/badxml/tst_badxml.cpp')
-rw-r--r--tests/auto/testlib/selftests/badxml/tst_badxml.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/testlib/selftests/badxml/tst_badxml.cpp b/tests/auto/testlib/selftests/badxml/tst_badxml.cpp
index 1ccbdd7899..3f2385bb30 100644
--- a/tests/auto/testlib/selftests/badxml/tst_badxml.cpp
+++ b/tests/auto/testlib/selftests/badxml/tst_badxml.cpp
@@ -41,6 +41,7 @@
#include <QtCore/QCoreApplication>
+#include <QtCore/QStringList>
#include <QtTest/QtTest>
#include <private/qmetaobjectbuilder_p.h>
@@ -61,6 +62,8 @@ private slots:
void failWithNoFile() const;
+ void encoding();
+
public:
static QList<QByteArray> const& badStrings();
};
@@ -126,6 +129,24 @@ void tst_BadXml::failWithNoFile() const
QTest::qFail("failure message", 0, 0);
}
+// QTBUG-35743, test whether XML is using correct UTF-8 encoding
+// on platforms where the console encoding differs.
+void tst_BadXml::encoding()
+{
+ QStringList arguments = QCoreApplication::arguments();
+ arguments.pop_front(); // Prevent match on binary "badxml"
+ if (arguments.filter(QStringLiteral("xml")).isEmpty())
+ QSKIP("Skipped for text due to unpredictable console encoding.");
+ QString string;
+ string += QChar(ushort(0xDC)); // German umlaut Ue
+ string += QStringLiteral("lrich ");
+ string += QChar(ushort(0xDC)); // German umlaut Ue
+ string += QStringLiteral("ml");
+ string += QChar(ushort(0xE4)); // German umlaut ae
+ string += QStringLiteral("ut");
+ qDebug() << string;
+}
+
/*
Outputs a message containing a bad string.
*/