5c9a97aabc321ba4d4a05fcd89a956e13af7774e
[profile/ivi/qtxmlpatterns.git] / tests / auto / xmlpatternssdk / XSDTestSuiteHandler.h
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
5 **
6 ** This file is part of the autotests of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** GNU Lesser General Public License Usage
10 ** This file may be used under the terms of the GNU Lesser General Public
11 ** License version 2.1 as published by the Free Software Foundation and
12 ** appearing in the file LICENSE.LGPL included in the packaging of this
13 ** file. Please review the following information to ensure the GNU Lesser
14 ** General Public License version 2.1 requirements will be met:
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
16 **
17 ** In addition, as a special exception, Nokia gives you certain additional
18 ** rights. These rights are described in the Nokia Qt LGPL Exception
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
20 **
21 ** GNU General Public License Usage
22 ** Alternatively, this file may be used under the terms of the GNU General
23 ** Public License version 3.0 as published by the Free Software Foundation
24 ** and appearing in the file LICENSE.GPL included in the packaging of this
25 ** file. Please review the following information to ensure the GNU General
26 ** Public License version 3.0 requirements will be met:
27 ** http://www.gnu.org/copyleft/gpl.html.
28 **
29 ** Other Usage
30 ** Alternatively, this file may be used in accordance with the terms and
31 ** conditions contained in a signed written agreement between you and Nokia.
32 **
33 **
34 **
35 **
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41
42 #ifndef PatternistSDK_XSDTestSuiteHandler_H
43 #define PatternistSDK_XSDTestSuiteHandler_H
44
45 #include <QUrl>
46 #include <QXmlDefaultHandler>
47
48 #include "ExternalSourceLoader.h"
49 #include "TestSuite.h"
50 #include "XQTSTestCase.h"
51
52 QT_BEGIN_HEADER
53 QT_BEGIN_NAMESPACE
54
55 namespace QPatternistSDK
56 {
57     class TestBaseLine;
58     class TestGroup;
59     class XSDTSTestCase;
60
61     /**
62      * @short Creates a TestSuite from the XSD Test Suite.
63      *
64      * The created TestSuite can be retrieved via testSuite().
65      *
66      * @note XSDTestSuiteHandler assumes the XML is valid by having been validated
67      * against the W3C XML Schema. It has no safety checks for that the XML format
68      * is correct but is hard coded for it. Thus, the behavior is undefined if
69      * the XML is invalid.
70      *
71      * @ingroup PatternistSDK
72      * @author Tobias Koenig <tobias.koenig@nokia.com>
73      */
74     class Q_PATTERNISTSDK_EXPORT XSDTestSuiteHandler : public QXmlDefaultHandler
75     {
76     public:
77         /**
78          * @param catalogFile the URI for the catalog file being parsed. This
79          * URI is used for creating absolute URIs for files mentioned in
80          * the catalog with relative URIs.
81          * @param useExclusionList whether excludeTestGroups.txt should be used to ignore
82          * test groups when loading
83          */
84         XSDTestSuiteHandler(const QUrl &catalogFile);
85         virtual bool characters(const QString &ch);
86
87         virtual bool endElement(const QString &namespaceURI,
88                                 const QString &localName,
89                                 const QString &qName);
90         virtual bool startElement(const QString &namespaceURI,
91                                   const QString &localName,
92                                   const QString &qName,
93                                   const QXmlAttributes &atts);
94
95         virtual TestSuite *testSuite() const;
96
97     private:
98         TestSuite* m_ts;
99         const QUrl m_catalogFile;
100
101         TestGroup* m_topLevelGroup;
102         TestGroup* m_currentTestSet;
103         TestGroup* m_currentTestGroup;
104         XSDTSTestCase* m_currentTestCase;
105         bool m_inSchemaTest;
106         bool m_inInstanceTest;
107         bool m_inTestGroup;
108         bool m_inDescription;
109         bool m_schemaBlacklisted;
110         QString m_documentation;
111         QString m_currentSchemaLink;
112         int m_counter;
113         QSet<QString> m_blackList;
114     };
115 }
116
117 QT_END_NAMESPACE
118 QT_END_HEADER
119
120 #endif
121 // vim: et:ts=4:sw=4:sts=4