diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2014-01-16 13:45:37 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-21 06:28:23 +0100 |
commit | afe3902a30030280b48bfeed403db5edf56336a1 (patch) | |
tree | 8b55e3979ee093d519124b02aa2b06fc35499e76 | |
parent | 5c19fad8c178b055e8864b2576cfa3cbaa44a19e (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>
-rw-r--r-- | src/testlib/qabstracttestlogger_p.h | 2 | ||||
-rw-r--r-- | src/testlib/qplaintestlogger.cpp | 4 | ||||
-rw-r--r-- | src/testlib/qplaintestlogger_p.h | 2 | ||||
-rw-r--r-- | src/testlib/qtestlog.cpp | 26 | ||||
-rw-r--r-- | src/testlib/qxmltestlogger.cpp | 6 | ||||
-rw-r--r-- | src/testlib/qxmltestlogger_p.h | 2 | ||||
-rw-r--r-- | src/testlib/qxunittestlogger.cpp | 8 | ||||
-rw-r--r-- | src/testlib/qxunittestlogger_p.h | 2 | ||||
-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 |
14 files changed, 92 insertions, 51 deletions
diff --git a/src/testlib/qabstracttestlogger_p.h b/src/testlib/qabstracttestlogger_p.h index c471717655..c549233ddb 100644 --- a/src/testlib/qabstracttestlogger_p.h +++ b/src/testlib/qabstracttestlogger_p.h @@ -94,7 +94,7 @@ public: const char *file = 0, int line = 0) = 0; virtual void addBenchmarkResult(const QBenchmarkResult &result) = 0; - virtual void addMessage(MessageTypes type, const char *message, + virtual void addMessage(MessageTypes type, const QString &message, const char *file = 0, int line = 0) = 0; void outputString(const char *msg); diff --git a/src/testlib/qplaintestlogger.cpp b/src/testlib/qplaintestlogger.cpp index 77be0e423e..480956d34a 100644 --- a/src/testlib/qplaintestlogger.cpp +++ b/src/testlib/qplaintestlogger.cpp @@ -381,14 +381,14 @@ void QPlainTestLogger::addBenchmarkResult(const QBenchmarkResult &result) printBenchmarkResult(result); } -void QPlainTestLogger::addMessage(MessageTypes type, const char *message, +void QPlainTestLogger::addMessage(MessageTypes type, const QString &message, const char *file, int line) { // suppress non-fatal messages in silent mode if (type != QAbstractTestLogger::QFatal && QTestLog::verboseLevel() < 0) return; - printMessage(QTest::messageType2String(type), message, file, line); + printMessage(QTest::messageType2String(type), qPrintable(message), file, line); } QT_END_NAMESPACE diff --git a/src/testlib/qplaintestlogger_p.h b/src/testlib/qplaintestlogger_p.h index 8aa0d745e9..69dbc89649 100644 --- a/src/testlib/qplaintestlogger_p.h +++ b/src/testlib/qplaintestlogger_p.h @@ -73,7 +73,7 @@ public: const char *file = 0, int line = 0); void addBenchmarkResult(const QBenchmarkResult &result); - void addMessage(MessageTypes type, const char *message, + void addMessage(MessageTypes type, const QString &message, const char *file = 0, int line = 0); private: diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp index 037bed643d..74947b3f3a 100644 --- a/src/testlib/qtestlog.cpp +++ b/src/testlib/qtestlog.cpp @@ -209,7 +209,7 @@ namespace QTest { FOREACH_LOGGER(logger->addBenchmarkResult(result)); } - static void addMessage(QAbstractTestLogger::MessageTypes type, const char *message, + static void addMessage(QAbstractTestLogger::MessageTypes type, const QString &message, const char *file = 0, int line = 0) { FOREACH_LOGGER(logger->addMessage(type, message, file, line)); @@ -242,11 +242,10 @@ namespace QTest { static QtMessageHandler oldMessageHandler; - static bool handleIgnoredMessage(QtMsgType type, const char *msg) + static bool handleIgnoredMessage(QtMsgType type, const QString &message) { if (!ignoreResultList) return false; - const QString message = QString::fromLocal8Bit(msg); IgnoreResultList *last = 0; IgnoreResultList *list = ignoreResultList; while (list) { @@ -279,12 +278,11 @@ namespace QTest { QTEST_ASSERT(QTest::TestLoggers::loggerCount() != 0); } - QByteArray msg = message.toLocal8Bit(); - if (handleIgnoredMessage(type, msg)) + if (handleIgnoredMessage(type, message)) // the message is expected, so just swallow it. return; - msg = qMessageFormatString(type, context, message).toLocal8Bit(); + QString msg = qMessageFormatString(type, context, message); msg.chop(1); // remove trailing newline if (type != QtFatalMsg) { @@ -293,7 +291,7 @@ namespace QTest { if (!counter.deref()) { QTest::TestLoggers::addMessage(QAbstractTestLogger::QSystem, - "Maximum amount of warnings exceeded. Use -maxwarnings to override."); + QStringLiteral("Maximum amount of warnings exceeded. Use -maxwarnings to override.")); return; } } @@ -354,15 +352,15 @@ void QTestLog::leaveTestFunction() void QTestLog::printUnhandledIgnoreMessages() { - char msg[1024]; + QString message; QTest::IgnoreResultList *list = QTest::ignoreResultList; while (list) { if (list->pattern.type() == QVariant::String) { - qsnprintf(msg, 1024, "Did not receive message: \"%s\"", qPrintable(list->pattern.toString())); + message = QStringLiteral("Did not receive message: \"") + list->pattern.toString() + QLatin1Char('"'); } else { - qsnprintf(msg, 1024, "Did not receive any message matching: \"%s\"", qPrintable(list->pattern.toRegularExpression().pattern())); + message = QStringLiteral("Did not receive any message matching: \"") + list->pattern.toRegularExpression().pattern() + QLatin1Char('"'); } - QTest::TestLoggers::addMessage(QAbstractTestLogger::Info, msg); + QTest::TestLoggers::addMessage(QAbstractTestLogger::Info, message); list = list->next; } @@ -419,7 +417,7 @@ void QTestLog::addSkip(const char *msg, const char *file, int line) ++QTest::skips; - QTest::TestLoggers::addMessage(QAbstractTestLogger::Skip, msg, file, line); + QTest::TestLoggers::addMessage(QAbstractTestLogger::Skip, QString::fromUtf8(msg), file, line); } void QTestLog::addBenchmarkResult(const QBenchmarkResult &result) @@ -483,14 +481,14 @@ void QTestLog::warn(const char *msg, const char *file, int line) QTEST_ASSERT(msg); if (QTest::TestLoggers::loggerCount() > 0) - QTest::TestLoggers::addMessage(QAbstractTestLogger::Warn, msg, file, line); + QTest::TestLoggers::addMessage(QAbstractTestLogger::Warn, QString::fromUtf8(msg), file, line); } void QTestLog::info(const char *msg, const char *file, int line) { QTEST_ASSERT(msg); - QTest::TestLoggers::addMessage(QAbstractTestLogger::Info, msg, file, line); + QTest::TestLoggers::addMessage(QAbstractTestLogger::Info, QString::fromUtf8(msg), file, line); } void QTestLog::setVerboseLevel(int level) diff --git a/src/testlib/qxmltestlogger.cpp b/src/testlib/qxmltestlogger.cpp index b4035301d3..3fff753c5c 100644 --- a/src/testlib/qxmltestlogger.cpp +++ b/src/testlib/qxmltestlogger.cpp @@ -271,7 +271,7 @@ void QXmlTestLogger::addBenchmarkResult(const QBenchmarkResult &result) outputString(buf.constData()); } -void QXmlTestLogger::addMessage(MessageTypes type, const char *message, +void QXmlTestLogger::addMessage(MessageTypes type, const QString &message, const char *file, int line) { QTestCharBuffer buf; @@ -288,10 +288,10 @@ void QXmlTestLogger::addMessage(MessageTypes type, const char *message, xmlQuote("edFile, file); xmlCdata(&cdataGtag, gtag); xmlCdata(&cdataTag, tag); - xmlCdata(&cdataDescription, message); + xmlCdata(&cdataDescription, message.toUtf8().constData()); QTest::qt_asprintf(&buf, - QTest::messageFormatString(QTest::isEmpty(message), notag), + QTest::messageFormatString(message.isEmpty(), notag), QTest::xmlMessageType2String(type), quotedFile.constData(), line, cdataGtag.constData(), diff --git a/src/testlib/qxmltestlogger_p.h b/src/testlib/qxmltestlogger_p.h index 65699af3ad..8ca15e47e2 100644 --- a/src/testlib/qxmltestlogger_p.h +++ b/src/testlib/qxmltestlogger_p.h @@ -77,7 +77,7 @@ public: const char *file = 0, int line = 0); void addBenchmarkResult(const QBenchmarkResult &result); - void addMessage(MessageTypes type, const char *message, + void addMessage(MessageTypes type, const QString &message, const char *file = 0, int line = 0); static int xmlCdata(QTestCharBuffer *dest, char const* src); diff --git a/src/testlib/qxunittestlogger.cpp b/src/testlib/qxunittestlogger.cpp index 0a1a5fb6f9..a47f77ae49 100644 --- a/src/testlib/qxunittestlogger.cpp +++ b/src/testlib/qxunittestlogger.cpp @@ -220,7 +220,7 @@ void QXunitTestLogger::addIncident(IncidentTypes type, const char *description, have some information about the expected failure. */ if (type == QAbstractTestLogger::XFail) { - QXunitTestLogger::addMessage(QAbstractTestLogger::Info, description, file, line); + QXunitTestLogger::addMessage(QAbstractTestLogger::Info, QString::fromUtf8(description), file, line); } } @@ -263,7 +263,7 @@ void QXunitTestLogger::addTag(QTestElement* element) element->addAttribute(QTest::AI_Tag, buf.constData()); } -void QXunitTestLogger::addMessage(MessageTypes type, const char *message, const char *file, int line) +void QXunitTestLogger::addMessage(MessageTypes type, const QString &message, const char *file, int line) { QTestElement *errorElement = new QTestElement(QTest::LET_Error); const char *typeBuf = 0; @@ -296,7 +296,7 @@ void QXunitTestLogger::addMessage(MessageTypes type, const char *message, const } errorElement->addAttribute(QTest::AI_Type, typeBuf); - errorElement->addAttribute(QTest::AI_Description, message); + errorElement->addAttribute(QTest::AI_Description, message.toUtf8().constData()); addTag(errorElement); if (file) @@ -314,7 +314,7 @@ void QXunitTestLogger::addMessage(MessageTypes type, const char *message, const // Also add the message to the system error log (i.e. stderr), if one exists if (errorLogElement) { QTestElement *systemErrorElement = new QTestElement(QTest::LET_Error); - systemErrorElement->addAttribute(QTest::AI_Description, message); + systemErrorElement->addAttribute(QTest::AI_Description, message.toUtf8().constData()); errorLogElement->addLogElement(systemErrorElement); } } diff --git a/src/testlib/qxunittestlogger_p.h b/src/testlib/qxunittestlogger_p.h index 2c39fa952c..754462473a 100644 --- a/src/testlib/qxunittestlogger_p.h +++ b/src/testlib/qxunittestlogger_p.h @@ -77,7 +77,7 @@ class QXunitTestLogger : public QAbstractTestLogger void addBenchmarkResult(const QBenchmarkResult &result); void addTag(QTestElement* element); - void addMessage(MessageTypes type, const char *message, + void addMessage(MessageTypes type, const QString &message, const char *file = 0, int line = 0); private: 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"); |