diff options
author | Honglei Zhang <honglei.zhang@nokia.com> | 2011-08-22 11:42:41 (GMT) |
---|---|---|
committer | Honglei Zhang <honglei.zhang@nokia.com> | 2011-08-24 11:20:20 (GMT) |
commit | 33f65993866e3eb2a80001f1b53f38dbfc7017ce (patch) | |
tree | a55a42043aca2435a80f5270331e0c2c1ed94495 /tests/auto/xmlpatternssdk | |
parent | 49dd6e2978759a3fc46016d82a46d8ee8b609221 (diff) | |
download | Qt-33f65993866e3eb2a80001f1b53f38dbfc7017ce.zip Qt-33f65993866e3eb2a80001f1b53f38dbfc7017ce.tar.gz Qt-33f65993866e3eb2a80001f1b53f38dbfc7017ce.tar.bz2 |
Enable running of XQuery test suite
Some xmlpatterns auto test cases are still using old script. And some
small bugs in test driver prevent the XQuery test suite testing. This
commit updated the out-of-date scripts and fixes couple of bugs in test
driver.
Task-number: QTBUG-16028
Reviewed-by: Dmitry Trofimov
Diffstat (limited to 'tests/auto/xmlpatternssdk')
-rw-r--r-- | tests/auto/xmlpatternssdk/TestSuite.cpp | 1 | ||||
-rw-r--r-- | tests/auto/xmlpatternssdk/TestSuiteHandler.cpp | 17 | ||||
-rw-r--r-- | tests/auto/xmlpatternssdk/TestSuiteHandler.h | 4 | ||||
-rw-r--r-- | tests/auto/xmlpatternssdk/Worker.cpp | 2 | ||||
-rw-r--r-- | tests/auto/xmlpatternssdk/XSDTestSuiteHandler.cpp | 1 |
5 files changed, 24 insertions, 1 deletions
diff --git a/tests/auto/xmlpatternssdk/TestSuite.cpp b/tests/auto/xmlpatternssdk/TestSuite.cpp index e24786a..db94f25 100644 --- a/tests/auto/xmlpatternssdk/TestSuite.cpp +++ b/tests/auto/xmlpatternssdk/TestSuite.cpp @@ -151,6 +151,7 @@ TestSuite *TestSuite::openCatalog(QIODevice *input, } reader.setContentHandler(loader.data()); + reader.setEntityResolver(loader.data()); QXmlInputSource source(input); diff --git a/tests/auto/xmlpatternssdk/TestSuiteHandler.cpp b/tests/auto/xmlpatternssdk/TestSuiteHandler.cpp index 74a6082..c46350a 100644 --- a/tests/auto/xmlpatternssdk/TestSuiteHandler.cpp +++ b/tests/auto/xmlpatternssdk/TestSuiteHandler.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include <QtDebug> +#include <QDir> #include "qacceltreeresourceloader_p.h" #include "qnetworkaccessdelegator_p.h" @@ -308,5 +309,21 @@ TestSuite *TestSuiteHandler::testSuite() const return m_ts; } +bool TestSuiteHandler::resolveEntity(const QString& publicId, + const QString& systemId, + QXmlInputSource*& ret) +{ + QFileInfo catFileName(m_catalogFile.path()); + QFileInfo externalFileName(catFileName.absolutePath(), systemId); + QFile *file = new QFile(externalFileName.absoluteFilePath()); + if (file->open(QIODevice::ReadOnly | QIODevice::Text)) { + ret = new QXmlInputSource(file); + return true; + } + return false; + //return QXmlDefaultHandler::resolveEntity(publicId, systemId, ret); +} + + // vim: et:ts=4:sw=4:sts=4 diff --git a/tests/auto/xmlpatternssdk/TestSuiteHandler.h b/tests/auto/xmlpatternssdk/TestSuiteHandler.h index 7a46145..2d6a22f 100644 --- a/tests/auto/xmlpatternssdk/TestSuiteHandler.h +++ b/tests/auto/xmlpatternssdk/TestSuiteHandler.h @@ -94,6 +94,10 @@ namespace QPatternistSDK const QString &qName, const QXmlAttributes &atts); + virtual bool resolveEntity(const QString& publicId, + const QString& systemId, + QXmlInputSource*& ret); + virtual TestSuite *testSuite() const; private: diff --git a/tests/auto/xmlpatternssdk/Worker.cpp b/tests/auto/xmlpatternssdk/Worker.cpp index f2051cc..4fb7da7 100644 --- a/tests/auto/xmlpatternssdk/Worker.cpp +++ b/tests/auto/xmlpatternssdk/Worker.cpp @@ -183,7 +183,7 @@ void Worker::threadFinished() const int totPass = count(m_result, TestResult::Pass); const int total = resultCount; const int notTested = m_notTested.count(); - const int percentage = int((static_cast<double>(totPass) / total) * 100); + const int percentage = total==0 ? 0 : int((static_cast<double>(totPass) / total) * 100); Q_ASSERT_X(percentage >= 0 && percentage <= 100, Q_FUNC_INFO, qPrintable(QString(QLatin1String("Percentage was: %1")).arg(percentage))); diff --git a/tests/auto/xmlpatternssdk/XSDTestSuiteHandler.cpp b/tests/auto/xmlpatternssdk/XSDTestSuiteHandler.cpp index 5b6fb90..9036dad 100644 --- a/tests/auto/xmlpatternssdk/XSDTestSuiteHandler.cpp +++ b/tests/auto/xmlpatternssdk/XSDTestSuiteHandler.cpp @@ -793,6 +793,7 @@ XSDTestSuiteHandler::XSDTestSuiteHandler(const QUrl &catalogFile) : m_ts(0) << QLatin1String("schZ012_a") << QLatin1String("stZ041") << QLatin1String("wildZ010"); + } bool XSDTestSuiteHandler::startElement(const QString &namespaceURI, |