summaryrefslogtreecommitdiffstats
path: root/tests/auto/xmlpatternsxqts/lib/XSDTSTestCase.h
diff options
context:
space:
mode:
authorTobias Koenig <tokoe@kde.org>2009-05-16 10:19:10 (GMT)
committerTobias Koenig <tokoe@kde.org>2009-05-16 10:19:10 (GMT)
commit135a028d9dc9a28a0a072665a7dc43b7e9e187be (patch)
treed259e1d265589d10a541899d4982ab4e656900eb /tests/auto/xmlpatternsxqts/lib/XSDTSTestCase.h
parent210bd7b6033e41aad61fe131002dc5e496d7427a (diff)
downloadQt-135a028d9dc9a28a0a072665a7dc43b7e9e187be.zip
Qt-135a028d9dc9a28a0a072665a7dc43b7e9e187be.tar.gz
Qt-135a028d9dc9a28a0a072665a7dc43b7e9e187be.tar.bz2
Add W3C XML Schema validation support
This was done by Tobias Koenig, as part of an internship at Trolltech/Qt Software, started at Wed Oct 1 18:32:43 2008 +0200, and the last commit being part of this commit dating Tue Feb 24 11:03:36 2009 +0100. This is work consisting of about 650 commits squashed into one, where the first commit was 61b280386c1905a15690fdd917dcbc8eb09b6283, in the repository before Qt's history cut.
Diffstat (limited to 'tests/auto/xmlpatternsxqts/lib/XSDTSTestCase.h')
-rw-r--r--tests/auto/xmlpatternsxqts/lib/XSDTSTestCase.h130
1 files changed, 130 insertions, 0 deletions
diff --git a/tests/auto/xmlpatternsxqts/lib/XSDTSTestCase.h b/tests/auto/xmlpatternsxqts/lib/XSDTSTestCase.h
new file mode 100644
index 0000000..ce84988
--- /dev/null
+++ b/tests/auto/xmlpatternsxqts/lib/XSDTSTestCase.h
@@ -0,0 +1,130 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the Patternist project on Trolltech Labs.
+**
+** $TROLLTECH_GPL_LICENSE$
+**
+***************************************************************************
+*/
+
+#ifndef PatternistSDK_XSDTSTestCase_H
+#define PatternistSDK_XSDTSTestCase_H
+
+#include <QDate>
+#include <QString>
+#include <QUrl>
+
+#include "TestBaseLine.h"
+#include "TestCase.h"
+
+QT_BEGIN_HEADER
+
+namespace QPatternistSDK
+{
+ /**
+ * @short Represents a test case in a test suite in the XML Query Test Suite.
+ *
+ * TestCase is a memory representation of a test case, and maps
+ * to the @c test-case element in the XQuery Test Suite test
+ * case catalog.
+ *
+ * @ingroup PatternistSDK
+ * @author Frans Englich <fenglich@trolltech.com>
+ */
+ class Q_PATTERNISTSDK_EXPORT XSDTSTestCase : public TestCase
+ {
+ public:
+ enum TestType
+ {
+ SchemaTest,
+ InstanceTest
+ };
+
+ XSDTSTestCase(const Scenario scen, TreeItem *parent, TestType testType);
+ virtual ~XSDTSTestCase();
+
+ /**
+ * Executes the test, and returns the result. The returned list
+ * will always contain exactly one TestResult.
+ *
+ * @p stage is ignored when running out-of-process.
+ */
+ virtual TestResult::List execute(const ExecutionStage stage,
+ TestSuite *ts);
+ /**
+ * The identifier, the name of the test. For example, "Literals034".
+ * The name of a test case must be unique.
+ */
+ virtual QString name() const;
+ virtual QString creator() const;
+ virtual QString description() const;
+ /**
+ * @returns the query inside the file, specified by testCasePath(). Loading
+ * of the file is not cached in order to avoid complications.
+ * @param ok is set to @c false if loading the query file fails
+ */
+ virtual QString sourceCode(bool &ok) const;
+ virtual QUrl schemaUri() const;
+ virtual QUrl instanceUri() const;
+ virtual QUrl testCasePath() const {return QUrl();}
+ virtual QDate lastModified() const;
+
+ bool isXPath() const;
+
+ /**
+ * What kind of test case this is, what kind of scenario it takes part
+ * of. For example, whether the test case should evaluate normally or fail.
+ */
+ Scenario scenario() const;
+
+ void setCreator(const QString &creator);
+ void setLastModified(const QDate &date);
+ void setDescription(const QString &description);
+ void setName(const QString &name);
+ void setSchemaUri(const QUrl &uri);
+ void setInstanceUri(const QUrl &uri);
+ void setTestCasePath(const QUrl &uri) {}
+ void setContextItemSource(const QUrl &uri);
+ void addBaseLine(TestBaseLine *lines);
+
+ virtual TreeItem *parent() const;
+
+ virtual QVariant data(const Qt::ItemDataRole role, int column) const;
+
+ virtual QString title() const;
+ virtual TestBaseLine::List baseLines() const;
+
+ virtual int columnCount() const;
+
+ virtual QUrl contextItemSource() const;
+ void setParent(TreeItem *const parent);
+ virtual QPatternist::ExternalVariableLoader::Ptr externalVariableLoader() const;
+ virtual TestResult *testResult() const;
+ virtual ResultSummary resultSummary() const;
+
+ private:
+ void executeSchemaTest(TestResult::Status &resultStatus, QString &serialized, QAbstractMessageHandler *handler);
+ void executeInstanceTest(TestResult::Status &resultStatus, QString &serialized, QAbstractMessageHandler *handler);
+
+ QString m_name;
+ QString m_creator;
+ QString m_description;
+ QUrl m_schemaUri;
+ QUrl m_instanceUri;
+ QDate m_lastModified;
+ const Scenario m_scenario;
+ TreeItem * m_parent;
+ TestBaseLine::List m_baseLines;
+ QUrl m_contextItemSource;
+ TestType m_testType;
+ QPointer<TestResult> m_result;
+ };
+}
+
+QT_END_HEADER
+
+#endif
+// vim: et:ts=4:sw=4:sts=4