1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the test suite of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT |
21 | ** included in the packaging of this file. Please review the following |
22 | ** information to ensure the GNU General Public License requirements will |
23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
24 | ** |
25 | ** $QT_END_LICENSE$ |
26 | ** |
27 | ****************************************************************************/ |
28 | |
29 | #ifndef PatternistSDK_XQTSTestCase_H |
30 | #define PatternistSDK_XQTSTestCase_H |
31 | |
32 | #include <QDate> |
33 | #include <QString> |
34 | #include <QUrl> |
35 | |
36 | #include <private/qexternalvariableloader_p.h> |
37 | |
38 | #include "TestBaseLine.h" |
39 | #include "TestCase.h" |
40 | |
41 | QT_BEGIN_NAMESPACE |
42 | |
43 | namespace QPatternistSDK |
44 | { |
45 | /** |
46 | * @short Represents a test case in a test suite in the XML Query Test Suite. |
47 | * |
48 | * TestCase is a memory representation of a test case, and maps |
49 | * to the @c test-case element in the XQuery Test Suite test |
50 | * case catalog. |
51 | * |
52 | * @ingroup PatternistSDK |
53 | * @author Frans Englich <frans.englich@nokia.com> |
54 | */ |
55 | class XQTSTestCase : public TestCase |
56 | { |
57 | public: |
58 | XQTSTestCase(const Scenario scen, TreeItem *parent, |
59 | const QXmlQuery::QueryLanguage lang = QXmlQuery::XQuery10); |
60 | virtual ~XQTSTestCase(); |
61 | |
62 | /** |
63 | * The identifier, the name of the test. For example, "Literals034". |
64 | * The name of a test case must be unique. |
65 | */ |
66 | virtual QString name() const; |
67 | virtual QString creator() const; |
68 | virtual QString description() const; |
69 | /** |
70 | * @returns the query inside the file, specified by testCasePath(). Loading |
71 | * of the file is not cached in order to avoid complications. |
72 | * @param ok is set to @c false if loading the query file fails |
73 | */ |
74 | virtual QString sourceCode(bool &ok) const; |
75 | virtual QUrl testCasePath() const; |
76 | virtual QDate lastModified() const; |
77 | |
78 | bool isXPath() const; |
79 | |
80 | /** |
81 | * What kind of test case this is, what kind of scenario it takes part |
82 | * of. For example, whether the test case should evaluate normally or fail. |
83 | */ |
84 | Scenario scenario() const; |
85 | |
86 | void setCreator(const QString &creator); |
87 | void setLastModified(const QDate &date); |
88 | void setDescription(const QString &description); |
89 | void setIsXPath(const bool isXPath); |
90 | void setName(const QString &name); |
91 | void setQueryPath(const QUrl &uri); |
92 | void setContextItemSource(const QUrl &uri); |
93 | void addBaseLine(TestBaseLine *lines); |
94 | void setInitialTemplateName(const QXmlName &name); |
95 | |
96 | virtual TreeItem *parent() const; |
97 | |
98 | virtual QVariant data(const Qt::ItemDataRole role, int column) const; |
99 | |
100 | virtual QString title() const; |
101 | virtual TestBaseLine::List baseLines() const; |
102 | |
103 | virtual int columnCount() const; |
104 | |
105 | void setExternalVariableLoader(const QPatternist::ExternalVariableLoader::Ptr &loader); |
106 | virtual QPatternist::ExternalVariableLoader::Ptr externalVariableLoader() const; |
107 | virtual QUrl contextItemSource() const; |
108 | virtual QXmlQuery::QueryLanguage language() const; |
109 | void setParent(TreeItem *const parent); |
110 | virtual QXmlName initialTemplateName() const; |
111 | |
112 | private: |
113 | QString m_name; |
114 | QString m_creator; |
115 | QString m_description; |
116 | QUrl m_queryPath; |
117 | bool m_isXPath; |
118 | QDate m_lastModified; |
119 | const Scenario m_scenario; |
120 | TreeItem * m_parent; |
121 | TestBaseLine::List m_baseLines; |
122 | QPatternist::ExternalVariableLoader::Ptr m_externalVariableLoader; |
123 | QUrl m_contextItemSource; |
124 | QXmlQuery::QueryLanguage m_lang; |
125 | QXmlName m_initialTemplateName; |
126 | }; |
127 | } |
128 | |
129 | QT_END_NAMESPACE |
130 | |
131 | #endif |
132 | // vim: et:ts=4:sw=4:sts=4 |
133 | |