tests/auto/xmlpatternssdk/XSDTestSuiteHandler.h
branchRCL_3
changeset 7 3f74d0d4af4c
equal deleted inserted replaced
6:dee5afe5301f 7:3f74d0d4af4c
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     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_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