summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@theqtcompany.com>2015-05-04 13:56:44 +0200
committerChristian Stenger <christian.stenger@theqtcompany.com>2015-05-08 09:02:38 +0300
commit2342d6388af1c6a3418055ef01363a569166098a (patch)
tree19d12644ef6d6249f6b88f9c177e3bfc0239dee9
parente0d32a80363759837cc13eb24365f3cd07174da7 (diff)
downloadqt-creator-2342d6388af1c6a3418055ef01363a569166098a.tar.gz
Provide 'Open Squish Suites' functionality
Change-Id: I27ebfed76e2e4dac80751faf69c87f27bb455d21 Reviewed-by: Robert Loehning <robert.loehning@theqtcompany.com>
-rw-r--r--plugins/autotest/autotest.pro13
-rw-r--r--plugins/autotest/autotest.qbs7
-rw-r--r--plugins/autotest/opensquishsuitesdialog.cpp115
-rw-r--r--plugins/autotest/opensquishsuitesdialog.h57
-rw-r--r--plugins/autotest/opensquishsuitesdialog.ui135
-rw-r--r--plugins/autotest/testnavigationwidget.cpp4
-rw-r--r--plugins/autotest/testsquishfilehandler.cpp93
-rw-r--r--plugins/autotest/testsquishfilehandler.h54
-rw-r--r--plugins/autotest/testsquishutils.cpp85
-rw-r--r--plugins/autotest/testsquishutils.h43
-rw-r--r--plugins/autotest/testtreemodel.cpp7
-rw-r--r--plugins/autotest/testtreemodel.h2
12 files changed, 612 insertions, 3 deletions
diff --git a/plugins/autotest/autotest.pro b/plugins/autotest/autotest.pro
index 4d3c6643f2..9b9c7a8a01 100644
--- a/plugins/autotest/autotest.pro
+++ b/plugins/autotest/autotest.pro
@@ -26,7 +26,10 @@ SOURCES += \
testsettings.cpp \
testsettingspage.cpp \
testnavigationwidget.cpp \
- testxmloutputreader.cpp
+ testxmloutputreader.cpp \
+ testsquishfilehandler.cpp \
+ opensquishsuitesdialog.cpp \
+ testsquishutils.cpp
HEADERS += \
testtreeview.h \
@@ -48,13 +51,17 @@ HEADERS += \
testsettings.h \
testsettingspage.h \
testnavigationwidget.h \
- testxmloutputreader.h
+ testxmloutputreader.h \
+ testsquishfilehandler.h \
+ opensquishsuitesdialog.h \
+ testsquishutils.h
RESOURCES += \
autotest.qrc
FORMS += \
- testsettingspage.ui
+ testsettingspage.ui \
+ opensquishsuitesdialog.ui
equals(TEST, 1) {
HEADERS += autotestunittests.h
diff --git a/plugins/autotest/autotest.qbs b/plugins/autotest/autotest.qbs
index 93505bce3b..a9f17682a3 100644
--- a/plugins/autotest/autotest.qbs
+++ b/plugins/autotest/autotest.qbs
@@ -66,6 +66,13 @@ QtcPlugin {
"testvisitor.h",
"testxmloutputreader.cpp",
"testxmloutputreader.h",
+ "testsquishfilehandler.cpp",
+ "testsquishfilehandler.h",
+ "opensquishsuitesdialog.cpp",
+ "opensquishsuitesdialog.h",
+ "opensquishsuitesdialog.ui",
+ "testsquishutils.cpp",
+ "testsquishutils.h"
]
Group {
diff --git a/plugins/autotest/opensquishsuitesdialog.cpp b/plugins/autotest/opensquishsuitesdialog.cpp
new file mode 100644
index 0000000000..978594ee1f
--- /dev/null
+++ b/plugins/autotest/opensquishsuitesdialog.cpp
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd
+** All rights reserved.
+** For any questions to The Qt Company, please use contact form at
+** http://www.qt.io/contact-us
+**
+** This file is part of the Qt Creator Enterprise Auto Test Add-on.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://www.qt.io/contact-us
+**
+****************************************************************************/
+
+#include "opensquishsuitesdialog.h"
+#include "testsquishutils.h"
+#include "ui_opensquishsuitesdialog.h"
+
+#include <QDir>
+#include <QPushButton>
+#include <QListWidgetItem>
+
+namespace Autotest {
+namespace Internal {
+
+OpenSquishSuitesDialog::OpenSquishSuitesDialog(QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::OpenSquishSuitesDialog)
+{
+ ui->setupUi(this);
+ ui->buttonBox->button(QDialogButtonBox::Open)->setEnabled(false);
+
+ connect(ui->directoryLineEdit, &Utils::PathChooser::pathChanged,
+ this, &OpenSquishSuitesDialog::onDirectoryChanged);
+ connect(ui->selectAllPushButton, &QPushButton::clicked,
+ this, &OpenSquishSuitesDialog::selectAll);
+ connect(ui->deselectAllPushButton, &QPushButton::clicked,
+ this, &OpenSquishSuitesDialog::deselectAll);
+ connect(this, &OpenSquishSuitesDialog::accepted,
+ this, &OpenSquishSuitesDialog::setChosenSuites);
+}
+
+OpenSquishSuitesDialog::~OpenSquishSuitesDialog()
+{
+ delete ui;
+}
+
+void OpenSquishSuitesDialog::onDirectoryChanged()
+{
+ ui->suitesListWidget->clear();
+ ui->buttonBox->button(QDialogButtonBox::Open)->setEnabled(false);
+ QDir baseDir(ui->directoryLineEdit->path());
+ if (!baseDir.exists()) {
+ return;
+ }
+
+ foreach (const QFileInfo &subDir, baseDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot)) {
+ if (!subDir.baseName().startsWith(QLatin1String("suite_")))
+ continue;
+
+ if (TestSquishUtils::validTestCases(subDir.absoluteFilePath()).size()) {
+ QListWidgetItem *item = new QListWidgetItem(subDir.baseName(),
+ ui->suitesListWidget);
+ item->setCheckState(Qt::Checked);
+ connect(ui->suitesListWidget, &QListWidget::itemChanged,
+ this, &OpenSquishSuitesDialog::onListItemChanged);
+ }
+ }
+ ui->buttonBox->button(QDialogButtonBox::Open)->setEnabled(ui->suitesListWidget->count());
+}
+
+void OpenSquishSuitesDialog::onListItemChanged(QListWidgetItem *)
+{
+ const int count = ui->suitesListWidget->count();
+ for (int row = 0; row < count; ++row) {
+ if (ui->suitesListWidget->item(row)->checkState() == Qt::Checked) {
+ ui->buttonBox->button(QDialogButtonBox::Open)->setEnabled(true);
+ return;
+ }
+ }
+ ui->buttonBox->button(QDialogButtonBox::Open)->setEnabled(false);
+}
+
+void OpenSquishSuitesDialog::selectAll()
+{
+ const int count = ui->suitesListWidget->count();
+ for (int row = 0; row < count; ++row)
+ ui->suitesListWidget->item(row)->setCheckState(Qt::Checked);
+}
+
+void OpenSquishSuitesDialog::deselectAll()
+{
+ const int count = ui->suitesListWidget->count();
+ for (int row = 0; row < count; ++row)
+ ui->suitesListWidget->item(row)->setCheckState(Qt::Unchecked);
+}
+
+void OpenSquishSuitesDialog::setChosenSuites()
+{
+ const int count = ui->suitesListWidget->count();
+ const QDir baseDir(ui->directoryLineEdit->path());
+ for (int row = 0; row < count; ++row) {
+ QListWidgetItem *item = ui->suitesListWidget->item(row);
+ if (item->checkState() == Qt::Checked)
+ m_chosenSuites.append(QFileInfo(baseDir, item->text()).absoluteFilePath());
+ }
+}
+
+} // namespace Internal
+} // namespace Autotest
diff --git a/plugins/autotest/opensquishsuitesdialog.h b/plugins/autotest/opensquishsuitesdialog.h
new file mode 100644
index 0000000000..62b87e00a1
--- /dev/null
+++ b/plugins/autotest/opensquishsuitesdialog.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd
+** All rights reserved.
+** For any questions to The Qt Company, please use contact form at
+** http://www.qt.io/contact-us
+**
+** This file is part of the Qt Creator Enterprise Auto Test Add-on.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://www.qt.io/contact-us
+**
+****************************************************************************/
+
+#ifndef OPENSQUISHSUITESDIALOG_H
+#define OPENSQUISHSUITESDIALOG_H
+
+#include <QDialog>
+
+class QListWidgetItem;
+
+namespace Ui {
+class OpenSquishSuitesDialog;
+}
+
+namespace Autotest {
+namespace Internal {
+
+class OpenSquishSuitesDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit OpenSquishSuitesDialog(QWidget *parent = 0);
+ ~OpenSquishSuitesDialog();
+ QStringList chosenSuites() const { return m_chosenSuites; }
+
+private:
+ void onDirectoryChanged();
+ void onListItemChanged(QListWidgetItem *);
+ void selectAll();
+ void deselectAll();
+ void setChosenSuites();
+
+ Ui::OpenSquishSuitesDialog *ui;
+ QStringList m_chosenSuites;
+};
+
+} // namespace Internal
+} // namespace Autotest
+
+#endif // OPENSQUISHSUITESDIALOG_H
diff --git a/plugins/autotest/opensquishsuitesdialog.ui b/plugins/autotest/opensquishsuitesdialog.ui
new file mode 100644
index 0000000000..c1fe45de6c
--- /dev/null
+++ b/plugins/autotest/opensquishsuitesdialog.ui
@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>OpenSquishSuitesDialog</class>
+ <widget class="QDialog" name="OpenSquishSuitesDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>303</width>
+ <height>340</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="windowTitle">
+ <string>Open Squish Test Suites</string>
+ </property>
+ <property name="modal">
+ <bool>true</bool>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Base directory:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="Utils::PathChooser" name="directoryLineEdit"/>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Test suites:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QListWidget" name="suitesListWidget"/>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QPushButton" name="selectAllPushButton">
+ <property name="text">
+ <string>Select All</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="deselectAllPushButton">
+ <property name="text">
+ <string>Deselect All</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Open</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>Utils::PathChooser</class>
+ <extends>QLineEdit</extends>
+ <header location="global">utils/pathchooser.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>OpenSquishSuitesDialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>OpenSquishSuitesDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/plugins/autotest/testnavigationwidget.cpp b/plugins/autotest/testnavigationwidget.cpp
index 68565c0b3c..2a15c36013 100644
--- a/plugins/autotest/testnavigationwidget.cpp
+++ b/plugins/autotest/testnavigationwidget.cpp
@@ -18,6 +18,7 @@
****************************************************************************/
#include "testnavigationwidget.h"
+#include "testsquishfilehandler.h"
#include "testtreemodel.h"
#include "testtreeview.h"
#include "testtreeitemdelegate.h"
@@ -139,6 +140,9 @@ bool TestNavigationWidget::handleSquishContextMenuEvent(QContextMenuEvent *event
menu.addAction(createNewTestSuite);
createNewTestSuite->setEnabled(enabled);
+ connect(openSquishSuites, &QAction::triggered,
+ TestSquishFileHandler::instance(), &TestSquishFileHandler::openTestSuites);
+
if (m_view->model()->rowCount(squishIndex) > 0) {
menu.addSeparator();
QAction *closeAllSuites = new QAction(tr("Close All Test Suites"), &menu);
diff --git a/plugins/autotest/testsquishfilehandler.cpp b/plugins/autotest/testsquishfilehandler.cpp
new file mode 100644
index 0000000000..3e8ac46104
--- /dev/null
+++ b/plugins/autotest/testsquishfilehandler.cpp
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd
+** All rights reserved.
+** For any questions to The Qt Company, please use contact form at
+** http://www.qt.io/contact-us
+**
+** This file is part of the Qt Creator Enterprise Auto Test Add-on.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://www.qt.io/contact-us
+**
+****************************************************************************/
+
+#include "opensquishsuitesdialog.h"
+#include "testsquishfilehandler.h"
+#include "testsquishutils.h"
+
+#include <QDir>
+#include <QFileInfo>
+#include <QMessageBox>
+
+namespace Autotest {
+namespace Internal {
+
+static TestSquishFileHandler *m_instance = 0;
+
+TestSquishFileHandler::TestSquishFileHandler(QObject *parent) : QObject(parent)
+{
+ m_instance = this;
+}
+
+TestSquishFileHandler *TestSquishFileHandler::instance()
+{
+ if (!m_instance)
+ m_instance = new TestSquishFileHandler;
+
+ return m_instance;
+}
+
+TestTreeItem createTestTreeItem(const QString &name, const QString &filePath,
+ const QStringList &cases)
+{
+ TestTreeItem item(name, filePath, TestTreeItem::SQUISH_SUITE);
+ foreach (const QString &testCase, cases) {
+ TestTreeItem *child = new TestTreeItem(QFileInfo(testCase).dir().dirName(), testCase,
+ TestTreeItem::SQUISH_TESTCASE, &item);
+ item.appendChild(child);
+ }
+ return item;
+}
+
+void TestSquishFileHandler::openTestSuites()
+{
+ OpenSquishSuitesDialog dialog;
+ dialog.exec();
+ foreach (const QString &suite, dialog.chosenSuites()) {
+ const QDir suiteDir(suite);
+ const QStringList cases = TestSquishUtils::validTestCases(suite);
+ const QFileInfo suiteConf(suiteDir, QLatin1String("suite.conf"));
+ if (m_suites.contains(suiteDir.dirName())) {
+ if (QMessageBox::question(0, tr("Suite Already Open"),
+ tr("A test suite with the name \"%1\" is already open. "
+ "The opened test suite will be closed and replaced "
+ "with the new one.").arg(suiteDir.dirName()),
+ QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Cancel)
+ == QMessageBox::Cancel) {
+ continue;
+ } else {
+ TestTreeItem item = createTestTreeItem(suiteDir.dirName(),
+ suiteConf.absoluteFilePath(), cases);
+ // TODO update file watcher
+ m_suites.insert(suiteDir.dirName(), suiteConf.absoluteFilePath());
+ emit testTreeItemModified(item, TestTreeModel::SquishTest,
+ m_suites.value(suiteDir.dirName()));
+ }
+ } else {
+ TestTreeItem item = createTestTreeItem(suiteDir.dirName(),
+ suiteConf.absoluteFilePath(), cases);
+ // TODO add file watcher
+ m_suites.insert(suiteDir.dirName(), suiteConf.absoluteFilePath());
+ emit testTreeItemCreated(item, TestTreeModel::SquishTest);
+ }
+ }
+}
+
+} // namespace Internal
+} // namespace Autotest
diff --git a/plugins/autotest/testsquishfilehandler.h b/plugins/autotest/testsquishfilehandler.h
new file mode 100644
index 0000000000..66c6ccecdd
--- /dev/null
+++ b/plugins/autotest/testsquishfilehandler.h
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd
+** All rights reserved.
+** For any questions to The Qt Company, please use contact form at
+** http://www.qt.io/contact-us
+**
+** This file is part of the Qt Creator Enterprise Auto Test Add-on.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://www.qt.io/contact-us
+**
+****************************************************************************/
+
+#ifndef TESTSQUISHFILEHANDLER_H
+#define TESTSQUISHFILEHANDLER_H
+
+#include "testtreeitem.h"
+#include "testtreemodel.h"
+
+#include <QObject>
+#include <QString>
+#include <QMap>
+
+namespace Autotest {
+namespace Internal {
+
+class TestSquishFileHandler : public QObject
+{
+ Q_OBJECT
+public:
+ explicit TestSquishFileHandler(QObject *parent = 0);
+ static TestSquishFileHandler *instance();
+
+ void openTestSuites();
+
+signals:
+ void testTreeItemCreated(const TestTreeItem &item, TestTreeModel::Type type);
+ void testTreeItemModified(const TestTreeItem &item, TestTreeModel::Type type, const QString &file);
+
+private:
+ QMap<QString, QString> m_suites;
+
+};
+
+} // namespace Internal
+} // namespace Autotest
+
+#endif // TESTSQUISHFILEHANDLER_H
diff --git a/plugins/autotest/testsquishutils.cpp b/plugins/autotest/testsquishutils.cpp
new file mode 100644
index 0000000000..cafe9cb5ce
--- /dev/null
+++ b/plugins/autotest/testsquishutils.cpp
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd
+** All rights reserved.
+** For any questions to The Qt Company, please use contact form at
+** http://www.qt.io/contact-us
+**
+** This file is part of the Qt Creator Enterprise Auto Test Add-on.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://www.qt.io/contact-us
+**
+****************************************************************************/
+
+#include "testsquishutils.h"
+
+#include <QDir>
+#include <QFileInfo>
+#include <QString>
+#include <QSettings>
+
+namespace Autotest {
+namespace Internal {
+
+const static QString squishLanguageKey = QLatin1String("LANGUAGE");
+const static QString squishTestCasesKey = QLatin1String("TEST_CASES");
+
+QStringList TestSquishUtils::validTestCases(QString baseDirectory)
+{
+ QStringList validCases;
+ QDir subDir(baseDirectory);
+ QFileInfo suiteConf(subDir, QLatin1String("suite.conf"));
+ if (suiteConf.exists()) {
+ QVariantMap conf = readSuiteConf(suiteConf.absoluteFilePath());
+ QString extension = extensionForLanguage(conf.value(squishLanguageKey).toString());
+ QStringList cases = conf.value(squishTestCasesKey).toString().split(
+ QRegExp(QLatin1String("\\s+")));
+
+ foreach (const QString &testCase, cases) {
+ QFileInfo testCaseDirInfo(subDir, testCase);
+ if (testCaseDirInfo.isDir()) {
+ QFileInfo testCaseTestInfo(testCaseDirInfo.filePath(),
+ QLatin1String("test") + extension);
+ if (testCaseTestInfo.isFile())
+ validCases.append(testCaseTestInfo.absoluteFilePath());
+ }
+ }
+ }
+
+ return validCases;
+}
+
+QVariantMap TestSquishUtils::readSuiteConf(QString suiteConfPath)
+{
+ const QSettings suiteConf(suiteConfPath, QSettings::IniFormat);
+ QVariantMap result;
+ // TODO get all information - actually only the information needed now is fetched
+ result.insert(squishLanguageKey, suiteConf.value(squishLanguageKey));
+ result.insert(squishTestCasesKey, suiteConf.value(squishTestCasesKey));
+ return result;
+}
+
+QString TestSquishUtils::extensionForLanguage(QString language)
+{
+ if (language == QLatin1String("Python"))
+ return QLatin1String(".py");
+ else if (language == QLatin1String("Perl"))
+ return QLatin1String(".pl");
+ else if (language == QLatin1String("JavaScript"))
+ return QLatin1String(".js");
+ else if (language == QLatin1String("Ruby"))
+ return QLatin1String(".rb");
+ else if (language == QLatin1String("Tcl"))
+ return QLatin1String(".tcl");
+ else
+ return QString(); // better return an invalid extension?
+}
+
+} // namespace Internal
+} // namespace Autotest
diff --git a/plugins/autotest/testsquishutils.h b/plugins/autotest/testsquishutils.h
new file mode 100644
index 0000000000..6936f95837
--- /dev/null
+++ b/plugins/autotest/testsquishutils.h
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd
+** All rights reserved.
+** For any questions to The Qt Company, please use contact form at
+** http://www.qt.io/contact-us
+**
+** This file is part of the Qt Creator Enterprise Auto Test Add-on.
+**
+** Licensees holding valid Qt Enterprise licenses may use this file in
+** accordance with the Qt Enterprise License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company.
+**
+** If you have questions regarding the use of this file, please use
+** contact form at http://www.qt.io/contact-us
+**
+****************************************************************************/
+
+#ifndef TESTSQUISHUTILS_H
+#define TESTSQUISHUTILS_H
+
+#include <QString>
+#include <QVariantMap>
+
+namespace Autotest {
+namespace Internal {
+
+class TestSquishUtils
+{
+public:
+ static QStringList validTestCases(QString baseDirectory);
+ static QVariantMap readSuiteConf(QString suiteConfPath);
+ static QString extensionForLanguage(QString language);
+
+private:
+ TestSquishUtils() {}
+};
+
+} // namespace Internal
+} // namespace Autotest
+
+#endif // TESTSQUISHUTILS_H
diff --git a/plugins/autotest/testtreemodel.cpp b/plugins/autotest/testtreemodel.cpp
index b4d0b582b6..82bdf23a84 100644
--- a/plugins/autotest/testtreemodel.cpp
+++ b/plugins/autotest/testtreemodel.cpp
@@ -19,6 +19,7 @@
#include "autotestconstants.h"
#include "testcodeparser.h"
+#include "testsquishfilehandler.h"
#include "testtreeitem.h"
#include "testtreemodel.h"
@@ -54,6 +55,7 @@ TestTreeModel::TestTreeModel(QObject *parent) :
m_quickTestRootItem(new TestTreeItem(tr("Qt Quick Tests"), QString(), TestTreeItem::ROOT, m_rootItem)),
m_squishTestRootItem(new TestTreeItem(tr("Squish Tests"), QString(), TestTreeItem::ROOT, m_rootItem)),
m_parser(new TestCodeParser(this)),
+ m_squishFileHandler(new TestSquishFileHandler(this)),
m_connectionsInitialized(false)
{
m_rootItem->appendChild(m_autoTestRootItem);
@@ -75,6 +77,11 @@ TestTreeModel::TestTreeModel(QObject *parent) :
connect(m_parser, &TestCodeParser::unnamedQuickTestsRemoved,
this, &TestTreeModel::removeUnnamedQuickTests, Qt::QueuedConnection);
+ connect(m_squishFileHandler, &TestSquishFileHandler::testTreeItemCreated,
+ this, &TestTreeModel::addTestTreeItem, Qt::QueuedConnection);
+ connect(m_squishFileHandler, &TestSquishFileHandler::testTreeItemModified,
+ this, &TestTreeModel::modifyTestTreeItem, Qt::QueuedConnection);
+
// CppTools::CppModelManagerInterface *cppMM = CppTools::CppModelManagerInterface::instance();
// if (cppMM) {
// // replace later on by
diff --git a/plugins/autotest/testtreemodel.h b/plugins/autotest/testtreemodel.h
index 9aad3fc529..8fa854f443 100644
--- a/plugins/autotest/testtreemodel.h
+++ b/plugins/autotest/testtreemodel.h
@@ -42,6 +42,7 @@ namespace Internal {
struct TestCodeLocationAndType;
class TestCodeParser;
class TestInfo;
+class TestSquishFileHandler;
class TestTreeItem;
class TestTreeModel : public QAbstractItemModel
@@ -114,6 +115,7 @@ private:
TestTreeItem *m_quickTestRootItem;
TestTreeItem *m_squishTestRootItem;
TestCodeParser *m_parser;
+ TestSquishFileHandler *m_squishFileHandler;
bool m_connectionsInitialized;
QAtomicInt m_refCounter;
};