1 /****************************************************************************
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
6 ** This file is part of the autotests of the Qt Toolkit.
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.
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.
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.
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.
40 ****************************************************************************/
42 #ifndef PatternistSDK_XSDTestSuiteHandler_H
43 #define PatternistSDK_XSDTestSuiteHandler_H
46 #include <QXmlDefaultHandler>
48 #include "ExternalSourceLoader.h"
49 #include "TestSuite.h"
50 #include "XQTSTestCase.h"
55 namespace QPatternistSDK
62 * @short Creates a TestSuite from the XSD Test Suite.
64 * The created TestSuite can be retrieved via testSuite().
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
71 * @ingroup PatternistSDK
72 * @author Tobias Koenig <tobias.koenig@nokia.com>
74 class Q_PATTERNISTSDK_EXPORT XSDTestSuiteHandler : public QXmlDefaultHandler
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
84 XSDTestSuiteHandler(const QUrl &catalogFile);
85 virtual bool characters(const QString &ch);
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,
93 const QXmlAttributes &atts);
95 virtual TestSuite *testSuite() const;
99 const QUrl m_catalogFile;
101 TestGroup* m_topLevelGroup;
102 TestGroup* m_currentTestSet;
103 TestGroup* m_currentTestGroup;
104 XSDTSTestCase* m_currentTestCase;
106 bool m_inInstanceTest;
108 bool m_inDescription;
109 bool m_schemaBlacklisted;
110 QString m_documentation;
111 QString m_currentSchemaLink;
113 QSet<QString> m_blackList;
121 // vim: et:ts=4:sw=4:sts=4