summaryrefslogtreecommitdiffstats
path: root/tests/auto/xmlpatternssdk
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/xmlpatternssdk')
-rw-r--r--tests/auto/xmlpatternssdk/TestSuite.cpp1
-rw-r--r--tests/auto/xmlpatternssdk/TestSuiteHandler.cpp17
-rw-r--r--tests/auto/xmlpatternssdk/TestSuiteHandler.h4
-rw-r--r--tests/auto/xmlpatternssdk/Worker.cpp2
-rw-r--r--tests/auto/xmlpatternssdk/XSDTestSuiteHandler.cpp1
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,