author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Fri, 12 Mar 2010 15:46:37 +0200 | |
branch | RCL_3 |
changeset 5 | d3bac044e0f0 |
parent 4 | 3b1da2848fc7 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the autotests of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#ifndef PatternistSDK_XSDTSTestCase_H |
|
43 |
#define PatternistSDK_XSDTSTestCase_H |
|
44 |
||
45 |
#include <QDate> |
|
46 |
#include <QString> |
|
47 |
#include <QUrl> |
|
48 |
||
49 |
#include "TestBaseLine.h" |
|
50 |
#include "TestCase.h" |
|
51 |
||
52 |
QT_BEGIN_HEADER |
|
53 |
||
54 |
namespace QPatternistSDK |
|
55 |
{ |
|
56 |
/** |
|
57 |
* @short Represents a test case in a test suite in the XML Query Test Suite. |
|
58 |
* |
|
59 |
* TestCase is a memory representation of a test case, and maps |
|
60 |
* to the @c test-case element in the XQuery Test Suite test |
|
61 |
* case catalog. |
|
62 |
* |
|
63 |
* @ingroup PatternistSDK |
|
64 |
* @author Frans Englich <frans.englich@nokia.com> |
|
65 |
*/ |
|
66 |
class Q_PATTERNISTSDK_EXPORT XSDTSTestCase : public TestCase |
|
67 |
{ |
|
68 |
public: |
|
69 |
enum TestType |
|
70 |
{ |
|
71 |
SchemaTest, |
|
72 |
InstanceTest |
|
73 |
}; |
|
74 |
||
75 |
XSDTSTestCase(const Scenario scen, TreeItem *parent, TestType testType); |
|
76 |
virtual ~XSDTSTestCase(); |
|
77 |
||
78 |
/** |
|
79 |
* Executes the test, and returns the result. The returned list |
|
80 |
* will always contain exactly one TestResult. |
|
81 |
* |
|
82 |
* @p stage is ignored when running out-of-process. |
|
83 |
*/ |
|
84 |
virtual TestResult::List execute(const ExecutionStage stage, |
|
85 |
TestSuite *ts); |
|
86 |
/** |
|
87 |
* The identifier, the name of the test. For example, "Literals034". |
|
88 |
* The name of a test case must be unique. |
|
89 |
*/ |
|
90 |
virtual QString name() const; |
|
91 |
virtual QString creator() const; |
|
92 |
virtual QString description() const; |
|
93 |
/** |
|
94 |
* @returns the query inside the file, specified by testCasePath(). Loading |
|
95 |
* of the file is not cached in order to avoid complications. |
|
96 |
* @param ok is set to @c false if loading the query file fails |
|
97 |
*/ |
|
98 |
virtual QString sourceCode(bool &ok) const; |
|
99 |
virtual QUrl schemaUri() const; |
|
100 |
virtual QUrl instanceUri() const; |
|
101 |
virtual QUrl testCasePath() const {return QUrl();} |
|
102 |
virtual QDate lastModified() const; |
|
103 |
||
104 |
bool isXPath() const; |
|
105 |
||
106 |
/** |
|
107 |
* What kind of test case this is, what kind of scenario it takes part |
|
108 |
* of. For example, whether the test case should evaluate normally or fail. |
|
109 |
*/ |
|
110 |
Scenario scenario() const; |
|
111 |
||
112 |
void setCreator(const QString &creator); |
|
113 |
void setLastModified(const QDate &date); |
|
114 |
void setDescription(const QString &description); |
|
115 |
void setName(const QString &name); |
|
116 |
void setSchemaUri(const QUrl &uri); |
|
117 |
void setInstanceUri(const QUrl &uri); |
|
118 |
void setTestCasePath(const QUrl & /* uri */) {} |
|
119 |
void setContextItemSource(const QUrl &uri); |
|
120 |
void addBaseLine(TestBaseLine *lines); |
|
121 |
||
122 |
virtual TreeItem *parent() const; |
|
123 |
||
124 |
virtual QVariant data(const Qt::ItemDataRole role, int column) const; |
|
125 |
||
126 |
virtual QString title() const; |
|
127 |
virtual TestBaseLine::List baseLines() const; |
|
128 |
||
129 |
virtual int columnCount() const; |
|
130 |
||
131 |
virtual QUrl contextItemSource() const; |
|
132 |
void setParent(TreeItem *const parent); |
|
133 |
virtual QPatternist::ExternalVariableLoader::Ptr externalVariableLoader() const; |
|
134 |
virtual TestResult *testResult() const; |
|
135 |
virtual ResultSummary resultSummary() const; |
|
136 |
||
137 |
private: |
|
138 |
void executeSchemaTest(TestResult::Status &resultStatus, QString &serialized, QAbstractMessageHandler *handler); |
|
139 |
void executeInstanceTest(TestResult::Status &resultStatus, QString &serialized, QAbstractMessageHandler *handler); |
|
140 |
||
141 |
QString m_name; |
|
142 |
QString m_creator; |
|
143 |
QString m_description; |
|
144 |
QUrl m_schemaUri; |
|
145 |
QUrl m_instanceUri; |
|
146 |
QDate m_lastModified; |
|
147 |
const Scenario m_scenario; |
|
148 |
TreeItem * m_parent; |
|
149 |
TestBaseLine::List m_baseLines; |
|
150 |
QUrl m_contextItemSource; |
|
151 |
TestType m_testType; |
|
152 |
QPointer<TestResult> m_result; |
|
153 |
}; |
|
154 |
} |
|
155 |
||
156 |
QT_END_HEADER |
|
157 |
||
158 |
#endif |
|
159 |
// vim: et:ts=4:sw=4:sts=4 |