diff options
author | Sona Kurazyan <sona.kurazyan@qt.io> | 2019-11-13 15:38:28 +0100 |
---|---|---|
committer | Sona Kurazyan <sona.kurazyan@qt.io> | 2019-12-18 17:21:52 +0100 |
commit | 0e44a69b3546f259cd01bac1a5d10e86b287eb45 (patch) | |
tree | e342f435b08937f9b0664ea9b9c9eaf8541054ba /tests/auto/xmlpatternssdk/TestResultHandler.cpp | |
parent | 159d7230d301f999633eecef25f8569f5e8831b6 (diff) | |
download | qtxmlpatterns-0e44a69b3546f259cd01bac1a5d10e86b287eb45.tar.gz |
Stop using SAX classes for reading XML files
The qtxmlpatterns' tests are using SAX classes for parsing XML files.
These classes will be deprecated.
Replaced QXmlSimpleReader by QDomDocument where applicable.
For the test suite handlers inheriting from QXmlDefaultHandler, introduced
the XmlParseHelper base class, which drives the parsing loop and allows
overriding the methods for handling different XML tokens.
Task-number: QTBUG-76177
Change-Id: Ia1a60c898a272906ede459e95ced7ec95d154fde
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'tests/auto/xmlpatternssdk/TestResultHandler.cpp')
-rw-r--r-- | tests/auto/xmlpatternssdk/TestResultHandler.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/tests/auto/xmlpatternssdk/TestResultHandler.cpp b/tests/auto/xmlpatternssdk/TestResultHandler.cpp index 92f0c01..d578f3a 100644 --- a/tests/auto/xmlpatternssdk/TestResultHandler.cpp +++ b/tests/auto/xmlpatternssdk/TestResultHandler.cpp @@ -41,10 +41,8 @@ TestResultHandler::TestResultHandler() m_comments.reserve(1000); /* Comments are only used for stuff that crash, more or less. */ } -bool TestResultHandler::startElement(const QString &namespaceURI, - const QString &localName, - const QString &, - const QXmlAttributes &atts) +bool TestResultHandler::startElement(const QStringRef &namespaceURI, const QStringRef &localName, + const QStringRef &, const QXmlStreamAttributes &atts) { /* We only care about 'test-case', ignore everything else. */ if(localName != QLatin1String("test-case") || @@ -55,12 +53,13 @@ bool TestResultHandler::startElement(const QString &namespaceURI, Q_ASSERT_X(atts.count() == 2 || atts.count() == 3, Q_FUNC_INFO, "The input appears to not conform to XQTSResult.xsd"); - Q_ASSERT_X(!m_result.contains(atts.value(QLatin1String("name"))), - Q_FUNC_INFO, + Q_ASSERT_X(!m_result.contains(atts.value(QLatin1String("name")).toString()), Q_FUNC_INFO, qPrintable(QString::fromLatin1("A test result for test case %1 has " - "already been read(duplicate entry it seems).").arg(atts.value(QLatin1String("name"))))); + "already been read(duplicate entry it seems).") + .arg(atts.value(QLatin1String("name"))))); - m_result.insert(atts.value(0), TestResult::statusFromString(atts.value(QLatin1String("result")))); + m_result.insert(atts.at(0).value().toString(), + TestResult::statusFromString(atts.value(QLatin1String("result")).toString())); return true; } |