summaryrefslogtreecommitdiffstats
path: root/tests/auto/testlib/selftests/badxml
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2014-01-16 13:45:37 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-21 06:28:23 +0100
commitafe3902a30030280b48bfeed403db5edf56336a1 (patch)
tree8b55e3979ee093d519124b02aa2b06fc35499e76 /tests/auto/testlib/selftests/badxml
parent5c19fad8c178b055e8864b2576cfa3cbaa44a19e (diff)
Testlib: Use QString for messages in QAbstractTestLogger::addMessage()
Task-number: QTBUG-35743 [ChangeLog][QtTest][Windows] Use correct UTF-8 encoding for XML test results on platforms with different console encoding. Change-Id: Ice9d03192098f931e5dac358928e0c4421ab715e Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
Diffstat (limited to 'tests/auto/testlib/selftests/badxml')
-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.
*/