phonebookui/cnthistorymodel/tsrc/mt_cnthistorymodel/testrunner.h
changeset 81 640d30f4fb64
parent 77 c18f9fa7f42e
child 84 63017c97b1d6
equal deleted inserted replaced
77:c18f9fa7f42e 81:640d30f4fb64
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef TESTRUNNER_H
       
    19 #define TESTRUNNER_H
       
    20 
       
    21 #include <QXmlDefaultHandler>
       
    22 #include <QObject>
       
    23 #include <HbApplication>
       
    24 
       
    25 class Starter : public QObject
       
    26 {
       
    27     Q_OBJECT
       
    28 public:
       
    29     Starter( HbApplication& aApp );
       
    30     ~Starter();
       
    31     
       
    32     bool eventFilter( QObject* aObject, QEvent* aEvent );
       
    33         
       
    34 private:
       
    35     HbApplication& mApp;
       
    36     bool mTestStarted;
       
    37 };
       
    38 
       
    39 class TestRunner : public QXmlDefaultHandler
       
    40 {
       
    41     
       
    42 public: // Constructors and destructor
       
    43     TestRunner(const QString& name);
       
    44     ~TestRunner();
       
    45        
       
    46 public: // New functions
       
    47     
       
    48     int runTests(QObject& testObject);
       
    49     void printResults();
       
    50     
       
    51 protected: // From QXmlContentHandler 
       
    52     bool startElement(
       
    53         const QString& namespaceURI,
       
    54         const QString& localName,
       
    55         const QString& qName,
       
    56         const QXmlAttributes& atts);
       
    57     
       
    58     bool endElement(
       
    59         const QString& namespaceURI,
       
    60         const QString& localName,
       
    61         const QString& qName);
       
    62     
       
    63     bool characters(const QString& ch);
       
    64 
       
    65 private: // New functions
       
    66     void parse(const QString& fileName);
       
    67 
       
    68 private: // Data
       
    69     QStringList mTestRunParams;
       
    70     QString mHomeDir;
       
    71     int mTestCount;
       
    72     QStringList mErrors;
       
    73     bool mParsingIncidentElement;
       
    74     bool mParsingDescriptionElement;
       
    75     bool mCurrentTestFailed;
       
    76     QString mCurrentTestName;
       
    77     QString mCurrentTestFile;
       
    78     int mCurrentTestFailureLine;
       
    79     
       
    80     QList<QObject> mTests;
       
    81 };
       
    82 
       
    83 
       
    84 #endif // TESTRUNNER_H