diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/testlib/selftests/badxml/tst_badxml.cpp | 21 | ||||
-rw-r--r-- | tests/auto/testlib/selftests/expected_badxml.lightxml | 25 | ||||
-rw-r--r-- | tests/auto/testlib/selftests/expected_badxml.txt | 12 | ||||
-rw-r--r-- | tests/auto/testlib/selftests/expected_badxml.xml | 25 | ||||
-rw-r--r-- | tests/auto/testlib/selftests/expected_badxml.xunitxml | 6 | ||||
-rw-r--r-- | tests/auto/testlib/selftests/tst_selftests.cpp | 2 |
6 files changed, 67 insertions, 24 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. */ diff --git a/tests/auto/testlib/selftests/expected_badxml.lightxml b/tests/auto/testlib/selftests/expected_badxml.lightxml index 15981b12be..e4c79e3bb0 100644 --- a/tests/auto/testlib/selftests/expected_badxml.lightxml +++ b/tests/auto/testlib/selftests/expected_badxml.lightxml @@ -4,14 +4,14 @@ </Environment> <TestFunction name="initTestCase"> <Incident type="pass" file="" line="0" /> -<Duration msecs="0"/> + <Duration msecs="0"/> </TestFunction> <TestFunction name="badDataTag"> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[fail end cdata ]]]><![CDATA[]> text ]]]><![CDATA[]> more text]]></DataTag> <Description><![CDATA[a message]]></Description> </Message> -<Incident type="fail" file="tst_badxml.cpp" line="111"> +<Incident type="fail" file="tst_badxml.cpp" line="114"> <DataTag><![CDATA[fail end cdata ]]]><![CDATA[]> text ]]]><![CDATA[]> more text]]></DataTag> <Description><![CDATA[a failure]]></Description> </Incident> @@ -27,7 +27,7 @@ <DataTag><![CDATA[fail quotes " text" more text]]></DataTag> <Description><![CDATA[a message]]></Description> </Message> -<Incident type="fail" file="tst_badxml.cpp" line="111"> +<Incident type="fail" file="tst_badxml.cpp" line="114"> <DataTag><![CDATA[fail quotes " text" more text]]></DataTag> <Description><![CDATA[a failure]]></Description> </Incident> @@ -43,7 +43,7 @@ <DataTag><![CDATA[fail xml close > open < tags < text]]></DataTag> <Description><![CDATA[a message]]></Description> </Message> -<Incident type="fail" file="tst_badxml.cpp" line="111"> +<Incident type="fail" file="tst_badxml.cpp" line="114"> <DataTag><![CDATA[fail xml close > open < tags < text]]></DataTag> <Description><![CDATA[a failure]]></Description> </Incident> @@ -59,7 +59,7 @@ <DataTag><![CDATA[fail all > " mixed ]]]><![CDATA[]> up > " in < the ]]]><![CDATA[]> hopes < of triggering "< ]]]><![CDATA[]> bugs]]></DataTag> <Description><![CDATA[a message]]></Description> </Message> -<Incident type="fail" file="tst_badxml.cpp" line="111"> +<Incident type="fail" file="tst_badxml.cpp" line="114"> <DataTag><![CDATA[fail all > " mixed ]]]><![CDATA[]> up > " in < the ]]]><![CDATA[]> hopes < of triggering "< ]]]><![CDATA[]> bugs]]></DataTag> <Description><![CDATA[a failure]]></Description> </Incident> @@ -71,7 +71,7 @@ <DataTag><![CDATA[pass all > " mixed ]]]><![CDATA[]> up > " in < the ]]]><![CDATA[]> hopes < of triggering "< ]]]><![CDATA[]> bugs]]></DataTag> </Incident> <BenchmarkResult metric="Events" tag="pass all > " mixed ]]> up > " in < the ]]> hopes < of triggering "< ]]> bugs" value="0" iterations="1" /> -<Duration msecs="0"/> + <Duration msecs="0"/> </TestFunction> <TestFunction name="badMessage"> <Message type="qdebug" file="" line="0"> @@ -102,16 +102,23 @@ <Incident type="pass" file="" line="0"> <DataTag><![CDATA[string 3]]></DataTag> </Incident> -<Duration msecs="0"/> + <Duration msecs="0"/> </TestFunction> <TestFunction name="failWithNoFile"> <Incident type="fail" file="" line="0"> <Description><![CDATA[failure message]]></Description> </Incident> -<Duration msecs="0"/> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="encoding"> +<Message type="qdebug" file="" line="0"> + <Description><![CDATA["Ülrich Ümläut"]]></Description> +</Message> +<Incident type="pass" file="" line="0" /> + <Duration msecs="0"/> </TestFunction> <TestFunction name="cleanupTestCase"> <Incident type="pass" file="" line="0" /> -<Duration msecs="0"/> + <Duration msecs="0"/> </TestFunction> <Duration msecs="0"/> diff --git a/tests/auto/testlib/selftests/expected_badxml.txt b/tests/auto/testlib/selftests/expected_badxml.txt index 3c65231529..a42013df0b 100644 --- a/tests/auto/testlib/selftests/expected_badxml.txt +++ b/tests/auto/testlib/selftests/expected_badxml.txt @@ -3,28 +3,28 @@ Config: Using QtTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HER PASS : tst_BadXml::initTestCase() QDEBUG : tst_BadXml::badDataTag(fail end cdata ]]> text ]]> more text) a message FAIL! : tst_BadXml::badDataTag(fail end cdata ]]> text ]]> more text) a failure - Loc: [tst_badxml.cpp(111)] + Loc: [tst_badxml.cpp(114)] QDEBUG : tst_BadXml::badDataTag(pass end cdata ]]> text ]]> more text) a message PASS : tst_BadXml::badDataTag(pass end cdata ]]> text ]]> more text) RESULT : tst_BadXml::badDataTag():"pass end cdata ]]> text ]]> more text": 0 events per iteration (total: 0, iterations: 1) QDEBUG : tst_BadXml::badDataTag(fail quotes " text" more text) a message FAIL! : tst_BadXml::badDataTag(fail quotes " text" more text) a failure - Loc: [tst_badxml.cpp(111)] + Loc: [tst_badxml.cpp(114)] QDEBUG : tst_BadXml::badDataTag(pass quotes " text" more text) a message PASS : tst_BadXml::badDataTag(pass quotes " text" more text) RESULT : tst_BadXml::badDataTag():"pass quotes " text" more text": 0 events per iteration (total: 0, iterations: 1) QDEBUG : tst_BadXml::badDataTag(fail xml close > open < tags < text) a message FAIL! : tst_BadXml::badDataTag(fail xml close > open < tags < text) a failure - Loc: [tst_badxml.cpp(111)] + Loc: [tst_badxml.cpp(114)] QDEBUG : tst_BadXml::badDataTag(pass xml close > open < tags < text) a message PASS : tst_BadXml::badDataTag(pass xml close > open < tags < text) RESULT : tst_BadXml::badDataTag():"pass xml close > open < tags < text": 0 events per iteration (total: 0, iterations: 1) QDEBUG : tst_BadXml::badDataTag(fail all > " mixed ]]> up > " in < the ]]> hopes < of triggering "< ]]> bugs) a message FAIL! : tst_BadXml::badDataTag(fail all > " mixed ]]> up > " in < the ]]> hopes < of triggering "< ]]> bugs) a failure - Loc: [tst_badxml.cpp(111)] + Loc: [tst_badxml.cpp(114)] QDEBUG : tst_BadXml::badDataTag(pass all > " mixed ]]> up > " in < the ]]> hopes < of triggering "< ]]> bugs) a message PASS : tst_BadXml::badDataTag(pass all > " mixed ]]> up > " in < the ]]> hopes < of triggering "< ]]> bugs) RESULT : tst_BadXml::badDataTag():"pass all > " mixed ]]> up > " in < the ]]> hopes < of triggering "< ]]> bugs": @@ -38,6 +38,8 @@ PASS : tst_BadXml::badMessage(string 2) QDEBUG : tst_BadXml::badMessage(string 3) all > " mixed ]]> up > " in < the ]]> hopes < of triggering "< ]]> bugs PASS : tst_BadXml::badMessage(string 3) FAIL! : tst_BadXml::failWithNoFile() failure message +SKIP : tst_BadXml::encoding() Skipped for text due to unpredictable console encoding. + Loc: [tst_badxml.cpp(139)] PASS : tst_BadXml::cleanupTestCase() -Totals: 10 passed, 5 failed, 0 skipped +Totals: 10 passed, 5 failed, 1 skipped ********* Finished testing of tst_BadXml ********* diff --git a/tests/auto/testlib/selftests/expected_badxml.xml b/tests/auto/testlib/selftests/expected_badxml.xml index c3330a6b97..0811db0f3a 100644 --- a/tests/auto/testlib/selftests/expected_badxml.xml +++ b/tests/auto/testlib/selftests/expected_badxml.xml @@ -6,14 +6,14 @@ </Environment> <TestFunction name="initTestCase"> <Incident type="pass" file="" line="0" /> -<Duration msecs="0"/> + <Duration msecs="0"/> </TestFunction> <TestFunction name="badDataTag"> <Message type="qdebug" file="" line="0"> <DataTag><![CDATA[fail end cdata ]]]><![CDATA[]> text ]]]><![CDATA[]> more text]]></DataTag> <Description><![CDATA[a message]]></Description> </Message> -<Incident type="fail" file="tst_badxml.cpp" line="111"> +<Incident type="fail" file="tst_badxml.cpp" line="114"> <DataTag><![CDATA[fail end cdata ]]]><![CDATA[]> text ]]]><![CDATA[]> more text]]></DataTag> <Description><![CDATA[a failure]]></Description> </Incident> @@ -29,7 +29,7 @@ <DataTag><![CDATA[fail quotes " text" more text]]></DataTag> <Description><![CDATA[a message]]></Description> </Message> -<Incident type="fail" file="tst_badxml.cpp" line="111"> +<Incident type="fail" file="tst_badxml.cpp" line="114"> <DataTag><![CDATA[fail quotes " text" more text]]></DataTag> <Description><![CDATA[a failure]]></Description> </Incident> @@ -45,7 +45,7 @@ <DataTag><![CDATA[fail xml close > open < tags < text]]></DataTag> <Description><![CDATA[a message]]></Description> </Message> -<Incident type="fail" file="tst_badxml.cpp" line="111"> +<Incident type="fail" file="tst_badxml.cpp" line="114"> <DataTag><![CDATA[fail xml close > open < tags < text]]></DataTag> <Description><![CDATA[a failure]]></Description> </Incident> @@ -61,7 +61,7 @@ <DataTag><![CDATA[fail all > " mixed ]]]><![CDATA[]> up > " in < the ]]]><![CDATA[]> hopes < of triggering "< ]]]><![CDATA[]> bugs]]></DataTag> <Description><![CDATA[a message]]></Description> </Message> -<Incident type="fail" file="tst_badxml.cpp" line="111"> +<Incident type="fail" file="tst_badxml.cpp" line="114"> <DataTag><![CDATA[fail all > " mixed ]]]><![CDATA[]> up > " in < the ]]]><![CDATA[]> hopes < of triggering "< ]]]><![CDATA[]> bugs]]></DataTag> <Description><![CDATA[a failure]]></Description> </Incident> @@ -73,7 +73,7 @@ <DataTag><![CDATA[pass all > " mixed ]]]><![CDATA[]> up > " in < the ]]]><![CDATA[]> hopes < of triggering "< ]]]><![CDATA[]> bugs]]></DataTag> </Incident> <BenchmarkResult metric="Events" tag="pass all > " mixed ]]> up > " in < the ]]> hopes < of triggering "< ]]> bugs" value="0" iterations="1" /> -<Duration msecs="0"/> + <Duration msecs="0"/> </TestFunction> <TestFunction name="badMessage"> <Message type="qdebug" file="" line="0"> @@ -104,17 +104,24 @@ <Incident type="pass" file="" line="0"> <DataTag><![CDATA[string 3]]></DataTag> </Incident> -<Duration msecs="0"/> + <Duration msecs="0"/> </TestFunction> <TestFunction name="failWithNoFile"> <Incident type="fail" file="" line="0"> <Description><![CDATA[failure message]]></Description> </Incident> -<Duration msecs="0"/> + <Duration msecs="0"/> +</TestFunction> +<TestFunction name="encoding"> +<Message type="qdebug" file="" line="0"> + <Description><![CDATA["Ülrich Ümläut"]]></Description> +</Message> +<Incident type="pass" file="" line="0" /> + <Duration msecs="0"/> </TestFunction> <TestFunction name="cleanupTestCase"> <Incident type="pass" file="" line="0" /> -<Duration msecs="0"/> + <Duration msecs="0"/> </TestFunction> <Duration msecs="0"/> </TestCase> diff --git a/tests/auto/testlib/selftests/expected_badxml.xunitxml b/tests/auto/testlib/selftests/expected_badxml.xunitxml index 939e887a88..a696da58c9 100644 --- a/tests/auto/testlib/selftests/expected_badxml.xunitxml +++ b/tests/auto/testlib/selftests/expected_badxml.xunitxml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<testsuite errors="12" failures="5" tests="5" name="tst_BadXml"> +<testsuite errors="13" failures="5" tests="6" name="tst_BadXml"> <properties> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> @@ -28,6 +28,9 @@ <testcase result="fail" name="failWithNoFile"> <failure message="failure message" result="fail"/> </testcase> + <testcase result="pass" name="encoding"> + <!-- message=""Ülrich Ümläut"" type="qdebug" --> + </testcase> <testcase result="pass" name="cleanupTestCase"/> <system-err> <![CDATA[a message]]> @@ -42,5 +45,6 @@ <![CDATA[quotes " text" more text]]> <![CDATA[xml close > open < tags < text]]> <![CDATA[all > " mixed ]]]><![CDATA[]> up > " in < the ]]]><![CDATA[]> hopes < of triggering "< ]]]><![CDATA[]> bugs]]> +<![CDATA["Ülrich Ümläut"]]> </system-err> </testsuite> diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp index 97083d8d61..c2265ad198 100644 --- a/tests/auto/testlib/selftests/tst_selftests.cpp +++ b/tests/auto/testlib/selftests/tst_selftests.cpp @@ -486,6 +486,8 @@ void tst_Selftests::runSubTest_data() continue; } } + if (subtest == "badxml" && (loggerSet.name == "all loggers" || loggerSet.name.contains("txt"))) + continue; // XML only, do not mix txt and XML for encoding test. const bool crashes = subtest == QLatin1String("assert") || subtest == QLatin1String("exceptionthrow") || subtest == QLatin1String("fetchbogus") || subtest == QLatin1String("crashedterminate") || subtest == QLatin1String("crashes") || subtest == QLatin1String("silent"); |