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 autotests 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_XSDTestSuiteHandler_H |
30 | #define PatternistSDK_XSDTestSuiteHandler_H |
31 | |
32 | #include <QUrl> |
33 | |
34 | #include "ExternalSourceLoader.h" |
35 | #include "TestSuite.h" |
36 | #include "XmlParseHelper.h" |
37 | #include "XQTSTestCase.h" |
38 | |
39 | QT_BEGIN_NAMESPACE |
40 | |
41 | namespace QPatternistSDK |
42 | { |
43 | class TestBaseLine; |
44 | class TestGroup; |
45 | class XSDTSTestCase; |
46 | |
47 | /** |
48 | * @short Creates a TestSuite from the XSD Test Suite. |
49 | * |
50 | * The created TestSuite can be retrieved via testSuite(). |
51 | * |
52 | * @note XSDTestSuiteHandler assumes the XML is valid by having been validated |
53 | * against the W3C XML Schema. It has no safety checks for that the XML format |
54 | * is correct but is hard coded for it. Thus, the behavior is undefined if |
55 | * the XML is invalid. |
56 | * |
57 | * @ingroup PatternistSDK |
58 | * @author Tobias Koenig <tobias.koenig@nokia.com> |
59 | */ |
60 | class XSDTestSuiteHandler : public XmlParseHelper |
61 | { |
62 | public: |
63 | /** |
64 | * @param catalogFile the URI for the catalog file being parsed. This |
65 | * URI is used for creating absolute URIs for files mentioned in |
66 | * the catalog with relative URIs. |
67 | * @param useExclusionList whether excludeTestGroups.txt should be used to ignore |
68 | * test groups when loading |
69 | */ |
70 | XSDTestSuiteHandler(const QUrl &catalogFile); |
71 | bool characters(const QStringRef &ch) override; |
72 | |
73 | bool endElement(const QStringRef &namespaceURI, const QStringRef &localName, |
74 | const QStringRef &qName) override; |
75 | bool startElement(const QStringRef &namespaceURI, const QStringRef &localName, |
76 | const QStringRef &qName, const QXmlStreamAttributes &atts) override; |
77 | |
78 | TestSuite *testSuite() const; |
79 | |
80 | private: |
81 | TestSuite* m_ts; |
82 | const QUrl m_catalogFile; |
83 | |
84 | TestGroup* m_topLevelGroup; |
85 | TestGroup* m_currentTestSet; |
86 | TestGroup* m_currentTestGroup; |
87 | XSDTSTestCase* m_currentTestCase; |
88 | bool m_inSchemaTest; |
89 | bool m_inInstanceTest; |
90 | bool m_inTestGroup; |
91 | bool m_inDescription; |
92 | bool m_schemaBlacklisted; |
93 | QString m_documentation; |
94 | QString m_currentSchemaLink; |
95 | int m_counter; |
96 | QSet<QString> m_blackList; |
97 | }; |
98 | } |
99 | |
100 | QT_END_NAMESPACE |
101 | |
102 | #endif |
103 | // vim: et:ts=4:sw=4:sts=4 |
104 | |