# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1270069249 -10800 # Node ID cfe32394fcd5c47f1d399120f5db2cc28efa03df # Parent 8a14024f954ad6728e73e08d3995b7c3119a9a11 Revision: 201011 Kit: 201013 diff -r 8a14024f954a -r cfe32394fcd5 stif/QtUI/StifQtUI/STIFQtUI.pro --- a/stif/QtUI/StifQtUI/STIFQtUI.pro Mon Mar 15 12:46:13 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -HEADERS += version.h \ - frmmain.h \ - istfqtuicontroller.h \ - stfqtuicontroller.h \ - cstfcase.h \ - cstfmodule.h \ - istfqtuimodel.h \ - stfqtuimodel.h \ - dlgoutput.h \ - uisetting.h \ - dlgsetting.h -SOURCES += frmmain.cpp \ - main.cpp \ - stfqtuimodel.cpp \ - stfqtuicontroller.cpp \ - dlgoutput.cpp \ - uisetting.cpp \ - dlgsetting.cpp -RESOURCES += -symbian { - TARGET.UID3 = 0x2002BCA0 - TARGET.EPOCALLOWDLLDATA = 1 - HEADERS += ../../../inc/. - INCLUDEPATH += /epoc32/include/mw - INCLUDEPATH += /epoc32/include/platform - INCLUDEPATH += /epoc32/include/platform/stifinternal - INCLUDEPATH += /epoc32/include/domain/osextensions - INCLUDEPATH += /epoc32/include/domain/osextensions/stif - HEADERS += stifexecutor.h - SOURCES += stifexecutor.cpp - LIBS += -leuser \ - -lefsrv \ - -lstiftestinterface \ - -lstiftfwif \ - -lstiftestengine \ - -lecons \ - -lhal \ - -lflogger - TARGET.CAPABILITY = AllFiles \ - CommDD - - # Export headers to SDK Epoc32/include directory - deploy.path = $$EPOCROOT - exportheaders.sources = $$PUBLIC_HEADERS - exportheaders.path = epoc32/include - for(header, exportheaders.sources) - :BLD_INF_RULES.prj_exports += "$$header $$deploy.path$$exportheaders.path/$$basename(header)" -} diff -r 8a14024f954a -r cfe32394fcd5 stif/QtUI/StifQtUI/StifQtUI.pkg --- a/stif/QtUI/StifQtUI/StifQtUI.pkg Mon Mar 15 12:46:13 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -; StfQtUI_template.pkg generated by qmake at 2010-02-08T13:37:27 -; This file is generated by qmake and should not be modified by the user -; - -; Language -&EN - -; SIS header: name, uid, version -#{"StifQtUI"},(0x2002BCA0),1,0,0 - -; Localised Vendor name -%{"Vendor"} - -; Unique Vendor name -:"Vendor" - -; Manual PKG pre-rules from PRO files -; Default HW/platform dependencies -[0x101F7961],0,0,0,{"S60ProductID"} -[0x102032BE],0,0,0,{"S60ProductID"} -[0x102752AE],0,0,0,{"S60ProductID"} -[0x1028315F],0,0,0,{"S60ProductID"} - -; Default dependency to Qt libraries -(0x2001E61C), 4, 6, 1, {"Qt"} - -; Executable and default resource files -"/epoc32/release/armv5/urel/StifQtUI.exe" - "!:\sys\bin\StifQtUI.exe" -"/epoc32/data/z/resource/apps/StfQtUI.rsc" - "!:\resource\apps\StfQtUI.rsc" -"/epoc32/data/z/private/10003a3f/import/apps/StfQtUI_reg.rsc" - "!:\private\10003a3f\import\apps\StfQtUI_reg.rsc" - -; Manual PKG post-rules from PRO files diff -r 8a14024f954a -r cfe32394fcd5 stif/QtUI/StifQtUI/cstfcase.h --- a/stif/QtUI/StifQtUI/cstfcase.h Mon Mar 15 12:46:13 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: QT C++ based Class. -* CSTFCase used to describe a test case. -* -*/ -#ifndef CSTFCASE_H -#define CSTFCASE_H -#include "QString" - -enum TSTFCaseRunningType - { - Sequentially = 0, - Parallel - }; - -enum TSTFCaseStatusType - { - EStatusRunning = 0x00000001, - EStatusExecuted = 0x00000002, - EStatusPassed = 0x00000004, - EStatusFailed = 0x00000008, - EStatusAborted = 0x00000010, - EStatusCrashed = 0x00000020, - EStatusAll = 0x000000ff, - }; - -class CSTFCase -{ -public: - CSTFCase() {isActive = true; caseIndex=-1;} - CSTFCase(QString name, int index) {caseName = name; caseIndex = index; isActive = true;} - -public: - QString& Name(){return caseName;} - int Index(){return caseIndex;} - bool IsActive(){return isActive;} - QString& ModuleName() {return moduleName;} - -public: - void SetName(const QString name){caseName = name; } - void SetIndex(const int index){caseIndex = index;} - void SetActive(const bool active) {isActive = active;} - void SetModuleName(const QString name){moduleName = name;} - -private: - QString caseName; - int caseIndex; - bool isActive; - QString moduleName; -}; -#endif // CSTFCASE_H diff -r 8a14024f954a -r cfe32394fcd5 stif/QtUI/StifQtUI/cstfmodule.h --- a/stif/QtUI/StifQtUI/cstfmodule.h Mon Mar 15 12:46:13 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: QT C++ based Class. -* CSTFModule used to describe a test module. -* -*/ -#ifndef CSTFMODULE_H -#define CSTFMODULE_H -#include "QString" - -class CSTFModule -{ -public: - CSTFModule(){isActive = true;} - CSTFModule(QString name, QString inifile, QString cfgfile) - {moduleName = name; iniFile = inifile; configFile = cfgfile; isActive = true;} - -public: - QString& Name(){return moduleName;} - QString& IniFile(){return iniFile;} - QString& ConfigFile(){return configFile;} - bool IsActive(){return isActive;} - - -public: - void SetName(const QString& name){moduleName = name; } - void SetIniFile(const QString& inifile){iniFile = inifile;} - void SetConfigFile(const QString& cfgfile){configFile = cfgfile;} - void SetActive(const bool active) {isActive = active;} - -private: - QString moduleName; - QString iniFile; - QString configFile; - bool isActive; - - -}; -#endif // CSTFMODULE_H diff -r 8a14024f954a -r cfe32394fcd5 stif/QtUI/StifQtUI/dlgoutput.cpp --- a/stif/QtUI/StifQtUI/dlgoutput.cpp Mon Mar 15 12:46:13 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,122 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: QT C++ based Class. - * - */ -#include "dlgoutput.h" -#include - -DlgOutput::DlgOutput(IStfQtUIController* ctl, QWidget *parent) : - QDialog(parent), controller(ctl) - { - QSize btnSize(100,30); - QGridLayout *mainLayout = new QGridLayout(this); - this->setLayout(mainLayout); - this->setContextMenuPolicy(Qt::NoContextMenu); - - tabMain = new QTabWidget(); - tabMain->setContextMenuPolicy(Qt::NoContextMenu); - - QWidget *toolWidget = new QWidget(this); - toolWidget->setContextMenuPolicy(Qt::NoContextMenu); - QGridLayout *toolLayout = new QGridLayout(); - toolWidget->setLayout(toolLayout); - btnPause = new QPushButton(tr("Pause"), toolWidget); - btnPause->setContextMenuPolicy(Qt::NoContextMenu); - btnPause->setFixedSize(btnSize); - QObject::connect(btnPause, SIGNAL(clicked()), this, - SLOT(on_btnPause_clicked())); - btnAbort = new QPushButton(tr("Abort"), toolWidget); - btnAbort->setContextMenuPolicy(Qt::NoContextMenu); - btnAbort->setFixedSize(btnSize); - QObject::connect(btnAbort, SIGNAL(clicked()), this, - SLOT(on_btnAbort_clicked())); - toolLayout->addWidget(btnPause, 0, 0); - toolLayout->addWidget(btnAbort, 0, 1); - - mainLayout->addWidget(toolWidget, 0, 0); - mainLayout->addWidget(tabMain, 1, 0); - controller->AddStfEventListener(this); - } - -DlgOutput::~DlgOutput() - { - controller->RemoveStfEventListener(this); - } - -void DlgOutput::CreateItem(QString index, QString item) - { - QPlainTextEdit* edit = new QPlainTextEdit(this); - edit->setContextMenuPolicy(Qt::NoContextMenu); - tabMain->addTab(edit, item); - tabList.insert(index, edit); - } - -void DlgOutput::CloseItem(QString index) - { - int u = tabList.keys().indexOf(index); - tabList.remove(index); - tabMain->removeTab(u); - if (tabMain->count() == 0) - { - this->close(); - } - } - -void DlgOutput::ShowMessage(QString index, QString msg) - { - if(tabList.contains(index)) - { - tabList.value(index)->setPlainText(msg); - } - } - -void DlgOutput::on_btnPause_clicked() - { - if (btnPause->text() == "Pause") - { - controller->PauseCase(); - btnPause->setText(tr("Resume")); - } - else - { - controller->ResumeCase(); - btnPause->setText(tr("Pause")); - } - } - -void DlgOutput::on_btnAbort_clicked() - { - controller->AbortCase(); - } - -void DlgOutput::OnCaseOutputChanged(const IStfEventListener::CaseOutputCommand& cmd, - const QString& index, const QString& msg) - { - this->showMaximized(); - switch (cmd) - { - case IStfEventListener::ECreate: - CreateItem(index, msg); - break; - case IStfEventListener::EClose: - CloseItem(index); - break; - default: - ShowMessage(index, msg); - break; - } - - } - diff -r 8a14024f954a -r cfe32394fcd5 stif/QtUI/StifQtUI/dlgoutput.h --- a/stif/QtUI/StifQtUI/dlgoutput.h Mon Mar 15 12:46:13 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: QT C++ based Class. -* DlgOutput is a QT based dialog. -* Used to display case execution output and control the test case (pause/resume/abort). -* -*/ -#ifndef DLGOUTPUT_H_ -#define DLGOUTPUT_H_ - -#include -#include -#include "istfqtuicontroller.h" - - -QT_BEGIN_NAMESPACE -class QTabWidget; -class QGridLayout; -class QPlainTextEdit; -class QPushButton; -QT_END_NAMESPACE - -class DlgOutput : public QDialog, public IStfEventListener { - Q_OBJECT - -public: - DlgOutput(IStfQtUIController* ctl, QWidget *parent = 0); - ~DlgOutput(); - -private: - void CreateItem(QString index, QString item); - void CloseItem(QString index); - void ShowMessage(QString index, QString msg); - -private://implement IStfEventListener - void OnGetMessage(const QString& ){}; - void OnSetListChanged(){}; - void OnCaseOutputChanged(const IStfEventListener::CaseOutputCommand& cmd, const QString& index, const QString& msg); - -private slots: - void on_btnPause_clicked(); - void on_btnAbort_clicked(); - - -private: - IStfQtUIController* controller; - QTabWidget* tabMain; - QPushButton* btnPause; - QPushButton* btnAbort; - QHash tabList; - -private: - void on_btnClose_clicked(); - - -}; - - -#endif /* DLGOUTPUT_H_ */ diff -r 8a14024f954a -r cfe32394fcd5 stif/QtUI/StifQtUI/dlgsetting.cpp --- a/stif/QtUI/StifQtUI/dlgsetting.cpp Mon Mar 15 12:46:13 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -/* - * dlgsetting.cpp - * - * Created on: 2010-2-8 - * Author: y183zhan - */ - -#include "dlgsetting.h" -#include - -DlgSetting::DlgSetting(UiSetting* settingObj, QWidget *parent) - : QDialog(parent), setting(settingObj) - { - SetupUI(); - } - -void DlgSetting::SetupUI() - { - this->setContextMenuPolicy(Qt::NoContextMenu); - QGridLayout *mainLayout = new QGridLayout(this); - this->setLayout(mainLayout); - - chkShowoutput = new QCheckBox(this); - chkShowoutput->setText(tr("Show output in execution.")); - chkShowoutput->setChecked(setting->ReadSetting("showoutput") == "true"); - - QWidget *toolWidget = new QWidget(this); - QGridLayout *toolLayout = new QGridLayout(); - - toolWidget->setLayout(toolLayout); - btnOk = new QPushButton(tr("Ok"), toolWidget); - btnOk->setFixedSize(100, 30); - QObject::connect(btnOk, SIGNAL(clicked()), this, - SLOT(on_btnOk_clicked())); - btnCancel = new QPushButton(tr("Cancel"), toolWidget); - btnCancel->setFixedSize(100, 30); - QObject::connect(btnCancel, SIGNAL(clicked()), this, - SLOT(on_btnCancel_clicked())); - toolLayout->addWidget(btnOk, 0, 0); - toolLayout->addWidget(btnCancel, 0, 1); - - mainLayout->addWidget(chkShowoutput, 0, 0); - mainLayout->addWidget(toolWidget, 2, 0); - } - -void DlgSetting::on_btnOk_clicked() - { - if(chkShowoutput->checkState() == Qt::Checked) - { - setting->SetSetting("showoutput", "true"); - } - else - { - setting->SetSetting("showoutput", "false"); - } - this->accept(); - } - -void DlgSetting::on_btnCancel_clicked() - { - this->reject(); - } diff -r 8a14024f954a -r cfe32394fcd5 stif/QtUI/StifQtUI/dlgsetting.h --- a/stif/QtUI/StifQtUI/dlgsetting.h Mon Mar 15 12:46:13 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* - * dlgsetting.h - * - * Created on: 2010-2-8 - * Author: y183zhan - */ - -#ifndef DLGSETTING_H_ -#define DLGSETTING_H_ -#include -#include "uisetting.h" - - -QT_BEGIN_NAMESPACE -class QTabWidget; -class QGridLayout; -class QCheckBox; -class QPushButton; -QT_END_NAMESPACE - -class DlgSetting : public QDialog { - Q_OBJECT - -public: - DlgSetting(UiSetting* settingObj, QWidget *parent = 0); - -private: - void SetupUI(); - -private: - QPushButton* btnOk; - QPushButton* btnCancel; - QCheckBox* chkShowoutput; - -private slots: - void on_btnOk_clicked(); - void on_btnCancel_clicked(); - -private: - UiSetting* setting; - - }; - -#endif /* DLGSETTING_H_ */ diff -r 8a14024f954a -r cfe32394fcd5 stif/QtUI/StifQtUI/frmmain.cpp --- a/stif/QtUI/StifQtUI/frmmain.cpp Mon Mar 15 12:46:13 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,809 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: QT C++ based Class. - * - */ -#include -#include "frmmain.h" -#include "stfqtuicontroller.h" -#include "stfqtuimodel.h" -#include -#include "version.h" -#include - -const QString SELECTITEMHEADER = " * "; -const QString UNSELECTITEMHEADER = " "; - -frmMain::frmMain() - { - uiSetting = new UiSetting(); - createMenus(); - load(); - LoadSubMenu(); - model = new StfQtUIModel(); - model->AddStifModelEventListener(this); - controller = new StfQtUIController(model); - controller->AddStfEventListener(this); - loadContent(); - dlgOutput = new DlgOutput(controller); - setSetting(); - } - -frmMain::~frmMain() - { - model->AbortCase(); - controller->RemoveStfEventListener(this); - model->RemoveStifModelEventListener(this); - - delete uiSetting; - delete dlgOutput; - delete controller; - delete model; - } - -void frmMain::setSetting() - { - controller->SetShowOutput(uiSetting->ReadSetting("showoutput") == "true"); - } - -void frmMain::OnGetMessage(const QString& aMessage) - { - txtOutput->appendPlainText(aMessage); - } - -void frmMain::OnRunningCaseChanged() - { - QList caseList = controller->GetCasesByStatus(EStatusRunning); - lstStartedCases->clear(); - foreach(CSTFCase aCase, caseList) - { - lstStartedCases->addItem(aCase.Name()); - } - if (caseList.size() != 0) - { - btnPauseCase->setEnabled(true); - btnAbortCase->setEnabled(true); - actPause->setEnabled(true); - actAbort->setEnabled(true); - } - else - { - btnPauseCase->setEnabled(false); - btnAbortCase->setEnabled(false); - actPause->setEnabled(false); - actAbort->setEnabled(false); - } - } - -void frmMain::OnCaseOutputChanged(const IStfEventListener::CaseOutputCommand& /*cmd*/, const QString& /*index*/, const QString& /*msg*/) - { - //nothing to do. - } - -void frmMain::OnSetListChanged() - { - loadSetList(); - } - -void frmMain::OnCaseStatisticChanged() - { - loadStatistic(); - } - -void frmMain::createMenus() - { - //operateMenu = menuBar()->addMenu(tr("&Operation")); - actAbout = new QAction(tr("&About"), this); - connect(actAbout, SIGNAL(triggered()), this, - SLOT(on_actAbout_triggered())); - - actExit = new QAction(tr("&Exit"), this); - connect(actExit, SIGNAL(triggered()), this, SLOT(close())); - - actOpenFile = new QAction(tr("&Open Ini File"), this); - connect(actOpenFile, SIGNAL(triggered()), this, - SLOT(on_actOpenFile_triggered())); - - actRunCaseSeq = new QAction(tr("Run Case Sequentially"), this); - connect(actRunCaseSeq, SIGNAL(triggered()), this, - SLOT(on_actRunCaseSeq_triggered())); - - actRunCasePar = new QAction(tr("Run Case Parallel"), this); - connect(actRunCasePar, SIGNAL(triggered()), this, - SLOT(on_actRunCasePar_triggered())); - - actAddtoSet = new QAction(tr("Add cases to Set"), this); - connect(actAddtoSet, SIGNAL(triggered()), this, - SLOT(on_actAddtoSet_triggered())); - - actSelectAll = new QAction(tr("Select All"), this); - connect(actSelectAll, SIGNAL(triggered()), this, - SLOT(on_actSelectAll_triggered())); - - actExpandAll = new QAction(tr("Expand All"), this); - connect(actExpandAll, SIGNAL(triggered()), this, - SLOT(on_actExpandAll_triggered())); - - actCollapseAll = new QAction(tr("Collapse All"), this); - connect(actCollapseAll, SIGNAL(triggered()), this, - SLOT(on_actCollapseAll_triggered())); - - actSetting = new QAction(tr("Setting"), this); - connect(actSetting, SIGNAL(triggered()), this, - SLOT(on_actSetting_triggered())); - - actRunSetSeq = new QAction(tr("Run Set Sequentially"), this); - connect(actRunSetSeq, SIGNAL(triggered()), this, - SLOT(on_actRunSetSeq_triggered())); - - actRunSetPar = new QAction(tr("Run Set Parallel"), this); - connect(actRunSetPar, SIGNAL(triggered()), this, - SLOT(on_actRunSetPar_triggered())); - - actNewSet = new QAction(tr("Create New Set"), this); - connect(actNewSet, SIGNAL(triggered()), this, - SLOT(on_actNewSet_triggered())); - - actDelSet = new QAction(tr("Delete Set"), this); - connect(actDelSet, SIGNAL(triggered()), this, - SLOT(on_actDelSet_triggered())); - - actPause = new QAction(tr("Pause"), this); - actPause->setEnabled(false); - connect(actPause, SIGNAL(triggered()), this, - SLOT(on_actPause_triggered())); - - actAbort = new QAction(tr("Abort"), this); - actAbort->setEnabled(false); - connect(actAbort, SIGNAL(triggered()), this, - SLOT(on_actAbort_triggered())); - - actClearStatistics = new QAction(tr("Clear Statistics"), this); - connect(actClearStatistics, SIGNAL(triggered()), this, - SLOT(on_actClearStatistics_triggered())); - - } - -void frmMain::load() - { - this->setContextMenuPolicy(Qt::NoContextMenu); - QSize btnSize(100,35); - QGridLayout *mainLayout = new QGridLayout(this); - mainLayout->setVerticalSpacing(2); - mainLayout->setHorizontalSpacing(2); - mainLayout->setSpacing(2); - mainLayout->setMargin(2); - - MainWidget = new QWidget(this); - MainWidget->setContextMenuPolicy(Qt::NoContextMenu); - - //tab control - tabWidget = new QTabWidget(this); - tabWidget->setContextMenuPolicy(Qt::NoContextMenu); - tabCase = new QWidget(tabWidget); - tabCase->setContextMenuPolicy(Qt::NoContextMenu); - tabWidget->addTab(tabCase, tr("Cases")); - tabSet = new QWidget(tabWidget); - tabSet->setContextMenuPolicy(Qt::NoContextMenu); - tabWidget->addTab(tabSet, tr(" Set ")); - tabStarted = new QWidget(tabWidget); - tabStarted->setContextMenuPolicy(Qt::NoContextMenu); - tabWidget->addTab(tabStarted, tr("Running")); - tabStatistic = new QWidget(tabWidget); - tabStatistic->setContextMenuPolicy(Qt::NoContextMenu); - tabWidget->addTab(tabStatistic, tr("Statistics")); - connect(tabWidget, SIGNAL(currentChanged(int)), this, - SLOT(onTabWidgetSelectIndexChanged())); - - //output panel - QGroupBox *groupBox = new QGroupBox(this); - groupBox->setFixedHeight(150); - groupBox->setContextMenuPolicy(Qt::NoContextMenu); - groupBox->setTitle(tr("Information")); - QFont serifFont("Times", 5, QFont::Normal); - txtOutput = new QPlainTextEdit(groupBox); - txtOutput->setFont(serifFont); - txtOutput->setContextMenuPolicy(Qt::NoContextMenu); - txtOutput->setReadOnly(true); - txtOutput->setFocusPolicy(Qt::NoFocus); - //txtOutput->setEditFocus(false); - QGridLayout *groupBoxLayout = new QGridLayout(this); - groupBoxLayout->setVerticalSpacing(2); - groupBoxLayout->setHorizontalSpacing(2); - groupBoxLayout->setSpacing(2); - groupBoxLayout->setMargin(2); - groupBoxLayout->addWidget(txtOutput, 0, 0); - groupBox->setLayout(groupBoxLayout); - - //Create MainLayout and MainWidget - mainLayout->addWidget(tabWidget, 0, 0); - mainLayout->addWidget(groupBox, 1, 0, Qt::AlignBottom); - MainWidget->setLayout(mainLayout); - - - //Tab page: Case - QGridLayout *tabCaseLayout = new QGridLayout(this); - tabCaseLayout->setVerticalSpacing(2); - tabCaseLayout->setHorizontalSpacing(2); - tabCaseLayout->setSpacing(2); - tabCaseLayout->setMargin(2); - treeModuleList = new QTreeWidget(tabCase); - treeModuleList->setContextMenuPolicy(Qt::NoContextMenu); - treeModuleList->headerItem()->setText(0, tr("Module List")); - treeModuleList->setSelectionBehavior(QAbstractItemView::SelectRows); - treeModuleList->setEditFocus(false); - connect(treeModuleList, SIGNAL(itemClicked(QTreeWidgetItem* , int)), this, - SLOT(on_treeModuleList_itemClicked(QTreeWidgetItem* , int))); - - - QWidget *caseToolWidget = new QWidget(tabCase); - caseToolWidget->setContextMenuPolicy(Qt::NoContextMenu); - QGridLayout *caseToolWidgetLayout = new QGridLayout; - QPushButton *btnRunCase = new QPushButton(tr("Run"), caseToolWidget); - btnRunCase->setContextMenuPolicy(Qt::NoContextMenu); - btnRunCase->setFixedSize(btnSize); - connect(btnRunCase, SIGNAL(clicked()), this, - SLOT(on_actRunCaseSeq_triggered())); - QPushButton *btnExpandAll = new QPushButton(tr("Expand"), caseToolWidget); - btnExpandAll->setContextMenuPolicy(Qt::NoContextMenu); - btnExpandAll->setFixedSize(btnSize); - connect(btnExpandAll, SIGNAL(clicked()), this, - SLOT(on_actExpandAll_triggered())); - QPushButton *btnCollapseAll = new QPushButton(tr("Collapse"), - caseToolWidget); - btnCollapseAll->setContextMenuPolicy(Qt::NoContextMenu); - btnCollapseAll->setFixedSize(btnSize); - connect(btnCollapseAll, SIGNAL(clicked()), this, - SLOT(on_actCollapseAll_triggered())); - - caseToolWidgetLayout->addWidget(btnRunCase, 0, 0); - caseToolWidgetLayout->addWidget(btnExpandAll, 0, 1); - caseToolWidgetLayout->addWidget(btnCollapseAll, 0, 2); - caseToolWidget->setLayout(caseToolWidgetLayout); - - tabCaseLayout->addWidget(caseToolWidget, 1, 0); - tabCaseLayout->addWidget(treeModuleList, 0, 0); - tabCase->setLayout(tabCaseLayout); - - //Tab page: Set - - QGridLayout *tabSetLayout = new QGridLayout(this); - tabSetLayout->setVerticalSpacing(2); - tabSetLayout->setHorizontalSpacing(2); - tabSetLayout->setSpacing(2); - tabSetLayout->setMargin(2); - - QGridLayout *tabSetMainLayout = new QGridLayout(this); - tabSetMainLayout->setVerticalSpacing(2); - tabSetMainLayout->setHorizontalSpacing(2); - tabSetMainLayout->setSpacing(2); - tabSetMainLayout->setMargin(2); - QWidget *tabSetMainWidget = new QWidget(tabSet); - tabSetMainWidget->setContextMenuPolicy(Qt::NoContextMenu); - QLabel *lblSet = new QLabel(tr("Test Set:"), tabSetMainWidget); - lblSet->setContextMenuPolicy(Qt::NoContextMenu); - QLabel *lblCase = new QLabel(tr("Cases:"), tabSetMainWidget); - lblCase->setContextMenuPolicy(Qt::NoContextMenu); - cboSetList = new QComboBox(tabSetMainWidget); - cboSetList->setContextMenuPolicy(Qt::NoContextMenu); - cboSetList->setEditable(false); - connect(cboSetList, SIGNAL(currentIndexChanged(QString)), this, - SLOT(on_cboSetList_currentIndexChanged(QString))); - lstSetCases = new QListWidget(tabSetMainWidget); - lstSetCases->setContextMenuPolicy(Qt::NoContextMenu); - tabSetMainLayout->addWidget(lblSet, 0, 0); - tabSetMainLayout->addWidget(cboSetList, 0, 1); - tabSetMainLayout->addWidget(lblCase, 1, 0, - (Qt::AlignTop | Qt::AlignRight)); - tabSetMainLayout->addWidget(lstSetCases, 1, 1); - tabSetMainWidget->setLayout(tabSetMainLayout); - - QWidget *setToolWidget = new QWidget(tabSet); - setToolWidget->setContextMenuPolicy(Qt::NoContextMenu); - QGridLayout *setToolWidgetLayout = new QGridLayout(this); - setToolWidgetLayout->setVerticalSpacing(2); - setToolWidgetLayout->setHorizontalSpacing(2); - setToolWidgetLayout->setSpacing(2); - setToolWidgetLayout->setMargin(2); - QPushButton *btnRunSetCase = new QPushButton(tr("Run"), setToolWidget); - btnRunSetCase->setContextMenuPolicy(Qt::NoContextMenu); - btnRunSetCase->setFixedSize(btnSize); - connect(btnRunSetCase, SIGNAL(clicked()), this, - SLOT(on_actRunSetSeq_triggered())); - QPushButton *btnNewSet = new QPushButton(tr("New Set"), setToolWidget); - btnNewSet->setContextMenuPolicy(Qt::NoContextMenu); - btnNewSet->setFixedSize(btnSize); - connect(btnNewSet, SIGNAL(clicked()), this, - SLOT(on_actNewSet_triggered())); - QPushButton *btnDelSet = new QPushButton(tr("Delete Set"), setToolWidget); - btnDelSet->setContextMenuPolicy(Qt::NoContextMenu); - btnDelSet->setFixedSize(btnSize); - connect(btnDelSet, SIGNAL(clicked()), this, - SLOT(on_actDelSet_triggered())); - - setToolWidgetLayout->addWidget(btnRunSetCase, 0, 0); - setToolWidgetLayout->addWidget(btnNewSet, 0, 1); - setToolWidgetLayout->addWidget(btnDelSet, 0, 2); - setToolWidget->setLayout(setToolWidgetLayout); - - tabSetLayout->addWidget(tabSetMainWidget, 0, 0); - tabSetLayout->addWidget(setToolWidget, 1, 0); - tabSet->setLayout(tabSetLayout); - - //Tab Started - QGridLayout *tabStartedLayout = new QGridLayout(this); - tabStartedLayout->setVerticalSpacing(2); - tabStartedLayout->setHorizontalSpacing(2); - tabStartedLayout->setSpacing(2); - tabStartedLayout->setMargin(2); - lstStartedCases = new QListWidget(tabStarted); - lstStartedCases->setContextMenuPolicy(Qt::NoContextMenu); - QWidget *startedToolWidget = new QWidget(tabStarted); - startedToolWidget->setContextMenuPolicy(Qt::NoContextMenu); - QGridLayout *startedToolWidgetLayout = new QGridLayout(this); - startedToolWidgetLayout->setVerticalSpacing(2); - startedToolWidgetLayout->setHorizontalSpacing(2); - startedToolWidgetLayout->setSpacing(2); - startedToolWidgetLayout->setMargin(2); - btnPauseCase = new QPushButton(tr("Pause"), startedToolWidget); - btnPauseCase->setContextMenuPolicy(Qt::NoContextMenu); - btnPauseCase->setFixedSize(btnSize); - connect(btnPauseCase, SIGNAL(clicked()), this, - SLOT(on_actPause_triggered())); - btnPauseCase->setEnabled(false); - - btnAbortCase = new QPushButton(tr("Abort"), startedToolWidget); - btnAbortCase->setContextMenuPolicy(Qt::NoContextMenu); - btnAbortCase->setFixedSize(btnSize); - connect(btnAbortCase, SIGNAL(clicked()), this, - SLOT(on_actAbort_triggered())); - btnAbortCase->setEnabled(false); - // - // QPushButton *btnShowOutput = new QPushButton(tr("Output"), startedToolWidget); - // connect(btnShowOutput, SIGNAL(clicked()), this, - // SLOT(on_btnShowOutput_clicked())); - - - startedToolWidgetLayout->addWidget(btnPauseCase, 0, 0); - startedToolWidgetLayout->addWidget(btnAbortCase, 0, 1); - //startedToolWidgetLayout->addWidget(btnShowOutput, 0, 2); - startedToolWidget->setLayout(startedToolWidgetLayout); - - tabStartedLayout->addWidget(lstStartedCases, 0, 0); - tabStartedLayout->addWidget(startedToolWidget, 1, 0); - tabStarted->setLayout(tabStartedLayout); - - //Tab Statistic - QGridLayout *tabStatisticLayout = new QGridLayout(this); - tabStatisticLayout->setVerticalSpacing(2); - tabStatisticLayout->setHorizontalSpacing(2); - tabStatisticLayout->setSpacing(2); - tabStatisticLayout->setMargin(2); - - treeStatistic = new QTreeWidget(tabStatistic); - treeStatistic->setContextMenuPolicy(Qt::NoContextMenu); - treeStatistic->headerItem()->setText(0, tr("Statistics")); - tabStatisticLayout->addWidget(treeStatistic, 0, 0); - tabStatistic->setLayout(tabStatisticLayout); - - executedItems = new QTreeWidgetItem(treeStatistic); - executedItems->setText(0, tr("Executed Cases(0)")); - passedItems = new QTreeWidgetItem(treeStatistic); - passedItems->setText(0, tr("Passed Cases(0)")); - failedItems = new QTreeWidgetItem(treeStatistic); - failedItems->setText(0, tr("Failed Cases(0)")); - crashedItems = new QTreeWidgetItem(treeStatistic); - crashedItems->setText(0, tr("Crashed Cases(0)")); - abortedItems = new QTreeWidgetItem(treeStatistic); - abortedItems->setText(0, tr("Aborted Cases(0)")); - - - setCentralWidget(MainWidget); - - } - -void frmMain::LoadSubMenu() - { - menuBar()->clear(); - menuBar()->setContextMenuPolicy(Qt::NoContextMenu); - if (tabWidget->currentIndex() == 0) - { - //Cases Tab - menuBar()->addAction(actOpenFile); - menuBar()->addAction(actRunCaseSeq); - menuBar()->addAction(actRunCasePar); - menuBar()->addSeparator(); - menuBar()->addAction(actAddtoSet); - menuBar()->addSeparator(); - menuBar()->addAction(actSelectAll); - menuBar()->addAction(actExpandAll); - menuBar()->addAction(actCollapseAll); - } - else if (tabWidget->currentIndex() == 1) - { - //Set Tab - menuBar()->addAction(actRunSetSeq); - menuBar()->addAction(actRunSetPar); - menuBar()->addSeparator(); - menuBar()->addAction(actNewSet); - menuBar()->addAction(actDelSet); - } - else if (tabWidget->currentIndex() == 2) - { - //Started Tab - menuBar()->addAction(actPause); - menuBar()->addAction(actAbort); - - } - else - { - //Staticstic tab - menuBar()->addAction(actClearStatistics); - } - menuBar()->addSeparator(); - menuBar()->addAction(actSetting); - menuBar()->addAction(actAbout); - menuBar()->addAction(actExit); - - } - -void frmMain::onTabWidgetSelectIndexChanged() - { - LoadSubMenu(); - } - -void frmMain::loadContent() - { - //Load ModuleList - loadModuleList(); - //Load SetList - loadSetList(); - //Load Statistic List - loadStatistic(); - } - -void frmMain::loadModuleList() - { - treeModuleList->clear(); - - QList moduleList = controller->GetModuleList(); - foreach(QString moduleName, moduleList) - { - QTreeWidgetItem* item = new QTreeWidgetItem(treeModuleList); - item->setText(0, UNSELECTITEMHEADER + moduleName); - - QList caseList = controller->GetCaseListByModule( - moduleName); - - foreach(QString caseName, caseList) - { - QTreeWidgetItem* caseItem = new QTreeWidgetItem(item); - caseItem->setText(0, UNSELECTITEMHEADER + caseName); - } - } - if (moduleList.size() > 0) - { - treeModuleList->setCurrentItem(treeModuleList->topLevelItem(0)); - } - } - -void frmMain::reloadStatisticItem(QString name, QTreeWidgetItem* item, - TSTFCaseStatusType type) - { - QList caseList = controller->GetCasesByStatus(type); - while (item->childCount() != 0) - { - item->removeChild(item->child(0)); - } - item->setText(0, name + "(" + QString::number(caseList.size(), 10) + ")"); - foreach(CSTFCase aCase, caseList) - { - QTreeWidgetItem* child = new QTreeWidgetItem(item); - child->setText(0, aCase.Name()); - } - } - -void frmMain::loadStatistic() - { - //executedItems; - reloadStatisticItem("Executed Cases", executedItems, EStatusExecuted); - - //passedItems; - reloadStatisticItem("Passed Cases", passedItems, EStatusPassed); - - //failedItems; - reloadStatisticItem("Failed Cases", failedItems, EStatusFailed); - - //crashedItems; - reloadStatisticItem("Crashed Cases", crashedItems, EStatusCrashed); - - //abortedItems; - reloadStatisticItem("Aborted Cases", abortedItems, EStatusAborted); - - } - -void frmMain::loadSetList() - { - cboSetList->clear(); - - QList setList = controller->GetSetList(); - foreach(QString setName, setList) - { - cboSetList->addItem(setName); - } -// if (setList.size() > 0) -// { -// //cboSetList->setCurrentIndex(0); -// on_cboSetList_currentIndexChanged(setList.at(0)); -// } - } - -QList frmMain::getSelectedCases() - { - int index = 0; - QTreeWidgetItem* item = treeModuleList->topLevelItem(index); - QList caseList; - while (item != 0) - { - for (int i = 0; i < item->childCount(); i++) - { - QTreeWidgetItem* child = item->child(i); - if (child->text(0).startsWith(SELECTITEMHEADER)) - { - CSTFCase aCase(child->text(0).remove(0,3), i); - aCase.SetIndex(i); - //aCase.SetModuleName(moduleBox->text()); - aCase.SetModuleName(item->text(0).remove(0,3)); - caseList.append(aCase); - } - } - index++; - item = treeModuleList->topLevelItem(index); - } - return caseList; - } - -void frmMain::on_cboSetList_currentIndexChanged(QString item) - { - lstSetCases->clear(); - QList list = controller->GetCaseListBySet(item); - foreach(QString caseName, list) - { - lstSetCases->addItem(caseName); - } - } - -void frmMain::on_actRunCaseSeq_triggered() - { - //run case seq - controller->RunCases(getSelectedCases(), Sequentially); - } - -void frmMain::on_actRunCasePar_triggered() - { - controller->RunCases(getSelectedCases(), Parallel); - } - -void frmMain::on_actAddtoSet_triggered() - { - - QList list = getSelectedCases(); - if (list.size() == 0) - { - QErrorMessage *errorMessageDialog = new QErrorMessage(this); - errorMessageDialog->showMessage(tr( - "Please select cases you want to added to set.")); - return; - } - - QList setList = controller->GetSetList(); - - /* - bool ok; - QString setName = QInputDialog::getItem(this, tr( - "Add select cases to Set"), tr("Sets:"), setList, 0, false, &ok); - if (ok && !setName.isEmpty()) - { - controller->AddCaseToSet(list, setName); - } - */ - - //temp code, because UIStore()->AddCaseToSet() is not support to define a set name. - controller->AddCaseToSet(list, ""); - tabWidget->setCurrentIndex(1); - - } - -void frmMain::on_actSelectAll_triggered() - { - QString header = UNSELECTITEMHEADER; - if(actSelectAll->text() == "Select All") - { - actSelectAll->setText("UnSelect All"); - header = SELECTITEMHEADER; - } - else - { - actSelectAll->setText("Select All"); - } - - int index = 0; - QTreeWidgetItem* item = treeModuleList->topLevelItem(index); - while (item != 0) - { - item->setText(0, item->text(0).replace(0,3, header)); - for (int i = 0; i < item->childCount(); i++) - { - QTreeWidgetItem* child = item->child(i); - child->setText(0,child->text(0).replace(0,3,header)); - } - index++; - item = treeModuleList->topLevelItem(index); - } - } - -void frmMain::on_actExpandAll_triggered() - { - treeModuleList->expandAll(); - } - -void frmMain::on_actCollapseAll_triggered() - { - treeModuleList->collapseAll(); - } - -void frmMain::on_actSetting_triggered() - { - DlgSetting dlgSet(uiSetting); - int result = dlgSet.exec(); - if(result == QDialog::Accepted) - { - setSetting(); - } - } - -void frmMain::on_actRunSetSeq_triggered() - { - QString setName = cboSetList->currentText(); - controller->RunSets(setName, Sequentially); - } - -void frmMain::on_actRunSetPar_triggered() - { - QString setName = cboSetList->currentText(); - controller->RunSets(setName, Parallel); - } - -void frmMain::on_actNewSet_triggered() - { - //not supported. - QErrorMessage *errorMessageDialog = new QErrorMessage(this); - errorMessageDialog->showMessage( - tr( - "The feature is not supported in this version.\r\n \ - If you want to Add test set.\r\n \ - Please switch to \"Case\" tab, Select case(s) and perform \"Add case to set\".")); - return; - /* - * These function is not supported in this version. - * Unless this function has been impelemented: - * UIStore()->AddSet(setName); - * - bool ok; - QString text = QInputDialog::getText(this, tr("Create a new Set"), tr( - "Input a set name:"), QLineEdit::Normal, QDir::home().dirName(), - &ok); - if (ok && !text.isEmpty()) - { - controller->CreateSet(text); - } - */ - } - -void frmMain::on_actDelSet_triggered() - { - //not supported. - QErrorMessage *errorMessageDialog = new QErrorMessage(this); - errorMessageDialog->showMessage( - tr( - "The feature is not supported in this version.\r\n \ - If you want to remove test set.\r\n \ - Please delete them under {epoc root}\\winscw\\c\\TestFramework \ - And restart Application")); - return; - /* - * These function is not supported in this version. - * Unless this function has been impelemented: - * UIStore()->RemoveSet(setName); - * - QString setName = cboSetList->currentText(); - QMessageBox msgBox(QMessageBox::Warning, tr("Delete a Set"), tr( - "Do you really want to delete the set?"), 0, this); - msgBox.addButton(tr("&Delete"), QMessageBox::AcceptRole); - msgBox.addButton(tr("&Cancel"), QMessageBox::RejectRole); - if (msgBox.exec() == QMessageBox::AcceptRole) - { - controller->DeleteSet(setName); - } - - - */ - } - -void frmMain::on_actPause_triggered() - { - if (btnPauseCase->text() == "Pause") - { - controller->PauseCase(); - btnPauseCase->setText(tr("Resume")); - actPause->setText(tr("Resume")); - } - else - { - controller->ResumeCase(); - btnPauseCase->setText(tr("Pause")); - actPause->setText(tr("Pause")); - } - } - -void frmMain::on_actAbort_triggered() - { - controller->AbortCase(); - } - -void frmMain::on_treeModuleList_itemClicked(QTreeWidgetItem* item, int /*column*/) - { - QString header = UNSELECTITEMHEADER; - if(item->text(0).startsWith(UNSELECTITEMHEADER)) - { - header = SELECTITEMHEADER; - } - item->setText(0 , item->text(0).replace(0, 3, header)); - for(int i=0;ichildCount();i++) - { - item->child(i)->setText(0, item->child(i)->text(0).replace(0, 3, header)); - } - } - -void frmMain::on_actAbout_triggered() - { - QString str = QtUIVersion; - str.append("\r\n").append("STF version:"); - - str.append(QString::number(STIF_MAJOR_VERSION, 10)).append("."); - str.append(QString::number(STIF_MINOR_VERSION, 10)).append("."); - str.append(QString::number(STIF_BUILD_VERSION, 10)); - str.append(" --").append(STIF_REL_DATE).append("\r\n"); - str.append("---"); - str.append("\r\nCopyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. "); - - QMessageBox::information(this, tr("About"), str); - } - -void frmMain::on_actOpenFile_triggered() - { - QString fileName = QFileDialog::getOpenFileName(this, tr( - "Select ini file"), tr("c:\\"), tr( - "Ini Files (*.ini);;All Files (*)")); - if (!fileName.isEmpty()) - { - controller->OpenEngineIniFile(fileName); - this->loadModuleList(); - } - } - -void frmMain::on_actClearStatistics_triggered() - { - model->ClearCasesStatus(); - } diff -r 8a14024f954a -r cfe32394fcd5 stif/QtUI/StifQtUI/frmmain.h --- a/stif/QtUI/StifQtUI/frmmain.h Mon Mar 15 12:46:13 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,179 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: QT C++ based Class. -* frmMain is a QT based Window. -* Used to display STF executor main GUI. -* -*/ -#ifndef FRMMAIN_H -#define FRMMAIN_H - -#include -#include "istfqtuicontroller.h" -#include "istfqtuimodel.h" -#include "dlgoutput.h" -#include "uisetting.h" -#include "dlgsetting.h" - -QT_BEGIN_NAMESPACE -class QAction; -class QLabel; -class QMenu; -class QTabWidget; -class QWidget; -class QPushButton; -class QComboBox; -class QPlainTextEdit; -class QTreeWidget; -class QTreeWidgetItem; -class QListWidget; -class QCheckBox; -class QMessageBox; -class QFileDialog; -QT_END_NAMESPACE - -const QString QtUIVersion = "StfQtUI v1.0.1"; - -class frmMain : public QMainWindow, public IStfEventListener, public IStifModelEventListener -{ - Q_OBJECT - -public: - frmMain(); - ~frmMain(); - - -public: //Implement IStfEventListener - void OnGetMessage(const QString& aMessage); - void OnSetListChanged(); - void OnCaseOutputChanged(const IStfEventListener::CaseOutputCommand& cmd, const QString& index, const QString& msg); - - -public: //Implement IStifModelEventListener - void OnCaseStatisticChanged() ; - void OnRunningCaseChanged() ; - -protected slots: - void onTabWidgetSelectIndexChanged(); - - -private: - void createMenus(); - void LoadSubMenu(); - void load(); - void loadContent(); - void loadModuleList(); - void loadSetList(); - void loadStatistic(); - QList getSelectedCases(); - void reloadStatisticItem(QString name, QTreeWidgetItem* item, TSTFCaseStatusType type); - void setSetting(); - -private: - IStfQtUIController* controller; - IStfQtUIModel* model; - DlgOutput* dlgOutput; - UiSetting* uiSetting; - - -private: //UI Components - QWidget *MainWidget; - //menus and actions - QMenu *operateMenu; - //output panel - QPlainTextEdit *txtOutput; - //tab control. - QTabWidget *tabWidget; - QWidget *tabCase; - QWidget *tabSet; - QWidget *tabStarted; - QWidget *tabStatistic; - - //Cases Tab - QTreeWidget *treeModuleList; - - //Statistic Tab - QTreeWidget *treeStatistic; - QTreeWidgetItem *executedItems; - QTreeWidgetItem *passedItems; - QTreeWidgetItem *failedItems; - QTreeWidgetItem *abortedItems; - QTreeWidgetItem *crashedItems; - - - //Set Tab - QComboBox *cboSetList; - QListWidget *lstSetCases; - - //Started Tab - QListWidget *lstStartedCases; - QPushButton *btnPauseCase; - QPushButton *btnAbortCase; - QPlainTextEdit *txtCaseOutput; - - //menu actions - QAction *actExit; - QAction *actAbout; - - //cases actoins - QAction *actOpenFile; - QAction *actRunCaseSeq; - QAction *actRunCasePar; - QAction *actAddtoSet; - QAction *actSelectAll; - QAction *actExpandAll; - QAction *actCollapseAll; - QAction *actSetting; - //sets actions - QAction *actRunSetSeq; - QAction *actRunSetPar; - QAction *actNewSet; - QAction *actDelSet; - //running actions. - QAction *actPause; - QAction *actAbort; - //statistics actions - QAction *actClearStatistics; - -private slots: - void on_cboSetList_currentIndexChanged(QString ); - - void on_actAbout_triggered(); - void on_actOpenFile_triggered(); - void on_actRunCaseSeq_triggered(); - void on_actRunCasePar_triggered(); - void on_actAddtoSet_triggered(); - void on_actSelectAll_triggered(); - void on_actExpandAll_triggered(); - void on_actCollapseAll_triggered(); - void on_actSetting_triggered(); - - void on_actRunSetSeq_triggered(); - void on_actRunSetPar_triggered(); - void on_actNewSet_triggered(); - void on_actDelSet_triggered(); - void on_actPause_triggered(); - void on_actAbort_triggered(); - void on_actClearStatistics_triggered(); - void on_treeModuleList_itemClicked(QTreeWidgetItem* item, int column); - - - - - - - -}; - -#endif // FRMMAIN_H diff -r 8a14024f954a -r cfe32394fcd5 stif/QtUI/StifQtUI/istfqtuicontroller.h --- a/stif/QtUI/StifQtUI/istfqtuicontroller.h Mon Mar 15 12:46:13 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: QT C++ based Class. -* IStfQtUIController is interface of appliction controller. -* IStfEventListener is interface of Stf view observer. -* -*/ -#ifndef ISTFQTUICONTROLLER_H -#define ISTFQTUICONTROLLER_H -#include "cstfmodule.h" -#include "cstfcase.h" -#include -#include "istfqtuimodel.h" - -class IStfEventListener -{ -public: - enum CaseOutputCommand - { - ECreate, - EOutput, - EClose - }; -public: - virtual void OnGetMessage(const QString& aMessage) = 0; - virtual void OnSetListChanged() = 0; - virtual void OnCaseOutputChanged(const IStfEventListener::CaseOutputCommand& cmd, const QString& index, const QString& msg) = 0; -}; - -class IStfQtUIController -{ -public: - inline virtual ~IStfQtUIController(){} - //for cases - virtual bool OpenEngineIniFile(const QString& fileName) = 0; - virtual QList GetModuleList() = 0; - virtual QList GetCaseListByModule(const QString& moduleName) = 0; - virtual CSTFCase GetCase(const QString& moduleName, const int index) = 0; - virtual void RunCases(const QList& caseList, const TSTFCaseRunningType& type) = 0; - virtual void AddCaseToSet(const QList& aCase, const QString& setName) = 0; - - //for set - virtual QList GetSetList() = 0; - virtual QList GetCaseListBySet(const QString& setName) = 0; - virtual void CreateSet(const QString& setName) = 0; - virtual void DeleteSet(const QString& setName) = 0; - virtual void RunSets(const QString& setName, const TSTFCaseRunningType& type) = 0; - - //for Started - virtual void PauseCase() = 0; - virtual void ResumeCase() = 0; - virtual void AbortCase() = 0; - virtual bool ShowOutput() = 0; - virtual void SetShowOutput(bool isShow) = 0; - - //for staticstic - virtual QList GetCasesByStatus(const TSTFCaseStatusType& type) = 0; - - //listener - virtual void AddStfEventListener(IStfEventListener* listener) = 0; - virtual void RemoveStfEventListener(IStfEventListener* listener) = 0; - - -}; - - - -#endif // ISTFQTUICONTROLLER_H diff -r 8a14024f954a -r cfe32394fcd5 stif/QtUI/StifQtUI/istfqtuimodel.h --- a/stif/QtUI/StifQtUI/istfqtuimodel.h Mon Mar 15 12:46:13 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: QT C++ based Class. -* IStfQtUIModel is interface of appliction data model. -* IStifModelEventListener is used to listen event from data model. -* -*/ -#ifndef ISTFQTUIMODEL_H -#define ISTFQTUIMODEL_H - -//#include -#include "cstfcase.h" -#include "cstfmodule.h" -#include -#include -#include - -class IStifModelEventListener - { -public: - virtual void OnCaseStatisticChanged() = 0; - virtual void OnRunningCaseChanged() = 0; - }; - -class IStfQtUIModel -{ -public: - inline virtual ~IStfQtUIModel(){} - virtual void ClearCasesStatus() = 0; - virtual QList GetCasesByStatus(const TSTFCaseStatusType& type) = 0; - virtual void AddRunningCase(const CStartedTestCase* startedCase, const CSTFCase& stfCase) = 0; - virtual void RemoveRunningCase(const CStartedTestCase* startedCase) = 0; - virtual void AddCaseByStatus(const TSTFCaseStatusType& type, const CSTFCase& aCase) = 0; - virtual void PauseCase() = 0; - virtual void ResumeCase() = 0; - virtual void AbortCase() = 0; - - virtual void AddStifModelEventListener(IStifModelEventListener* listener) = 0; - virtual void RemoveStifModelEventListener(IStifModelEventListener* listener) = 0; - - -}; - -#endif // ISTFQTUIMODEL_H diff -r 8a14024f954a -r cfe32394fcd5 stif/QtUI/StifQtUI/main.cpp --- a/stif/QtUI/StifQtUI/main.cpp Mon Mar 15 12:46:13 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: QT C++ based Class. -* Application entrance. -* -*/ -#include -#include "frmmain.h" - -int main(int argc, char* argv[]) -{ - QApplication app(argc, argv); - frmMain win; - win.showMaximized(); - return app.exec(); -} - diff -r 8a14024f954a -r cfe32394fcd5 stif/QtUI/StifQtUI/stfqtuicontroller.cpp --- a/stif/QtUI/StifQtUI/stfqtuicontroller.cpp Mon Mar 15 12:46:13 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,324 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: QT C++ based Class. - * Stf Controller implementation. - * - */ -#include "stfqtuicontroller.h" -#include -#include -//#include "stiflogger.h" -#include - -const QString TEMPSETNAME = "TEMPSET"; -const QString DEFAULTINI = "c:\\testframework\\testframework.ini"; - -//__DECLARE_LOG - -StfQtUIController::StfQtUIController(IStfQtUIModel* aModel) : - model(aModel), isShowOutput(false) - { -// __OPENLOGL ("\\STFQtUI\\", "StifQtUi.log" ); - executor = new CStifExecutor(); - executor->OpenIniFile(DEFAULTINI); - executor->AddStifCaseUpdateListener(this); - } - -StfQtUIController::~StfQtUIController() - { - executor->RemoveStifCaseUpdateListener(this); - delete executor; - executor = NULL; -// __CLOSELOG; - } -//for cases - -bool StfQtUIController::OpenEngineIniFile(const QString& fileName) - { - delete executor; - executor = new CStifExecutor(); - bool rst = executor->OpenIniFile(fileName); - executor->AddStifCaseUpdateListener(this); - return rst; - } - -QList StfQtUIController::GetModuleList() - { - QList modules = executor->GetModuleList(); - QList moduleList; - foreach(CSTFModule m, modules) - { - moduleList.append(m.Name()); - } - return moduleList; - } - -CSTFModule StfQtUIController::GetModuleByName(const QString& moduleName) - { - QList modules = executor->GetModuleList(); - CSTFModule module; - foreach(CSTFModule m, modules) - { - if(m.Name() == moduleName) - { - module = m; - break; - } - } - return module; - - } - -QList StfQtUIController::GetCaseListByModule(const QString& moduleName) - { - QList caseList; - if (moduleName != "") - { - QList cases = executor->GetCaseList(moduleName); - foreach(CSTFCase c, cases) - { - caseList.append(c.Name()); - } - } - - return caseList; - } - -CSTFCase StfQtUIController::GetCase(const QString& moduleName, const int index) - { - CSTFCase rst; - if(moduleName != "") - { - QList cases = executor->GetCaseList(moduleName); - if(index < cases.length()) - { - rst = cases.at(index); - } - } - return rst; - } - -void StfQtUIController::RunCases(const QList& caseList, - const TSTFCaseRunningType& type) - { - if (caseList.size() == 1) - { - CSTFCase aCase = caseList.at(0); - QString msg = "Start execute case:" + aCase.Name(); - FireOnGetOutput(msg); - executor->ExecuteSingleCase(aCase.ModuleName(), aCase.Index()); - } - else - { - //create a temp set, append cases into the set and execute it. - executor->CreateSet(TEMPSETNAME); - foreach(CSTFCase aCase, caseList) - { - executor->AddtoSet(TEMPSETNAME, aCase); - } - RunSets(TEMPSETNAME, type); - executor->RemoveSet(TEMPSETNAME); - } - } - -void StfQtUIController::AddCaseToSet(const QList& caseList, - const QString& /*setName*/) - { - QString setName = QDateTime::currentDateTime().toString("hh_mm_ss"); - setName.append(".set"); - executor->CreateSet(setName); - foreach(CSTFCase aCase, caseList) - { - executor->AddtoSet(setName, aCase); - } - executor->SaveSet(setName); - executor->RemoveSet(setName); - FireOnSetListChanged(); - } - -//for set - -QList StfQtUIController::GetSetList() - { - return executor->GetSetList(); - } -QList StfQtUIController::GetCaseListBySet(const QString& setName) - { - QList cases = executor->GetCaseListFromSet(setName); - QList caseList; - foreach(CSTFCase c, cases) - { - caseList.append(c.Name()); - } - return caseList; - } - -void StfQtUIController::CreateSet(const QString& setName) - { - executor->CreateSet(setName); - //executor->SaveSet(setName); - FireOnSetListChanged(); - } - -void StfQtUIController::DeleteSet(const QString& setName) - { - executor->RemoveSet(setName); - //executor->SaveSet(setName); - FireOnSetListChanged(); - } - -void StfQtUIController::RunSets(const QString& setName, const TSTFCaseRunningType& type) - { - executor->ExecuteSet(setName, 0, type); - } - -//for Started -void StfQtUIController::PauseCase() - { - model->PauseCase(); - QString msg = "Execution Paused"; - FireOnGetOutput(msg); - } - -void StfQtUIController::ResumeCase() - { - model->ResumeCase(); - FireOnGetOutput("Execution Resumed"); - } - -void StfQtUIController::AbortCase() - { - model->AbortCase(); - FireOnGetOutput("Case Aborted"); - } - -bool StfQtUIController::ShowOutput() - { - return isShowOutput; - } - -void StfQtUIController::SetShowOutput(bool isShow) - { - isShowOutput = isShow; - } - -QList StfQtUIController::GetCasesByStatus(const TSTFCaseStatusType& type) - { - return model->GetCasesByStatus(type); - } - -void StfQtUIController::AddStfEventListener(IStfEventListener* listener) - { - if (!listenerList.contains(listener)) - { - listenerList.append(listener); - } - } -void StfQtUIController::RemoveStfEventListener(IStfEventListener* listener) - { - if (listenerList.contains(listener)) - { - listenerList.removeOne(listener); - } - } - -void StfQtUIController::OnGetCaseUpdated(CStartedTestCase* aCase, - CSTFCase& stfcase, int flags) - { - if (flags & CUIStoreIf::EPrintUpdate || aCase == NULL) - { - return; - } - QString msg = "case Name:"; - msg += stfcase.Name() + "\r\n Status:"; - flags = aCase->Status(); - if (flags & CUIStoreIf::EStatusRunning) - { - model->AddRunningCase(aCase, stfcase); - msg += "start running"; - FireOnCaseOutputChanged(IStfEventListener::ECreate, (int) aCase, - stfcase.Name()); - } - else if (flags & CUIStoreIf::EStatusAborted) - { - FireOnCaseOutputChanged(IStfEventListener::EClose, (int) aCase, ""); - model->RemoveRunningCase(aCase); - model->AddCaseByStatus(EStatusAborted, stfcase); - msg += "aborted"; - - } - else if (flags & CUIStoreIf::EStatusExecuted) - { - FireOnCaseOutputChanged(IStfEventListener::EClose, (int) aCase, ""); - model->RemoveRunningCase(aCase); - model->AddCaseByStatus(EStatusExecuted, stfcase); - - if (flags & CUIStoreIf::EStatusCrashed) - { - model->AddCaseByStatus(EStatusCrashed, stfcase); - msg += "crashed"; - } - else if (flags & CUIStoreIf::EStatusFailed) - { - model->AddCaseByStatus(EStatusFailed, stfcase); - msg += "failed"; - } - else if (flags & CUIStoreIf::EStatusPassed) - { - model->AddCaseByStatus(EStatusPassed, stfcase); - msg += "passed"; - } - - } - else - { - return; - } - - FireOnGetOutput(msg); - } - -void StfQtUIController::OnGetCaseOutput(CStartedTestCase* aCase, QString& msg) - { - FireOnCaseOutputChanged(IStfEventListener::EOutput, (int) aCase, msg); - } - -void StfQtUIController::FireOnCaseOutputChanged( - IStfEventListener::CaseOutputCommand cmd, int index, QString msg) - { - if (ShowOutput()) - { - foreach(IStfEventListener* listener, listenerList) - { - listener->OnCaseOutputChanged(cmd, - QString::number(index, 10), msg); - } - } - } - -void StfQtUIController::FireOnGetOutput(QString message) - { - foreach(IStfEventListener* listener, listenerList) - { - listener->OnGetMessage(message); - } - } - -void StfQtUIController::FireOnSetListChanged() - { - foreach(IStfEventListener* listener, listenerList) - { - listener->OnSetListChanged(); - } - } diff -r 8a14024f954a -r cfe32394fcd5 stif/QtUI/StifQtUI/stfqtuicontroller.h --- a/stif/QtUI/StifQtUI/stfqtuicontroller.h Mon Mar 15 12:46:13 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: QT C++ based Class. -* Application's controller. -* -*/ -#ifndef STFQTUICONTROLLER_H_ -#define STFQTUICONTROLLER_H_ - -#include "istfqtuicontroller.h" -#include "istfqtuimodel.h" -#include "stifexecutor.h" - -class StfQtUIController : public IStfQtUIController, public IStifCaseUpdateListener - { -public: - StfQtUIController(IStfQtUIModel* aModel); - ~StfQtUIController(); -public: //Implement IStfQtUIController. - //for cases - - bool OpenEngineIniFile(const QString& fileName); - QList GetModuleList(); - QList GetCaseListByModule(const QString& moduleName); - CSTFCase GetCase(const QString& moduleName, const int index); - void RunCases(const QList& caseList, const TSTFCaseRunningType& type); - void AddCaseToSet(const QList& aCase, const QString& setName); - - //for set - QList GetSetList(); - QList GetCaseListBySet(const QString& setName); - void CreateSet(const QString& setName); - void DeleteSet(const QString& setName); - void RunSets(const QString& setName, const TSTFCaseRunningType& type); - - //for Started - void PauseCase(); - void ResumeCase(); - void AbortCase(); - bool ShowOutput(); - void SetShowOutput(bool isShow); - - //for staticstic - QList GetCasesByStatus(const TSTFCaseStatusType& type); - - //listener - void AddStfEventListener(IStfEventListener* listener); - void RemoveStfEventListener(IStfEventListener* listener); - -public://implement IStifCaseUpdateListener - void OnGetCaseUpdated(CStartedTestCase* aCase, CSTFCase& stfcase, int flags); - void OnGetCaseOutput(CStartedTestCase* aCase, QString& msg); - -private: //Fire event - void FireOnGetOutput(QString message); - void FireOnSetListChanged(); - void FireOnCaseOutputChanged(IStfEventListener::CaseOutputCommand cmd, int index, QString msg); - -private://help methods - CSTFModule GetModuleByName(const QString& moduleName); - -private: - CStifExecutor* executor; - IStfQtUIModel* model; - QList listenerList; - bool isShowOutput; - - - - }; - - - - -#endif /* STFQTUICONTROLLER_H_ */ diff -r 8a14024f954a -r cfe32394fcd5 stif/QtUI/StifQtUI/stfqtuimodel.cpp --- a/stif/QtUI/StifQtUI/stfqtuimodel.cpp Mon Mar 15 12:46:13 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,156 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: QT C++ based Class. - * application model implementation. - * - */ -#include "stfqtuimodel.h" -#include - -StfQtUIModel::StfQtUIModel() - { - //nothing to do. - } - -StfQtUIModel::~StfQtUIModel() - { - //nothing to do. - } - -void StfQtUIModel::PauseCase() - { - foreach(const CStartedTestCase* startedCase, runningCaseList.keys()) - { - startedCase->UIEngineContainer().PauseTest(); - } - } - -void StfQtUIModel::ResumeCase() - { - foreach(const CStartedTestCase* startedCase, runningCaseList.keys()) - { - startedCase->UIEngineContainer().ResumeTest(); - } - } - -void StfQtUIModel::AbortCase() - { - foreach(const CStartedTestCase* startedCase, runningCaseList.keys()) - { - startedCase->UIEngineContainer().CancelTest(); - } - } - -void StfQtUIModel::AddRunningCase(const CStartedTestCase* startedCase, - const CSTFCase& stfCase) - { - runningCaseList.insert(startedCase, stfCase); - FireOnRunningCaseChangedEvent(); - } - -void StfQtUIModel::RemoveRunningCase(const CStartedTestCase* startedCase) - { - runningCaseList.remove(startedCase); - FireOnRunningCaseChangedEvent(); - } - -void StfQtUIModel::AddCaseByStatus(const TSTFCaseStatusType& type, const CSTFCase& aCase) - { - switch (type) - { - case EStatusRunning: - break; - case EStatusExecuted: - executedCaseList.append(aCase); - break; - case EStatusPassed: - passedCaseList.append(aCase); - break; - case EStatusFailed: - failedCaseList.append(aCase); - break; - case EStatusAborted: - abortCaseList.append(aCase); - break; - case EStatusCrashed: - crashedCaseList.append(aCase); - break; - } - FireOnCaseStatisticChangedEvent(); - } - -QList StfQtUIModel::GetCasesByStatus(const TSTFCaseStatusType& type) - { - switch (type) - { - case EStatusRunning: - return runningCaseList.values(); - case EStatusExecuted: - return executedCaseList; - case EStatusPassed: - return passedCaseList; - case EStatusFailed: - return failedCaseList; - case EStatusAborted: - return abortCaseList; - case EStatusCrashed: - return crashedCaseList; - } - QList list; - return list; - } - -void StfQtUIModel::AddStifModelEventListener( - IStifModelEventListener* listener) - { - if (!listenerList.contains(listener)) - { - listenerList.append(listener); - } - } - -void StfQtUIModel::RemoveStifModelEventListener( - IStifModelEventListener* listener) - { - if (!listenerList.contains(listener)) - { - listenerList.removeOne(listener); - } - } - -void StfQtUIModel::FireOnCaseStatisticChangedEvent() - { - foreach(IStifModelEventListener* listener, listenerList) - { - listener->OnCaseStatisticChanged(); - } - } - -void StfQtUIModel::FireOnRunningCaseChangedEvent() - { - foreach(IStifModelEventListener* listener, listenerList) - { - listener->OnRunningCaseChanged(); - } - } - -void StfQtUIModel::ClearCasesStatus() - { - executedCaseList.clear(); - passedCaseList.clear(); - failedCaseList.clear(); - abortCaseList.clear(); - crashedCaseList.clear(); - FireOnCaseStatisticChangedEvent(); - } diff -r 8a14024f954a -r cfe32394fcd5 stif/QtUI/StifQtUI/stfqtuimodel.h --- a/stif/QtUI/StifQtUI/stfqtuimodel.h Mon Mar 15 12:46:13 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: QT C++ based Class. -* application data model. -* -*/ -#include "istfqtuimodel.h" -#include "stifexecutor.h" -#include - -class StfQtUIModel : public IStfQtUIModel - { -public: - StfQtUIModel(); - virtual ~StfQtUIModel(); -public://implement IStfQtUIModel - void ClearCasesStatus(); - QList GetCasesByStatus(const TSTFCaseStatusType& type); - void AddRunningCase(const CStartedTestCase* startedCase, const CSTFCase& stfCase); - void RemoveRunningCase(const CStartedTestCase* startedCase); - void AddCaseByStatus(const TSTFCaseStatusType& type, const CSTFCase& aCase); - void AddStifModelEventListener(IStifModelEventListener* listener); - void RemoveStifModelEventListener(IStifModelEventListener* listener); - void PauseCase(); - void ResumeCase(); - void AbortCase(); - -private: - void FireOnCaseStatisticChangedEvent(); - void FireOnRunningCaseChangedEvent(); - -private: - QList listenerList; - QList executedCaseList; - QList passedCaseList; - QList failedCaseList; - QList abortCaseList; - QList crashedCaseList; - QHash runningCaseList; - - - - - - - }; diff -r 8a14024f954a -r cfe32394fcd5 stif/QtUI/StifQtUI/stifexecutor.cpp --- a/stif/QtUI/StifQtUI/stifexecutor.cpp Mon Mar 15 12:46:13 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,360 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: QT C++ and Symbian C++ combination Class. - * STIF UI interface and engine caller implementaion. - * - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include "stifexecutor.h" -#include "StifTFwIf.h" - - -CStifExecutor::CStifExecutor() : - listenerList(NULL) - { -// __LOG(_L("started")); - TInt result; - TRAP(result, CUIStoreIf::ConstructL()); -// __LOG1(_L("CUIStoreIf ConstructL, result=%d"), result); - if (result != KErrNone) - { - return; - } - TRAP(result, iBuffer = HBufC::NewL(500)); -// __LOG1(_L("Create Case Execution output buffer, result=%d"), result); - - } - -CStifExecutor::~CStifExecutor() - { - UIStore().Close(); - delete iBuffer; - if (listenerList) - { - delete listenerList; - listenerList = NULL; - } -// __LOG(_L("finished")); - } - -bool CStifExecutor::OpenIniFile(const QString& filename) - { - TInt result = UIStore().Open(QString2TPtrC(filename)); -// __LOG2(_L("Open ini file %s.result=%d"),QString2TPtrC(filename).Ptr(),result); - return (result == KErrNone); - } - -TPtrC CStifExecutor::QString2TPtrC(const QString& aString) - { - TPtrC ret(reinterpret_cast (aString.constData()), - aString.length()); - return ret; - } -QString CStifExecutor::TDesC2QString(const TDesC& des) - { - //#ifdef QT_NO_UNICODE - //return QString::fromLocal8Bit((char*)des.Ptr(), des.Length()); - //#else - QString rst = QString::fromUtf16(des.Ptr(), des.Length()); - return rst; - //#endif - } - -void CStifExecutor::AddStifCaseUpdateListener( - IStifCaseUpdateListener* listener) - { -// __LOG(_L("AddStifCaseUpdateListener")); - if (!listenerList) - { - listenerList = new QList (); - } - if (!listenerList->contains(listener)) - { - listenerList->append(listener); - } - } - -void CStifExecutor::RemoveStifCaseUpdateListener( - IStifCaseUpdateListener* listener) - { -// __LOG(_L("RemoveStifCaseUpdateListener")); - if (!listenerList) - { - return; - } - - if (listenerList->contains(listener)) - { - listenerList->removeOne(listener); - } - - } - -QList CStifExecutor::GetModuleList() - { - QList list; - RRefArray modules; -// __LOG(_L("GetModuleList")); - TInt ret = UIStore().Modules(modules); -// __LOG1(_L("LoadAllModules %d"), ret); -// __LOG1(_L("Modules number=%d"), modules.Count()); - for (TInt i = 0; i < modules.Count(); i++) - { -// __LOG1(_L("Get Module Names %d"), i); - CSTFModule module; - module.SetName(QString::fromUtf16(modules[i].Ptr(), - modules[i].Length())); - //module.SetName(TDesC2QString(modules[i])); - list.append(module); - } - modules.Reset(); - modules.Close(); - return list; - } - -QList CStifExecutor::GetCaseList(const QString& moduleName) - { - TPtrC name = QString2TPtrC(moduleName); - QList list; - RRefArray testCases; - TInt ret = UIStore().TestCases(testCases, name, KNullDesC); -// __LOG1(_L("Get TestCases: %d"), ret); - for (TInt i = 0; i < testCases.Count(); i++) - { -// __LOG1(_L("Case Number: %d"),testCases[i].TestCaseNum()); - CSTFCase testcase; - testcase.SetName(TDesC2QString(testCases[i].TestCaseTitle())); - testcase.SetIndex(i); - list.append(testcase); - } - testCases.Reset(); - testCases.Close(); - return list; - } - -void CStifExecutor::ExecuteSingleCase(const QString& moduleName, const int caseIndex) - { -// __LOG(_L("ExecuteCase start")); - TPtrC name = QString2TPtrC(moduleName); - RRefArray testCases; - TInt ret = UIStore().TestCases(testCases, name, KNullDesC); -// __LOG1(_L("Get TestCases return code=%d"), ret); - if (testCases.Count() > caseIndex) - { - TInt index; - UIStore().StartTestCase(testCases[caseIndex], index); -// __LOG1(_L("start test case index=%d"), index); - } - testCases.Reset(); - testCases.Close(); -// __LOG(_L("ExecuteCase end")); - - } - -QList CStifExecutor::GetSetList() - { - QList list; - RRefArray aArray; - TInt ret = UIStore().GetTestSetsList(aArray); -// __LOG1(_L("Get TestSet list return code=%d"), ret); - if (ret != KErrNone) //setInfos.Count() != 1 - { - return list; - } - for (int i = 0; i < aArray.Count(); i++) - { - list.append(TDesC2QString(aArray[i])); - } - aArray.Reset(); - aArray.Close(); - return list; - } - -QList CStifExecutor::GetCaseListFromSet(const QString& setName) - { -// __LOG(_L("GetCaseListFromSet start.")); - QList list; - TPtrC name = QString2TPtrC(setName); - - //__LOG(name); - if (name.Length() == 0) - { - return list; - } - -// __LOG1(_L("name.Length()=%d"), name.Length()); - TInt ret = UIStore().LoadTestSet(name); -// __LOG1(_L("Load Test Set return=%d"),ret); - const CTestSetInfo* set = NULL; - TRAP(ret , set = &UIStore().TestSetL(name)); -// __LOG(_L("GetCaseListFromSet TestSetL.")); - if(ret != KErrNone) - { - return list; - } - const RRefArray& testCases = set->TestCases(); -// __LOG(_L("GetCaseListFromSet TestCases.")); - TInt count = testCases.Count(); - for (TInt i = 0; i < count; i++) - { - CSTFCase testcase; - testcase.SetName(TDesC2QString(testCases[i].TestCaseTitle())); - testcase.SetIndex(testCases[i].TestCaseNum()); - testcase.SetModuleName(TDesC2QString(testCases[i].ModuleName())); - list.append(testcase); - } -// __LOG(_L("GetCaseListFromSet end.")); - return list; - } - -void CStifExecutor::CreateSet(const QString& setName) - { - TPtrC name = QString2TPtrC(setName); - TInt ret = UIStore().CreateTestSet(name); -// __LOG1(_L("CreateSet return: %d"), ret); -// ret = UIStore().LoadTestSet(name); -// __LOG1(_L("Load Set after CreateSet return: %d"), ret); - - - } - -void CStifExecutor::SaveSet(QString& setName) - { - TPtrC name = QString2TPtrC(setName); - TFileName testSetName; - testSetName.Copy(name); - TInt ret = UIStore().SaveTestSet(testSetName); - setName = TDesC2QString(testSetName); -// __LOG1(_L("SaveSet return: %d"),ret); - } - -void CStifExecutor::RemoveSet(const QString& setName) - { - //This method wil not work at this stage. - TPtrC name = QString2TPtrC(setName); - UIStore().RemoveTestSet(name); - } - -void CStifExecutor::AddtoSet(const QString& setName, CSTFCase& caseInfo) - { - //IMPORT_C TInt AddToTestSet( const TDesC& aSetName, const CTestInfo& aTestInfo ); - TPtrC modulename = QString2TPtrC(caseInfo.ModuleName()); - RRefArray testCases; - TInt ret = UIStore().TestCases(testCases, modulename, KNullDesC); -// __LOG1(_L("Get TestCases: %d"), ret); - for (TInt i = 0; i < testCases.Count(); i++) - { -// __LOG1(_L("Case Number: %d"),testCases[i].TestCaseNum()); - if (TDesC2QString(testCases[i].TestCaseTitle()) == caseInfo.Name() - && testCases[i].TestCaseNum() == caseInfo.Index()) - { - ret = UIStore().AddToTestSet(QString2TPtrC(setName), testCases[i]); -// __LOG1(_L("AddToTestSet: %d"), ret); - break; - } - } - testCases.Reset(); - testCases.Close(); - } - -void CStifExecutor::ExecuteSet(const QString& SetName, const int startIndex, - const TSTFCaseRunningType type) - { - CStartedTestSet::TSetType setType = CStartedTestSet::ESetSequential; - if (type == Parallel) - { - setType = CStartedTestSet::ESetParallel; - } - const CTestSetInfo* set = NULL; - TInt ret; - TBuf<30> test; - test.Append(QString2TPtrC(SetName)); -// __LOG(_L("StartTestSet GetSetName:")); -// __LOG(test); - TRAP(ret, set = &UIStore().TestSetL(test)); - - //const CTestSetInfo& set = UIStore().TestSetL(QString2TPtrC(SetName)); - if(ret != KErrNone) - { -// __LOG1(_L("StartTestSet GetTestSet Error return=%d"),ret); - return; - } - int a = startIndex; - ret = UIStore().StartTestSet(*set, a, setType); -// __LOG1(_L("StartTestSet return=%d"),ret); - } - -void CStifExecutor::Update(CStartedTestCase* aCase, int flags) - { -// __LOG1(_L("CStifExecutor::Update return case=%d"),aCase); -// __LOG1(_L("CStifExecutor::Update return status=%d"),flags); - - if(aCase == NULL) - { - return; - } - - if (flags & CUIStoreIf::EPrintUpdate) - { - //Cases output information update. - const RPointerArray printArray = aCase->PrintArray(); - TInt rows = aCase->PrintArray().Count(); - TPtr buffer(iBuffer->Des()); - buffer.Zero(); - for (int i = 0; i < rows; i++) - { - buffer.Append(_L("\r\n")); - buffer.Append(printArray[i]->iDescription); - buffer.Append(_L(" ")); - buffer.Append(printArray[i]->iText); - buffer.Append(_L("\r\n")); - } - QString msg = TDesC2QString(buffer); -// __LOG(_L("Get output msg:")); -// __LOG(buffer); - if (listenerList) - { - for (int i = 0; i < listenerList->size(); i++) - { - listenerList->at(i)->OnGetCaseOutput(aCase, msg); - } - } - - } - else - { - //case status changed update. - CSTFCase testcase; - testcase.SetName(TDesC2QString(aCase->TestInfo().TestCaseTitle())); - testcase.SetIndex(aCase->TestInfo().TestCaseNum()); - testcase.SetModuleName(TDesC2QString(aCase->TestInfo().ModuleName())); - if (listenerList) - { - for (int i = 0; i < listenerList->size(); i++) - { - listenerList->at(i)->OnGetCaseUpdated(aCase, testcase, flags); - } - } - - } - - } - diff -r 8a14024f954a -r cfe32394fcd5 stif/QtUI/StifQtUI/stifexecutor.h --- a/stif/QtUI/StifQtUI/stifexecutor.h Mon Mar 15 12:46:13 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: QT C++ and Symbian C++ combination Class. -* Call STIF UI engine and UI interface to perform test operation. -* All the public methods are QT C++ based object. -* -*/ -#ifndef STIFEXECUTOR_H_ -#define STIFEXECUTOR_H_ - -//#include -#include "cstfcase.h" -#include "cstfmodule.h" -#include -#include -#include -#include - -class IStifCaseUpdateListener - { -public: - virtual void OnGetCaseUpdated(CStartedTestCase* aCase,CSTFCase& stfcase, int flags) = 0; - virtual void OnGetCaseOutput(CStartedTestCase* aCase, QString& msg) = 0; - }; - - -class CStifExecutor : public CUIStoreIf - { -public: - CStifExecutor(); - ~CStifExecutor(); -public: - void AddStifCaseUpdateListener(IStifCaseUpdateListener* listener); - void RemoveStifCaseUpdateListener(IStifCaseUpdateListener* listener); - bool OpenIniFile(const QString& filename); - QList GetModuleList(); - QList GetCaseList(const QString& moduleName); - void ExecuteSingleCase(const QString& moduleName, int caseIndex); - QList GetSetList(); - QList GetCaseListFromSet(const QString& setName); - void CreateSet(const QString& setName); - void SaveSet(QString& setName); - void RemoveSet(const QString& setName); - void AddtoSet(const QString& setName, CSTFCase& caseInfo); - void ExecuteSet(const QString& SetName, const int startIndex, const TSTFCaseRunningType type); - -public://implement CUIStoreIf - void Update( CStartedTestCase* aTestCase, - TInt aFlags); - -public: - TPtrC QString2TPtrC(const QString& aString); - QString TDesC2QString(const TDesC& des); - //CTestInfo* GetTestInfo(CSTFCase aCase); -private: - QList *listenerList; - HBufC* iBuffer; - }; - - - -#endif /* STIFEXECUTOR_H_ */ diff -r 8a14024f954a -r cfe32394fcd5 stif/QtUI/StifQtUI/test/StfQtUITest.pro --- a/stif/QtUI/StifQtUI/test/StfQtUITest.pro Mon Mar 15 12:46:13 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -HEADERS += ..\frmmain.h \ - ..\istfqtuicontroller.h \ - ..\stfqtuicontroller.h \ - ..\cstfcase.h \ - ..\cstfmodule.h \ - ..\istfqtuimodel.h \ - ..\stfqtuimodel.h \ - ..\dlgoutput.h \ - testcontroller.h -SOURCES += ..\frmmain.cpp \ - ..\stfqtuimodel.cpp \ - ..\stfqtuicontroller.cpp \ - ..\dlgoutput.cpp \ - testcontroller.cpp \ - main.cpp - -CONFIG += qtestlib - -RESOURCES += -symbian { - TARGET.UID3 = 0xA000C60B - #include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) - TARGET.EPOCALLOWDLLDATA = 1 - HEADERS += ../../../../inc/. - include(.\platform\stifinternal) - HEADERS += ../stifexecutor.h - SOURCES += ../stifexecutor.cpp - LIBS += -leuser \ - -lefsrv \ - -lstiftestinterface \ - -lstiftfwif \ - -lstiftestengine \ - -lecons \ - -lhal \ - -lflogger - TARGET.CAPABILITY = ReadUserData \ - WriteUserData - - # Export headers to SDK Epoc32/include directory - deploy.path = $$EPOCROOT - exportheaders.sources = $$PUBLIC_HEADERS - exportheaders.path = epoc32/include - for(header, exportheaders.sources) - :BLD_INF_RULES.prj_exports += "$$header $$deploy.path$$exportheaders.path/$$basename(header)" -} diff -r 8a14024f954a -r cfe32394fcd5 stif/QtUI/StifQtUI/test/main.cpp --- a/stif/QtUI/StifQtUI/test/main.cpp Mon Mar 15 12:46:13 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: QT C++ based Class. -* UnitTest Application entrance. -* -*/ -#include -#include "testcontroller.h" - -QTEST_MAIN(testcontroller) diff -r 8a14024f954a -r cfe32394fcd5 stif/QtUI/StifQtUI/test/readme.txt --- a/stif/QtUI/StifQtUI/test/readme.txt Mon Mar 15 12:46:13 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -Run StfQtUITest - -1, put files under "testsource" folder into "epoc32\winscw\c\testframework" -2, execute: stfqtuitest -o c:\stfqtuitest.log (the output file can be renamed or relocated) diff -r 8a14024f954a -r cfe32394fcd5 stif/QtUI/StifQtUI/test/testcontroller.cpp --- a/stif/QtUI/StifQtUI/test/testcontroller.cpp Mon Mar 15 12:46:13 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,357 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: QT C++ based Class. -* Unit Test to StfQtUI's controller and model. -* -*/ -#include "testcontroller.h" -#include "stfqtuimodel.h" -#include "stfqtuicontroller.h" -#include "cstfcase.h" -#include "cstfmodule.h" -#include - -const QString KConfigFile1 = "c:\\STFQTUI_Test\\testframework1.ini"; -const QString KConfigFile2 = "c:\\STFQTUI_Test\\testframework2.ini"; -const QString KDefaultModuleName = "demomodule"; -const QString KDefaultSetName = "stfqtuitesting.set"; - -testcontroller::testcontroller() - : OnSetListChangedFired(false), - OnCaseStatisticChangedFired(false), - OnRunningCaseChangedFired(false) - { - // TODO Auto-generated constructor stub - model = new StfQtUIModel(); - model->AddStifModelEventListener(this); - controller = new StfQtUIController(model); - controller->AddStfEventListener(this); - controller->OpenEngineIniFile(KConfigFile1); - } - -testcontroller::~testcontroller() - { - // TODO Auto-generated destructor stub - delete controller; - delete model; - } - - -void testcontroller::T_GetModuleList_ModuleNumber() - { - controller->OpenEngineIniFile(KConfigFile1); - int moduleSize = controller->GetModuleList().size(); - QCOMPARE(moduleSize, 1); - } - -void testcontroller::T_GetModuleList_ModuleName() - { - controller->OpenEngineIniFile(KConfigFile1); - QList moduleList = controller->GetModuleList(); - bool find = false; - foreach(QString m, moduleList) - { - if(m.toLower() == KDefaultModuleName) - { - find = true; - break; - } - } - QCOMPARE(find, true); - } - -void testcontroller::T_OpenEngineIniFile_ModuleNumber() - { - controller->OpenEngineIniFile(KConfigFile2); - int moduleSize = controller->GetModuleList().size(); - QCOMPARE(moduleSize, 2); - } - - - -void testcontroller::T_OpenEngineIniFile() - { - bool rst; - rst = controller->OpenEngineIniFile(KConfigFile2); - QCOMPARE(rst, true); - rst = controller->OpenEngineIniFile(KConfigFile1); - QCOMPARE(rst, true); - rst = controller->OpenEngineIniFile(KConfigFile2); - QCOMPARE(rst, true); - rst = controller->OpenEngineIniFile("z:\\abc.ini"); - //QCOMPARE(rst, false); - rst = controller->OpenEngineIniFile(KConfigFile1); - QCOMPARE(rst, true); - } - -void testcontroller::T_GetCaseListByModule() - { - controller->OpenEngineIniFile(KConfigFile1); - QList list = controller->GetCaseListByModule(KDefaultModuleName); - QCOMPARE(list.size(), 6); - list = controller->GetCaseListByModule("null"); - QCOMPARE(list.size(), 0); - - } -void testcontroller::T_GetCase() - { - CSTFCase theCase = controller->GetCase(KDefaultModuleName, 1); - QCOMPARE(theCase.Index(), 1); - theCase = controller->GetCase(KDefaultModuleName, 21); - QCOMPARE(theCase.Index(), -1); - QCOMPARE(theCase.Name(), QString("")); - theCase = controller->GetCase("null", 0); - QCOMPARE(theCase.Name(), QString("")); - } - -void testcontroller::T_GetSetList() - { - OnSetListChangedFired = false; - QList list = controller->GetSetList(); - bool find = false; - foreach(QString set, list) - { - if(set == KDefaultSetName) - { - find = true; - break; - } - } - QCOMPARE(find, true); - QCOMPARE(OnSetListChangedFired, false);//ensure SetListChanged does not be fired. - } - -void testcontroller::T_GetCaseListBySet() - { - OnSetListChangedFired = false; - QList list = controller->GetCaseListBySet(KDefaultSetName); - QCOMPARE(list.size(),5); - list = controller->GetCaseListBySet("null"); - QCOMPARE(list.size(),0); - QCOMPARE(OnSetListChangedFired, false);//ensure SetListChanged does not be fired. - } - -void testcontroller::T_AddCaseToSet() - { - OnSetListChangedFired = false; - QList list = controller->GetSetList(); - int before_count = list.count(); - QList cases; - QList caselist = controller->GetCaseListByModule(KDefaultModuleName); - for(int i=0;iGetCase(KDefaultModuleName, i); - cases.append(theCase); - } - controller->AddCaseToSet(cases, "test1"); - list = controller->GetSetList(); - int after_count = list.count(); - QCOMPARE(before_count + 1, after_count); - QCOMPARE(OnSetListChangedFired, true); - } - -void testcontroller::T_CreateSet() - { - //tested object is still not implemented. - } - -void testcontroller::T_DeleteSet() - { - //tested object is still not implemented. - } - -void testcontroller::T_ShowOutput() - { - QCOMPARE(controller->ShowOutput(), false); - controller->SetShowOutput(true); - QCOMPARE(controller->ShowOutput(), true); - controller->SetShowOutput(false); - QCOMPARE(controller->ShowOutput(), false); - } - -void testcontroller::T_Model_ClearCasesStatus() - { - OnCaseStatisticChangedFired = false; - model->ClearCasesStatus(); - QCOMPARE(OnCaseStatisticChangedFired, true); - QCOMPARE(model->GetCasesByStatus(EStatusExecuted).size(), 0); - QCOMPARE(model->GetCasesByStatus(EStatusPassed).size(), 0); - QCOMPARE(model->GetCasesByStatus(EStatusFailed).size(), 0); - QCOMPARE(model->GetCasesByStatus(EStatusAborted).size(), 0); - QCOMPARE(model->GetCasesByStatus(EStatusCrashed).size(), 0); - } - -void testcontroller::T_Model_AddRunningCase_RemoveRunningCase() - { - CStartedTestCase* startedCase = 0; - CSTFCase aCase; - OnRunningCaseChangedFired = false; - QCOMPARE(model->GetCasesByStatus(EStatusRunning).size(), 0); - model->AddRunningCase(startedCase, aCase); - QCOMPARE(OnRunningCaseChangedFired, true); - QCOMPARE(model->GetCasesByStatus(EStatusRunning).size(), 1); - - OnRunningCaseChangedFired = false; - model->RemoveRunningCase(startedCase); - QCOMPARE(OnRunningCaseChangedFired, true); - QCOMPARE(model->GetCasesByStatus(EStatusRunning).size(), 0); - } - -void testcontroller::T_Model_AddCaseByStatus_GetCasesByStatus() - { - CSTFCase aCase; - model->ClearCasesStatus(); - OnCaseStatisticChangedFired = false; - - QCOMPARE(model->GetCasesByStatus(EStatusExecuted).size(), 0); - model->AddCaseByStatus(EStatusExecuted,aCase); - QCOMPARE(OnCaseStatisticChangedFired, true); - QCOMPARE(model->GetCasesByStatus(EStatusExecuted).size(), 1); - - OnCaseStatisticChangedFired = false; - QCOMPARE(model->GetCasesByStatus(EStatusPassed).size(), 0); - model->AddCaseByStatus(EStatusPassed,aCase); - QCOMPARE(OnCaseStatisticChangedFired, true); - QCOMPARE(model->GetCasesByStatus(EStatusPassed).size(), 1); - - OnCaseStatisticChangedFired = false; - QCOMPARE(model->GetCasesByStatus(EStatusFailed).size(), 0); - model->AddCaseByStatus(EStatusFailed,aCase); - QCOMPARE(OnCaseStatisticChangedFired, true); - QCOMPARE(model->GetCasesByStatus(EStatusFailed).size(), 1); - - OnCaseStatisticChangedFired = false; - QCOMPARE(model->GetCasesByStatus(EStatusAborted).size(), 0); - model->AddCaseByStatus(EStatusAborted,aCase); - QCOMPARE(OnCaseStatisticChangedFired, true); - QCOMPARE(model->GetCasesByStatus(EStatusAborted).size(), 1); - - OnCaseStatisticChangedFired = false; - QCOMPARE(model->GetCasesByStatus(EStatusCrashed).size(), 0); - model->AddCaseByStatus(EStatusCrashed,aCase); - QCOMPARE(OnCaseStatisticChangedFired, true); - QCOMPARE(model->GetCasesByStatus(EStatusCrashed).size(), 1); - - model->ClearCasesStatus(); - - } - -void testcontroller::T_RunCase() - { - model->ClearCasesStatus(); - OnCaseStatisticChangedFired = false; - OnRunningCaseChangedFired = false; - controller->OpenEngineIniFile(KConfigFile1); - QList caseList; - caseList.append(controller->GetCase(KDefaultModuleName,2));//math test - controller->RunCases(caseList, Sequentially); - QTest::qWait(2000); - QCOMPARE(OnCaseStatisticChangedFired, true); - QCOMPARE(model->GetCasesByStatus(EStatusRunning).size(), 0); - QCOMPARE(model->GetCasesByStatus(EStatusExecuted).size(), 1); - QCOMPARE(model->GetCasesByStatus(EStatusPassed).size(), 1); - - model->ClearCasesStatus(); - } - - -void testcontroller::T_RunSet() - { - model->ClearCasesStatus(); - //controller->OpenEngineIniFile(KConfigFile1); - QList list = controller->GetCaseListBySet(KDefaultSetName); - QCOMPARE(list.size(),5); - controller->RunSets(KDefaultSetName,Parallel); - QTest::qWait(20000); - QCOMPARE(model->GetCasesByStatus(EStatusExecuted).size(), 5); - QCOMPARE(model->GetCasesByStatus(EStatusPassed).size(), 4); - QCOMPARE(model->GetCasesByStatus(EStatusFailed).size(), 0); - QCOMPARE(model->GetCasesByStatus(EStatusAborted).size(), 0); - QCOMPARE(model->GetCasesByStatus(EStatusCrashed).size(), 1); - model->ClearCasesStatus(); - } - - -void testcontroller::T_PauseCase_ResumeCase() - { - model->ClearCasesStatus(); - OnCaseStatisticChangedFired = false; - OnRunningCaseChangedFired = false; - controller->OpenEngineIniFile(KConfigFile1); - QList caseList; - caseList.append(controller->GetCase(KDefaultModuleName,0)); //loop test - controller->RunCases(caseList, Sequentially); - QTest::qWait(500); - QCOMPARE(OnRunningCaseChangedFired, true); - QCOMPARE(model->GetCasesByStatus(EStatusRunning).size(), 1); - QCOMPARE(model->GetCasesByStatus(EStatusExecuted).size(), 0); - controller->PauseCase(); - QTest::qWait(15000); - QCOMPARE(model->GetCasesByStatus(EStatusRunning).size(), 1); - controller->ResumeCase(); - QTest::qWait(15000); - QCOMPARE(OnCaseStatisticChangedFired, true); - QCOMPARE(model->GetCasesByStatus(EStatusRunning).size(), 0); - QCOMPARE(model->GetCasesByStatus(EStatusExecuted).size(), 1); - QCOMPARE(model->GetCasesByStatus(EStatusPassed).size(), 1); - - } - -void testcontroller::T_AbortCase() - { - model->ClearCasesStatus(); - OnCaseStatisticChangedFired = false; - OnRunningCaseChangedFired = false; - controller->OpenEngineIniFile(KConfigFile1); - QList caseList; - caseList.append(controller->GetCase(KDefaultModuleName,0)); //loop test - controller->RunCases(caseList, Sequentially); - QTest::qWait(500); - QCOMPARE(OnRunningCaseChangedFired, true); - QCOMPARE(model->GetCasesByStatus(EStatusRunning).size(), 1); - QCOMPARE(model->GetCasesByStatus(EStatusExecuted).size(), 0); - controller->AbortCase(); - QTest::qWait(1000); - QCOMPARE(OnCaseStatisticChangedFired, true); - QCOMPARE(model->GetCasesByStatus(EStatusRunning).size(), 0); - QCOMPARE(model->GetCasesByStatus(EStatusExecuted).size(), 0); - QCOMPARE(model->GetCasesByStatus(EStatusAborted).size(), 1); - } - - -//=========================================================== -void testcontroller::OnSetListChanged() - { - OnSetListChangedFired = true; - } - -void testcontroller::OnCaseStatisticChanged() - { - OnCaseStatisticChangedFired = true; - } - -void testcontroller::OnRunningCaseChanged() - { - OnRunningCaseChangedFired = true; - } - -void testcontroller::OnGetMessage(const QString& /*aMessage*/) - { - //nothing. - } - -void testcontroller::OnCaseOutputChanged(const CaseOutputCommand& /*cmd*/, - const QString& , const QString&) - {} - diff -r 8a14024f954a -r cfe32394fcd5 stif/QtUI/StifQtUI/test/testcontroller.h --- a/stif/QtUI/StifQtUI/test/testcontroller.h Mon Mar 15 12:46:13 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,126 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: QT C++ based Class. -* Unit Test to StfQtUI's controller and model. -* -*/ -#ifndef TESTCONTROLLER_H_ -#define TESTCONTROLLER_H_ -#include -#include "istfqtuicontroller.h" -#include "istfqtuimodel.h" - - -class testcontroller: public QObject, public IStfEventListener, public IStifModelEventListener - { - Q_OBJECT - private slots: - /* operation: - * GetModuleList(); - * check: - * module's number. - * */ - void T_GetModuleList_ModuleNumber(); - /* operation: - * GetModuleList(); - * check: - * module's name. - */ - void T_GetModuleList_ModuleName(); - /*operation: - * OpenEngineIniFile(); - * GetModuleList(); - * check: - * module's number. - * - * */ - void T_OpenEngineIniFile_ModuleNumber(); - - /*operation: - * OpenEngineIniFile(); - * check: - * return value; - * */ - void T_OpenEngineIniFile(); - - /*operation: - * GetCaseListByModule(); with currect moduleName - * check: - * case List number. - * */ - void T_GetCaseListByModule(); - - /*operation: - * GetCase(); - *check: - * return value of the case. - * */ - void T_GetCase(); - - void T_GetSetList(); - - void T_GetCaseListBySet(); - - void T_AddCaseToSet(); - - void T_CreateSet(); - - void T_DeleteSet(); - - void T_ShowOutput(); - - void T_RunCase(); - - void T_RunSet(); - - void T_PauseCase_ResumeCase(); - - void T_AbortCase(); - - void T_Model_ClearCasesStatus(); - - void T_Model_AddCaseByStatus_GetCasesByStatus(); - - void T_Model_AddRunningCase_RemoveRunningCase(); - - - -public: - testcontroller(); - virtual ~testcontroller(); - -public: //Implement IStfEventListener - void OnGetMessage(const QString& aMessage); - void OnSetListChanged(); - void OnCaseOutputChanged(const IStfEventListener::CaseOutputCommand& cmd, const QString& index, const QString& msg); - - -public: //Implement IStifModelEventListener - void OnCaseStatisticChanged() ; - void OnRunningCaseChanged() ; - - -private: - bool OnSetListChangedFired; - bool OnCaseStatisticChangedFired; - bool OnRunningCaseChangedFired; - -private: - IStfQtUIController* controller; - IStfQtUIModel* model; - - - }; - -#endif /* TESTCONTROLLER_H_ */ diff -r 8a14024f954a -r cfe32394fcd5 stif/QtUI/StifQtUI/test/testresource/TestFramework1.ini --- a/stif/QtUI/StifQtUI/test/testresource/TestFramework1.ini Mon Mar 15 12:46:13 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,217 +0,0 @@ -# -# This is STIF initialization file -# Comment lines start with '#'-character. -# See STIF TestFramework users guide.doc for instructions - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set following test engine settings: -# - Set Test Reporting mode. TestReportMode's possible values are: -# + 'Summary': Summary of the tested test cases. -# + 'Environment': Hardware and software info. -# + 'TestCases': Test case report. -# + 'FullReport': Set of all above ones. -# + Example 'TestReportMode= Summary TestCases' -# -# - CreateTestReport setting controls report creation mode -# + YES, Test report will created. -# + NO, No Test report. -# -# - File path indicates the base path of the test report. -# - File name indicates the name of the test report. -# -# - File format indicates the type of the test report. -# + TXT, Test report file will be txt type, for example 'TestReport.txt'. -# + HTML, Test report will be html type, for example 'TestReport.html'. -# + XML, Test report will be xml type, for example 'TestReport.xml'. -# Note, that xml format is available only when output is set to FILE. -# -# - File output indicates output source of the test report. -# + FILE, Test report logging to file. -# + RDEBUG, Test report logging to using rdebug. -# -# - File Creation Mode indicates test report overwriting if file exist. -# + OVERWRITE, Overwrites if the Test report file exist. -# + APPEND, Continue logging after the old Test report information if -# report exist. -# - Sets a device reset module's dll name(Reboot). -# + If Nokia specific reset module is not available or it is not correct one -# StifHWResetStub module may use as a template for user specific reset -# module. -# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation -# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 -# - -[Engine_Defaults] - -TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', - # 'TestCases' or 'FullReport' - -CreateTestReport= YES # Possible values: YES or NO - -TestReportFilePath= C:\LOGS\TestFramework\ -TestReportFileName= TestReport - -TestReportFormat= TXT # Possible values: TXT, HTML or XML -TestReportOutput= FILE # Possible values: FILE or RDEBUG -TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND - -DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting - -DisableMeasurement= stifmeasurementdisablenone # Possible values are: - # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' - # 'stifmeasurementplugin01', 'stifmeasurementplugin02', - # 'stifmeasurementplugin03', 'stifmeasurementplugin04', - # 'stifmeasurementplugin05' or 'stifbappeaprofiler' - -Timeout= 0 # Default timeout value for each test case. In milliseconds -#UITestingSupport= YES # Possible values: YES or NO -#SeparateProcesses= YES # Possible values: YES or NO (default: NO) -[End_Defaults] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Module configurations start -# Modules are added between module tags -# tags. Module name is specified after ModuleName= tag, like -# ModuleName= XXXXXXXXX -# Modules might have initialisation file, specified as -# IniFile= c:\testframework\YYYYYY -# Modules might have several configuration files, like -# TestCaseFile= c:\testframework\NormalCases.txt -# TestCaseFile= c:\testframework\SmokeCases.txt -# TestCaseFile= c:\testframework\ManualCases.txt - -# (TestCaseFile is synonym for old term ConfigFile) - -# Following case specifies demo module settings. Demo module -# does not read any settings from file, so tags -# IniFile and TestCaseFile are not used. -# In the simplest case it is enough to specify only the -# name of the test module when adding new test module - -[New_Module] -ModuleName= demomodule -[End_Module] - - -# Load testmoduleXXX, optionally with initialization file and/or test case files -#[New_Module] -#ModuleName= testmodulexxx - -#TestModuleXXX used initialization file -#IniFile= c:\testframework\init.txt - -#TestModuleXXX used configuration file(s) -#TestCaseFile= c:\testframework\testcases1.cfg -#TestCaseFile= c:\testframework\testcases2.cfg -#TestCaseFile= c:\testframework\manualtestcases.cfg - -#[End_Module] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set STIF logging overwrite parameters for Logger. -# Hardware and emulator environment logging path and styles can -# be configured from here to overwrite the Logger's implemented values. -# -# Settings description: -# - Indicates option for creation log directory/directories. If log directory/directories -# is/are not created by user they will make by software. -# + YES, Create log directory/directories if not allready exist. -# + NO, Log directory/directories not created. Only created one is used. -# -# - Overwrite emulator path setting. -# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined -# Logger's path 'D:\\LOGS\\Module\\' with those definition the path -# will be 'C:\LOGS\TestFramework\LOGS\Module\' -# -# - Overwrite emulator's logging format. -# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. -# + HTML, Log file(s) will be html type(s), for example 'Module.html'. -# -# - Overwrited emulator logging output source. -# + FILE, Logging to file(s). -# + RDEBUG, Logging to using rdebug(s). -# -# - Overwrite hardware path setting (Same description as above in emulator path). -# - Overwrite hardware's logging format(Same description as above in emulator format). -# - Overwrite hardware's logging output source(Same description as above in emulator output). -# -# - File Creation Mode indicates file overwriting if file exist. -# + OVERWRITE, Overwrites if file(s) exist. -# + APPEND, Continue logging after the old logging information if file(s) exist. -# -# - Will thread id include to the log filename. -# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. -# + NO, No thread id to log file(s), Example filename 'Module.txt'. -# -# - Will time stamps include the to log file. -# + YES, Time stamp added to each line in log file(s). Time stamp is -# for example'12.Nov.2003 115958 LOGGING INFO' -# + NO, No time stamp(s). -# -# - Will line breaks include to the log file. -# + YES, Each logging event includes line break and next log event is in own line. -# + NO, No line break(s). -# -# - Will event ranking include to the log file. -# + YES, Event ranking number added to each line in log file(s). Ranking number -# depends on environment's tics, for example(includes time stamp also) -# '012 12.Nov.2003 115958 LOGGING INFO' -# + NO, No event ranking. -# -# - Will write log file in unicode format. -# + YES, Log file will be written in unicode format -# + NO, Log will be written as normal, not unicode, file. -# - -[Logger_Defaults] - -#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' -#NOTE: TestEngine and TestServer logging settings cannot change here - -CreateLogDirectories= YES # Possible values: YES or NO - -EmulatorBasePath= C:\LOGS\TestFramework\ -EmulatorFormat= HTML # Possible values: TXT or HTML -EmulatorOutput= FILE # Possible values: FILE or RDEBUG - -HardwareBasePath= D:\LOGS\TestFramework\ -HardwareFormat= HTML # Possible values: TXT or HTML -HardwareOutput= FILE # Possible values: FILE or RDEBUG - -FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND - -ThreadIdToLogFile= YES # Possible values: YES or NO -WithTimeStamp= YES # Possible values: YES or NO -WithLineBreak= YES # Possible values: YES or NO -WithEventRanking= YES # Possible values: YES or NO - -FileUnicode= YES # Possible values: YES or NO -AddTestCaseTitle= YES # Possible values: YES or NO -[End_Logger_Defaults] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set filters to be used by ConsoleUI. -# If you want to use filter with ConsoleUI, simply remove comments -# from section below and provide valid filter entries. -# Each filter line has to start with "filter= " keyword. -# Filter can contain special wildcard characters: -# * which stands for none or any literal; -# ? which stands for single character. -# Filters are not case-sensitive. - -#[Filters] -#filter= *math* -#filter= *radio* -#[End_Filters] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - -# End of file diff -r 8a14024f954a -r cfe32394fcd5 stif/QtUI/StifQtUI/test/testresource/TestFramework2.ini --- a/stif/QtUI/StifQtUI/test/testresource/TestFramework2.ini Mon Mar 15 12:46:13 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,221 +0,0 @@ -# -# This is STIF initialization file -# Comment lines start with '#'-character. -# See STIF TestFramework users guide.doc for instructions - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set following test engine settings: -# - Set Test Reporting mode. TestReportMode's possible values are: -# + 'Summary': Summary of the tested test cases. -# + 'Environment': Hardware and software info. -# + 'TestCases': Test case report. -# + 'FullReport': Set of all above ones. -# + Example 'TestReportMode= Summary TestCases' -# -# - CreateTestReport setting controls report creation mode -# + YES, Test report will created. -# + NO, No Test report. -# -# - File path indicates the base path of the test report. -# - File name indicates the name of the test report. -# -# - File format indicates the type of the test report. -# + TXT, Test report file will be txt type, for example 'TestReport.txt'. -# + HTML, Test report will be html type, for example 'TestReport.html'. -# + XML, Test report will be xml type, for example 'TestReport.xml'. -# Note, that xml format is available only when output is set to FILE. -# -# - File output indicates output source of the test report. -# + FILE, Test report logging to file. -# + RDEBUG, Test report logging to using rdebug. -# -# - File Creation Mode indicates test report overwriting if file exist. -# + OVERWRITE, Overwrites if the Test report file exist. -# + APPEND, Continue logging after the old Test report information if -# report exist. -# - Sets a device reset module's dll name(Reboot). -# + If Nokia specific reset module is not available or it is not correct one -# StifHWResetStub module may use as a template for user specific reset -# module. -# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation -# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 -# - -[Engine_Defaults] - -TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', - # 'TestCases' or 'FullReport' - -CreateTestReport= YES # Possible values: YES or NO - -TestReportFilePath= C:\LOGS\TestFramework\ -TestReportFileName= TestReport - -TestReportFormat= TXT # Possible values: TXT, HTML or XML -TestReportOutput= FILE # Possible values: FILE or RDEBUG -TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND - -DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting - -DisableMeasurement= stifmeasurementdisablenone # Possible values are: - # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' - # 'stifmeasurementplugin01', 'stifmeasurementplugin02', - # 'stifmeasurementplugin03', 'stifmeasurementplugin04', - # 'stifmeasurementplugin05' or 'stifbappeaprofiler' - -Timeout= 0 # Default timeout value for each test case. In milliseconds -#UITestingSupport= YES # Possible values: YES or NO -#SeparateProcesses= YES # Possible values: YES or NO (default: NO) -[End_Defaults] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Module configurations start -# Modules are added between module tags -# tags. Module name is specified after ModuleName= tag, like -# ModuleName= XXXXXXXXX -# Modules might have initialisation file, specified as -# IniFile= c:\testframework\YYYYYY -# Modules might have several configuration files, like -# TestCaseFile= c:\testframework\NormalCases.txt -# TestCaseFile= c:\testframework\SmokeCases.txt -# TestCaseFile= c:\testframework\ManualCases.txt - -# (TestCaseFile is synonym for old term ConfigFile) - -# Following case specifies demo module settings. Demo module -# does not read any settings from file, so tags -# IniFile and TestCaseFile are not used. -# In the simplest case it is enough to specify only the -# name of the test module when adding new test module - -[New_Module] -ModuleName= demomodule -[End_Module] - - -[New_Module] -ModuleName= stf_ut -[End_Module] - -# Load testmoduleXXX, optionally with initialization file and/or test case files -#[New_Module] -#ModuleName= testmodulexxx - -#TestModuleXXX used initialization file -#IniFile= c:\testframework\init.txt - -#TestModuleXXX used configuration file(s) -#TestCaseFile= c:\testframework\testcases1.cfg -#TestCaseFile= c:\testframework\testcases2.cfg -#TestCaseFile= c:\testframework\manualtestcases.cfg - -#[End_Module] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set STIF logging overwrite parameters for Logger. -# Hardware and emulator environment logging path and styles can -# be configured from here to overwrite the Logger's implemented values. -# -# Settings description: -# - Indicates option for creation log directory/directories. If log directory/directories -# is/are not created by user they will make by software. -# + YES, Create log directory/directories if not allready exist. -# + NO, Log directory/directories not created. Only created one is used. -# -# - Overwrite emulator path setting. -# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined -# Logger's path 'D:\\LOGS\\Module\\' with those definition the path -# will be 'C:\LOGS\TestFramework\LOGS\Module\' -# -# - Overwrite emulator's logging format. -# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. -# + HTML, Log file(s) will be html type(s), for example 'Module.html'. -# -# - Overwrited emulator logging output source. -# + FILE, Logging to file(s). -# + RDEBUG, Logging to using rdebug(s). -# -# - Overwrite hardware path setting (Same description as above in emulator path). -# - Overwrite hardware's logging format(Same description as above in emulator format). -# - Overwrite hardware's logging output source(Same description as above in emulator output). -# -# - File Creation Mode indicates file overwriting if file exist. -# + OVERWRITE, Overwrites if file(s) exist. -# + APPEND, Continue logging after the old logging information if file(s) exist. -# -# - Will thread id include to the log filename. -# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. -# + NO, No thread id to log file(s), Example filename 'Module.txt'. -# -# - Will time stamps include the to log file. -# + YES, Time stamp added to each line in log file(s). Time stamp is -# for example'12.Nov.2003 115958 LOGGING INFO' -# + NO, No time stamp(s). -# -# - Will line breaks include to the log file. -# + YES, Each logging event includes line break and next log event is in own line. -# + NO, No line break(s). -# -# - Will event ranking include to the log file. -# + YES, Event ranking number added to each line in log file(s). Ranking number -# depends on environment's tics, for example(includes time stamp also) -# '012 12.Nov.2003 115958 LOGGING INFO' -# + NO, No event ranking. -# -# - Will write log file in unicode format. -# + YES, Log file will be written in unicode format -# + NO, Log will be written as normal, not unicode, file. -# - -[Logger_Defaults] - -#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' -#NOTE: TestEngine and TestServer logging settings cannot change here - -CreateLogDirectories= YES # Possible values: YES or NO - -EmulatorBasePath= C:\LOGS\TestFramework\ -EmulatorFormat= HTML # Possible values: TXT or HTML -EmulatorOutput= FILE # Possible values: FILE or RDEBUG - -HardwareBasePath= D:\LOGS\TestFramework\ -HardwareFormat= HTML # Possible values: TXT or HTML -HardwareOutput= FILE # Possible values: FILE or RDEBUG - -FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND - -ThreadIdToLogFile= YES # Possible values: YES or NO -WithTimeStamp= YES # Possible values: YES or NO -WithLineBreak= YES # Possible values: YES or NO -WithEventRanking= YES # Possible values: YES or NO - -FileUnicode= YES # Possible values: YES or NO -AddTestCaseTitle= YES # Possible values: YES or NO -[End_Logger_Defaults] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set filters to be used by ConsoleUI. -# If you want to use filter with ConsoleUI, simply remove comments -# from section below and provide valid filter entries. -# Each filter line has to start with "filter= " keyword. -# Filter can contain special wildcard characters: -# * which stands for none or any literal; -# ? which stands for single character. -# Filters are not case-sensitive. - -#[Filters] -#filter= *math* -#filter= *radio* -#[End_Filters] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - -# End of file diff -r 8a14024f954a -r cfe32394fcd5 stif/QtUI/StifQtUI/test/testresource/stfqtuitesting.set --- a/stif/QtUI/StifQtUI/test/testresource/stfqtuitesting.set Mon Mar 15 12:46:13 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -[TestSetStart] -TestSetName= stfqtuitesting.set -LastStartedCaseIndex= 0000000000 - -[TestSetCaseStart] -ModuleName= demomodule -Title= Loop test -TestCaseNum= 0 -Priority= 0 -Timeout= 0 0 -ExpectedResult= 0 -[TestSetCaseEnd] - -[TestSetCaseStart] -ModuleName= demomodule -Title= Math test -TestCaseNum= 2 -Priority= 0 -Timeout= 0 0 -ExpectedResult= 0 -[TestSetCaseEnd] - -[TestSetCaseStart] -ModuleName= demomodule -Title= Print test -TestCaseNum= 3 -Priority= 0 -Timeout= 0 0 -ExpectedResult= 0 -[TestSetCaseEnd] - -[TestSetCaseStart] -ModuleName= demomodule -Title= Heap memory allocation with OOM (aborts) -TestCaseNum= 4 -Priority= 0 -Timeout= 0 0 -ExpectedResult= 0 -[TestSetCaseEnd] - -[TestSetCaseStart] -ModuleName= demomodule -Title= Heap memory allocation (passes) -TestCaseNum= 5 -Priority= 0 -Timeout= 0 0 -ExpectedResult= 0 -[TestSetCaseEnd] - -[TestSetEnd] diff -r 8a14024f954a -r cfe32394fcd5 stif/QtUI/StifQtUI/uisetting.cpp --- a/stif/QtUI/StifQtUI/uisetting.cpp Mon Mar 15 12:46:13 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,104 +0,0 @@ -/* - * uisetting.cpp - * - * Created on: 2010-2-8 - * Author: y183zhan - */ - -#include -#include -#include -#include "uisetting.h" -const QString SETTINGFILE = "c:\\TestFramework\\StfQtUISetting.ini"; - -UiSetting::UiSetting() - { - if(!load()) - { - loadDefault(); - } - } - -UiSetting::~UiSetting() - { - } - -QString UiSetting::ReadSetting(const QString& item) - { - QString value = ""; - if(settingList.contains(item)) - { - value = settingList.value(item); - } - return value; - } - - -void UiSetting::SetSetting(const QString& item, const QString& value) - { - if(settingList.contains(item)) - { - settingList.remove(item); - } - settingList.insert(item, value); - save(); - } - - -void UiSetting::loadDefault() - { - settingList.clear(); - settingList.insert("showoutput", "true"); - //add mor default setting here. - } - - -bool UiSetting::load() - { - QFile file(SETTINGFILE); - if(!file.open(QIODevice::ReadOnly)) - { - return false; - } - QTextStream in(&file); - QString line, item, value; - int index; - while(!in.atEnd()) - { - line = in.readLine().trimmed().toLower(); - if(!line.startsWith("//")) - { - index = line.indexOf("="); - if(index > 0 && index < line.length() - 1) - { - item = line.left(index).trimmed(); - value = line.right(line.length() - index -1); - settingList.insert(item, value); - } - } - //end while. - } - return true; - } - -bool UiSetting::save() - { - QFile file(SETTINGFILE); - if(!file.open(QIODevice::WriteOnly)) - { - return false; - } - QTextStream in(&file); - in << "//STFQtUI Setting.\r\n"; - in << "//Created at: " + QDateTime::currentDateTime().toString("yyyy.mm.dd hh:mm::ss"); - in << "\r\n"; - for(int i=0;i< settingList.size();i++) - { - in << settingList.keys()[i]; - in << "="; - in << settingList.value(settingList.keys()[i]); - in << "\r\n"; - } - return true; - } - diff -r 8a14024f954a -r cfe32394fcd5 stif/QtUI/StifQtUI/uisetting.h --- a/stif/QtUI/StifQtUI/uisetting.h Mon Mar 15 12:46:13 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* - * uisetting.h - * - * Created on: 2010-2-8 - * Author: y183zhan - */ - -#ifndef UISETTING_H_ -#define UISETTING_H_ -#include - -class UiSetting - { -public: - UiSetting(); - ~UiSetting(); - -public: - QString ReadSetting(const QString& item); - void SetSetting(const QString& item,const QString& value); - -private: - bool load(); - bool save(); - void loadDefault(); - -private: - QHash settingList; - }; - -#endif /* UISETTING_H_ */ diff -r 8a14024f954a -r cfe32394fcd5 stif/QtUI/StifQtUI/version.h --- a/stif/QtUI/StifQtUI/version.h Mon Mar 15 12:46:13 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: STIF version declaration -* -*/ - -#ifndef VERSION_H_ -#define VERSION_H_ - -#define STIF_MAJOR_VERSION 7 -#define STIF_MINOR_VERSION 3 -#define STIF_BUILD_VERSION 26 - -#define STIF_REL_DATE "09th Feb 2010" - -#define TO_UNICODE(text) _L(text) - -#endif /*VERSION_H_*/ diff -r 8a14024f954a -r cfe32394fcd5 stif/QtUI/readme.txt --- a/stif/QtUI/readme.txt Mon Mar 15 12:46:13 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -StifQtUI project is written by QT C++ and Symbian C++. -It should be compiled by QT for S60 4.6.0 under proper S60 SDK. - -You can get QT for S60 from: http://qt.nokia.com/downloads/downloads - - diff -r 8a14024f954a -r cfe32394fcd5 stif/TestEngine/src/TestEngine.cpp --- a/stif/TestEngine/src/TestEngine.cpp Mon Mar 15 12:46:13 2010 +0200 +++ b/stif/TestEngine/src/TestEngine.cpp Thu Apr 01 00:00:49 2010 +0300 @@ -1351,7 +1351,12 @@ SetLoggerSettings( loggerSettings ) ; - ReadTestModulesL( parser ); + TRAP(r, ReadTestModulesL( parser )); + if(r != KErrNone) + { + __TRACE(KError, (CStifLogger::ERed, _L("Reading test modules finished with error [%d]"), r)); + User::Leave(r); + } CleanupStack::PopAndDestroy( settings ); CleanupStack::PopAndDestroy( parser ); @@ -1830,8 +1835,11 @@ sectionParser = aParser->SectionL(aSectionStart, aSectionEnd); + TBool sectionOK; + while(sectionParser) { + sectionOK = ETrue; __TRACE(KInit, (_L("Found '%S' and '%S' sections"), &aSectionStart, &aSectionEnd)); CleanupStack::PushL(sectionParser); __TRACE(KInit, (_L("Starting to read module information"))); @@ -1842,121 +1850,130 @@ CleanupStack::PushL(item); if(!item) { - CleanupStack::PopAndDestroy(item); - __TRACE(KError, (CStifLogger::ERed, _L("'%S' not found from Module section"), &KModuleName)); - LeaveIfErrorWithNotify(KErrNotFound); + __TRACE(KError, (CStifLogger::ERed, _L("'%S' not found from Module section. Skipping whole section."), &KModuleName)); + sectionOK = EFalse; } else { __TRACE(KInit, (_L("'%S' found"), &KModuleName)); } - TPtrC name; TName moduleName; TInt ret(KErrNone); - ret = item->GetString(KModuleName, name); - if(ret != KErrNone) - { - CleanupStack::PopAndDestroy(item); - __TRACE(KError, (CStifLogger::ERed, _L("Module name parsing left with error %d"), ret)); - LeaveIfErrorWithNotify(ret); - } - else + + if(sectionOK) { - __TRACE(KInit, (_L("Module '%S' found from ini-file"), &name)); - moduleName.Copy(name); - moduleName.LowerCase(); - ret = aModuleList->AddTestModule(moduleName); - if(ret != KErrNone && ret != KErrAlreadyExists) + TPtrC name; + ret = item->GetString(KModuleName, name); + if(ret != KErrNone) + { + __TRACE(KError, (CStifLogger::ERed, _L("Module name parsing ended with error [%d]. Skipping whole section"), ret)); + sectionOK = EFalse; + } + else { - CleanupStack::PopAndDestroy(item); - __TRACE(KError, (CStifLogger::ERed, _L("Could not add module to list of modules. Error %d"), ret)); - LeaveIfErrorWithNotify(ret); - } + __TRACE(KInit, (_L("Module '%S' found from ini-file"), &name)); + moduleName.Copy(name); + moduleName.LowerCase(); + ret = aModuleList->AddTestModule(moduleName); + if(ret != KErrNone && ret != KErrAlreadyExists) + { + CleanupStack::PopAndDestroy(item); + __TRACE(KError, (CStifLogger::ERed, _L("Could not add module to list of modules. Error %d"), ret)); + LeaveIfErrorWithNotify(ret); + } + } } CleanupStack::PopAndDestroy(item); //Get pointer to added module - CTestModuleInfo* moduleInfo = aModuleList->GetModule(moduleName); - if(!moduleInfo) - { - __TRACE(KError, (CStifLogger::ERed, _L("Could not add get module info from list"))); - LeaveIfErrorWithNotify(KErrNotFound); - } - - // Get ini file, if it exists - __TRACE(KInit, (_L("Start parsing ini file"))); - _LIT(KIniFile, "IniFile="); - item = sectionParser->GetItemLineL(KIniFile); - if(item) + if(sectionOK) { - __TRACE(KInit, (_L("'%S' found"), &KIniFile)); - CleanupStack::PushL(item); - TPtrC iniFile; - ret = item->GetString(KIniFile, iniFile); - if(ret == KErrNone) + CTestModuleInfo* moduleInfo = aModuleList->GetModule(moduleName); + if(!moduleInfo) + { + __TRACE(KError, (CStifLogger::ERed, _L("Could not add get module info from list"))); + LeaveIfErrorWithNotify(KErrNotFound); + } + + // Get ini file, if it exists + __TRACE(KInit, (_L("Start parsing ini file"))); + _LIT(KIniFile, "IniFile="); + item = sectionParser->GetItemLineL(KIniFile); + if(item) { - // Module inifile (might be empty) OK - TFileName filename; - filename.Copy(iniFile); - TStifUtil::CorrectFilePathL( filename ); - filename.LowerCase(); - __TRACE(KInit, (CStifLogger::EBold, _L("Initialization file '%S' found, file can be empty"), &iniFile)); - moduleInfo->SetIniFile(filename); + __TRACE(KInit, (_L("'%S' found"), &KIniFile)); + CleanupStack::PushL(item); + TPtrC iniFile; + ret = item->GetString(KIniFile, iniFile); + if(ret == KErrNone) + { + // Module inifile (might be empty) OK + TFileName filename; + filename.Copy(iniFile); + TStifUtil::CorrectFilePathL( filename ); + filename.LowerCase(); + __TRACE(KInit, (CStifLogger::EBold, _L("Initialization file '%S' found, file can be empty"), &iniFile)); + moduleInfo->SetIniFile(filename); + } + else + { + __TRACE(KInit, (_L("Initialization file not found"))); + } + CleanupStack::PopAndDestroy(item); } else { - __TRACE(KInit, (_L("Initialization file not found"))); + __TRACE(KInit, (_L("'%S' not found"), &KIniFile)); } - CleanupStack::PopAndDestroy(item); + + // Get config (testcase) file + __TRACE(KInit, (_L("Start parsing cfg files"))); + TPtrC cfgTag; + for(TInt i = 0; i < 2; i++) + { + //Set tag for config files + if(i == 0) + { + cfgTag.Set(_L("ConfigFile=")); + } + else + { + cfgTag.Set(_L("TestCaseFile=")); + } + //Read data + item = sectionParser->GetItemLineL(cfgTag); + while(item) + { + CleanupStack::PushL(item); + __TRACE(KInit, (_L("Item '%S' found"), &cfgTag)); + TPtrC cfgFile; + ret = item->GetString(cfgTag, cfgFile); + if(ret == KErrNone) + { + TFileName ifile; + ifile.Copy(cfgFile); + TStifUtil::CorrectFilePathL( ifile ); + ifile.LowerCase(); + __TRACE(KInit, (_L("Configuration file '%S' found"), &ifile)); + moduleInfo->AddCfgFile(ifile); + } + else + { + __TRACE(KInit, (_L("Configuration file not found"))); + } + CleanupStack::PopAndDestroy(item); + item = sectionParser->GetNextItemLineL(cfgTag); + } + } + + __TRACE(KInit, (_L("Module '%S' information read correctly"), &moduleName)); } else { - __TRACE(KInit, (_L("'%S' not found"), &KIniFile)); + __TRACE(KError, (_L("Module '%S' information skipped"), &moduleName)); } - // Get config (testcase) file - __TRACE(KInit, (_L("Start parsing cfg files"))); - TPtrC cfgTag; - for(TInt i = 0; i < 2; i++) - { - //Set tag for config files - if(i == 0) - { - cfgTag.Set(_L("ConfigFile=")); - } - else - { - cfgTag.Set(_L("TestCaseFile=")); - } - //Read data - item = sectionParser->GetItemLineL(cfgTag); - while(item) - { - CleanupStack::PushL(item); - __TRACE(KInit, (_L("Item '%S' found"), &cfgTag)); - TPtrC cfgFile; - ret = item->GetString(cfgTag, cfgFile); - if(ret == KErrNone) - { - TFileName ifile; - ifile.Copy(cfgFile); - TStifUtil::CorrectFilePathL( ifile ); - ifile.LowerCase(); - __TRACE(KInit, (_L("Configuration file '%S' found"), &ifile)); - moduleInfo->AddCfgFile(ifile); - } - else - { - __TRACE(KInit, (_L("Configuration file not found"))); - } - CleanupStack::PopAndDestroy(item); - item = sectionParser->GetNextItemLineL(cfgTag); - } - } - - __TRACE(KInit, (_L("Module '%S' information read correctly"), &moduleName)); - // Get next section... CleanupStack::PopAndDestroy(sectionParser); sectionParser = aParser->NextSectionL(aSectionStart, aSectionEnd); @@ -1998,7 +2015,12 @@ _LIT(KTestModuleEnd, "[End_Module]"); __TRACE(KInit, (_L("Starting to search module sections"))); - ParseTestModulesL(aParser, moduleList, KTestModuleStart, KTestModuleEnd); + TRAPD(err, ParseTestModulesL(aParser, moduleList, KTestModuleStart, KTestModuleEnd)); + if(err != KErrNone) + { + __TRACE(KError, (CStifLogger::ERed, _L("Parsing test modules returned error [%d]"), err)); + User::Leave(err); + } __TRACE(KInit, (CStifLogger::EBold, _L("End parsing test modules"))); __TRACE(KInit, (_L(""))); diff -r 8a14024f954a -r cfe32394fcd5 stif/TestInterface/src/TestModuleIf.cpp --- a/stif/TestInterface/src/TestModuleIf.cpp Mon Mar 15 12:46:13 2010 +0200 +++ b/stif/TestInterface/src/TestModuleIf.cpp Thu Apr 01 00:00:49 2010 +0300 @@ -279,6 +279,13 @@ VA_LIST list; VA_START(list,aFmt); TName aBuf; + RBuf buf; + TInt ret = buf.Create(1024); + if(ret != KErrNone) + { + __RDEBUG((_L("STF: Printf: Buffer creation failed [%d]"), ret)); + return; + } // Cut the description length TInt len = aDefinition.Length(); @@ -293,9 +300,17 @@ TDesOverflowHandler overFlowHandler (this, aPriority, shortDescription); // Parse parameters - aBuf.AppendFormatList(aFmt,list, &overFlowHandler); + buf.AppendFormatList(aFmt, list, &overFlowHandler); + + if(buf.Length() == 0) + { + __RDEBUG((_L("STF: Printf: Unable to prepare print buffer (probably printed string is too long)"))); + } // Print + aBuf.Copy(buf.Left(aBuf.MaxLength())); + buf.Close(); + iTestExecution->DoNotifyPrint( aPriority, shortDescription, aBuf ); } diff -r 8a14024f954a -r cfe32394fcd5 stif/TestScripter/src/TestScripter.cpp --- a/stif/TestScripter/src/TestScripter.cpp Mon Mar 15 12:46:13 2010 +0200 +++ b/stif/TestScripter/src/TestScripter.cpp Thu Apr 01 00:00:49 2010 +0300 @@ -2361,14 +2361,17 @@ iTestScripter->TestModuleIf().Printf( KPrintPriLow, _L("Runner"), _L("%S"), &aKeyword ); - TName buf; + RBuf buf; + buf.CreateL(1024); + CleanupClosePushL(buf); + TPtrC tmp; while( aItem->GetNextString( tmp ) == KErrNone ) { if( buf.Length() + tmp.Length() >= buf.MaxLength() ) { - break; + buf.ReAllocL(buf.MaxLength() + tmp.Length() * 10); } buf.Append( tmp ); buf.Append( _L(" ") ); @@ -2378,6 +2381,7 @@ _L("Test"), _L("%S"), &buf); RDebug::Print( _L("Print : Test : %S"), &buf ); + CleanupStack::PopAndDestroy(&buf); } break; case TTestKeywords::EAllowNextResult: diff -r 8a14024f954a -r cfe32394fcd5 stif/group/ReleaseNote.txt --- a/stif/group/ReleaseNote.txt Mon Mar 15 12:46:13 2010 +0200 +++ b/stif/group/ReleaseNote.txt Thu Apr 01 00:00:49 2010 +0300 @@ -1,5 +1,5 @@ ======================================================================== -RELEASE NOTE FOR STIF - STIF_201008 (7.3.27) +RELEASE NOTE FOR STIF - STIF_201010 (7.3.28) SUPPORTING SERIES 60 3.0 -> ======================================================================== diff -r 8a14024f954a -r cfe32394fcd5 stif/inc/version.h --- a/stif/inc/version.h Mon Mar 15 12:46:13 2010 +0200 +++ b/stif/inc/version.h Thu Apr 01 00:00:49 2010 +0300 @@ -20,9 +20,9 @@ #define STIF_MAJOR_VERSION 7 #define STIF_MINOR_VERSION 3 -#define STIF_BUILD_VERSION 27 +#define STIF_BUILD_VERSION 28 -#define STIF_REL_DATE "23th Feb 2010" +#define STIF_REL_DATE "09th Mar 2010" #define TO_UNICODE(text) _L(text) diff -r 8a14024f954a -r cfe32394fcd5 stif/sis/Stif_31.sis Binary file stif/sis/Stif_31.sis has changed