symbianunittestui/qt/tabwidgettestrun.h
changeset 2 453d490c84a5
parent 1 753e33780645
child 3 6952856dc269
equal deleted inserted replaced
1:753e33780645 2:453d490c84a5
     1 /*
       
     2  * Copyright (c) 2010 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: widget class to run tests.
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef TABWIDGETTESTRUN_H_
       
    19 #define TABWIDGETTESTRUN_H_
       
    20 #include <QTabWidget>
       
    21 #include <QList>
       
    22 
       
    23 class QPushButton;
       
    24 class QWidget;
       
    25 class QTreeWidget;
       
    26 class QTableWidget;
       
    27 class QTreeWidgetItem;
       
    28 class QLabel;
       
    29 class WidgetTestRunner;
       
    30 class QProgressBar;
       
    31 class Settings;
       
    32 class TestItemList;
       
    33 class DialogMsg;
       
    34 
       
    35 class TabWidgetTestRun : public QTabWidget
       
    36     {
       
    37 Q_OBJECT
       
    38 
       
    39 public:
       
    40     TabWidgetTestRun(QWidget* parent = 0);
       
    41     virtual ~TabWidgetTestRun();
       
    42 
       
    43 protected slots:
       
    44     void addTests(QStringList testCases);
       
    45     void saveSettings(const Settings*);
       
    46     void changeCurrentTab(int index);
       
    47 
       
    48 private:
       
    49     void createTestsTab();
       
    50     void createExecutionTab();
       
    51     void load();
       
    52     void createTreeWidgetTests();
       
    53     void setTabPageTestsLayout();
       
    54     void createExecutionWidgets();
       
    55     void setTabPageExecutionLayout();
       
    56     void setupRunnerEventHandlers();
       
    57     void setupTestsTabEventHandlers();
       
    58     bool isAllCasesSelected();
       
    59     QString getFuncName(const QString& caseName);
       
    60     QString& removeMark(QString&);
       
    61     void resetTreeWidget();
       
    62     void resetTestItemList();
       
    63 
       
    64 signals:
       
    65     void testsAdded();
       
    66     void testRun();
       
    67     void currentTabChangedToTests(bool hasTests);
       
    68     void currentTabChangedToExecution();
       
    69     void selectedTestsChanged(bool, bool, bool);
       
    70 
       
    71 private slots:
       
    72     void setTotal(int num);
       
    73     void setPassed(int num);
       
    74     void setFailed(QString name, QString reason, int num);
       
    75     void runTests();
       
    76     void selectCurrentCase();
       
    77     void selectAllCases();
       
    78     void deselectCurrentCase();
       
    79     void deselectAllCases();
       
    80     void selectDeselectTestCases(QTreeWidgetItem* item, int column);
       
    81     void changeCurItem(QTreeWidgetItem*, QTreeWidgetItem*);
       
    82     void deselectCase(QTreeWidgetItem* item, int column);
       
    83     void setBtnExpandCollapseEnabled(QTreeWidgetItem*);
       
    84     void expandCollapseItem();
       
    85     
       
    86     // Key press event received
       
    87     void pressLeftArrow();
       
    88     void pressRightArrow();
       
    89     void pressUpArrow();
       
    90     void pressDownArrow();
       
    91     void pressEnter();
       
    92 
       
    93 private:
       
    94     // Widgets on "test cases" tab
       
    95     QPushButton*    btnRun;
       
    96     QPushButton*    btnExpandCollapse;
       
    97     QTreeWidget*    treeWdgtTests;
       
    98     QWidget*        tabTests;
       
    99 
       
   100     // Widgets on "execution" tab
       
   101     QWidget*        tabRunner;
       
   102     QTableWidget*   tblWdgtErrorSummary;
       
   103     QProgressBar*   progressBarExecuting;
       
   104     QLabel*         labelTotal;
       
   105     QLabel*         labelPassed;
       
   106     QLabel*         labelFailed;
       
   107     QLabel*         labelErrorSummary;
       
   108 
       
   109     // Test runner widget
       
   110     WidgetTestRunner* testRunner;
       
   111     
       
   112     // Test cases    
       
   113     TestItemList* listTestItems;
       
   114     TestItemList* listSelectedTestItems;
       
   115     
       
   116     // Error msg dialog
       
   117     DialogMsg* dlgErrMsg;
       
   118     };
       
   119 
       
   120 #endif /* TABWIDGETTESTRUN_H_ */