tests/auto/xmlpatternssdk/XQTSTestCase.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 test suite 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_XQTSTestCase_H
       
    43 #define PatternistSDK_XQTSTestCase_H
       
    44 
       
    45 #include <QDate>
       
    46 #include <QString>
       
    47 #include <QUrl>
       
    48 
       
    49 #include "qexternalvariableloader_p.h"
       
    50 
       
    51 #include "TestBaseLine.h"
       
    52 #include "TestCase.h"
       
    53 
       
    54 QT_BEGIN_HEADER
       
    55 
       
    56 QT_BEGIN_NAMESPACE
       
    57 
       
    58 namespace QPatternistSDK
       
    59 {
       
    60     /**
       
    61      * @short Represents a test case in a test suite in the XML Query Test Suite.
       
    62      *
       
    63      * TestCase is a memory representation of a test case, and maps
       
    64      * to the @c test-case element in the XQuery Test Suite test
       
    65      * case catalog.
       
    66      *
       
    67      * @ingroup PatternistSDK
       
    68      * @author Frans Englich <frans.englich@nokia.com>
       
    69      */
       
    70     class Q_PATTERNISTSDK_EXPORT XQTSTestCase : public TestCase
       
    71     {
       
    72     public:
       
    73         XQTSTestCase(const Scenario scen, TreeItem *parent,
       
    74                      const QXmlQuery::QueryLanguage lang = QXmlQuery::XQuery10);
       
    75         virtual ~XQTSTestCase();
       
    76 
       
    77         /**
       
    78          * The identifier, the name of the test. For example, "Literals034".
       
    79          * The name of a test case must be unique.
       
    80          */
       
    81         virtual QString name() const;
       
    82         virtual QString creator() const;
       
    83         virtual QString description() const;
       
    84         /**
       
    85          * @returns the query inside the file, specified by testCasePath(). Loading
       
    86          * of the file is not cached in order to avoid complications.
       
    87          * @param ok is set to @c false if loading the query file fails
       
    88          */
       
    89         virtual QString sourceCode(bool &ok) const;
       
    90         virtual QUrl testCasePath() const;
       
    91         virtual QDate lastModified() const;
       
    92 
       
    93         bool isXPath() const;
       
    94 
       
    95         /**
       
    96          * What kind of test case this is, what kind of scenario it takes part
       
    97          * of. For example, whether the test case should evaluate normally or fail.
       
    98          */
       
    99         Scenario scenario() const;
       
   100 
       
   101         void setCreator(const QString &creator);
       
   102         void setLastModified(const QDate &date);
       
   103         void setDescription(const QString &description);
       
   104         void setIsXPath(const bool isXPath);
       
   105         void setName(const QString &name);
       
   106         void setQueryPath(const QUrl &uri);
       
   107         void setContextItemSource(const QUrl &uri);
       
   108         void addBaseLine(TestBaseLine *lines);
       
   109         void setInitialTemplateName(const QXmlName &name);
       
   110 
       
   111         virtual TreeItem *parent() const;
       
   112 
       
   113         virtual QVariant data(const Qt::ItemDataRole role, int column) const;
       
   114 
       
   115         virtual QString title() const;
       
   116         virtual TestBaseLine::List baseLines() const;
       
   117 
       
   118         virtual int columnCount() const;
       
   119 
       
   120         void setExternalVariableLoader(const QPatternist::ExternalVariableLoader::Ptr &loader);
       
   121         virtual QPatternist::ExternalVariableLoader::Ptr externalVariableLoader() const;
       
   122         virtual QUrl contextItemSource() const;
       
   123         virtual QXmlQuery::QueryLanguage language() const;
       
   124         void setParent(TreeItem *const parent);
       
   125         virtual QXmlName initialTemplateName() const;
       
   126 
       
   127     private:
       
   128         QString                                     m_name;
       
   129         QString                                     m_creator;
       
   130         QString                                     m_description;
       
   131         QUrl                                        m_queryPath;
       
   132         bool                                        m_isXPath;
       
   133         QDate                                       m_lastModified;
       
   134         const Scenario                              m_scenario;
       
   135         TreeItem *                                  m_parent;
       
   136         TestBaseLine::List                          m_baseLines;
       
   137         QPatternist::ExternalVariableLoader::Ptr    m_externalVariableLoader;
       
   138         QUrl                                        m_contextItemSource;
       
   139         QXmlQuery::QueryLanguage                    m_lang;
       
   140         QXmlName                                    m_initialTemplateName;
       
   141     };
       
   142 }
       
   143 
       
   144 QT_END_NAMESPACE
       
   145 
       
   146 QT_END_HEADER
       
   147 
       
   148 #endif
       
   149 // vim: et:ts=4:sw=4:sts=4