forked from qt-creator/qt-creator
AutoTest: Drop ITestSettingsPage intermediate class
Less code in total, and more uniform with other IOptionPage subclasses. Change-Id: I3d1cb9fae0faf32a360394cc5cf3262a9b59b456 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -35,7 +35,6 @@ add_qtc_plugin(AutoTest
|
|||||||
iframeworksettings.h
|
iframeworksettings.h
|
||||||
itestframework.h
|
itestframework.h
|
||||||
itestparser.cpp itestparser.h
|
itestparser.cpp itestparser.h
|
||||||
itestsettingspage.h
|
|
||||||
projectsettingswidget.cpp projectsettingswidget.h
|
projectsettingswidget.cpp projectsettingswidget.h
|
||||||
qtest/qttest_utils.cpp qtest/qttest_utils.h
|
qtest/qttest_utils.cpp qtest/qttest_utils.h
|
||||||
qtest/qttestconfiguration.cpp qtest/qttestconfiguration.h
|
qtest/qttestconfiguration.cpp qtest/qttestconfiguration.h
|
||||||
|
|||||||
@@ -71,7 +71,6 @@ HEADERS += \
|
|||||||
iframeworksettings.h \
|
iframeworksettings.h \
|
||||||
itestframework.h \
|
itestframework.h \
|
||||||
itestparser.h \
|
itestparser.h \
|
||||||
itestsettingspage.h \
|
|
||||||
projectsettingswidget.h \
|
projectsettingswidget.h \
|
||||||
testcodeparser.h \
|
testcodeparser.h \
|
||||||
testconfiguration.h \
|
testconfiguration.h \
|
||||||
|
|||||||
@@ -78,7 +78,6 @@ QtcPlugin {
|
|||||||
"itestparser.h",
|
"itestparser.h",
|
||||||
"itestframework.h",
|
"itestframework.h",
|
||||||
"iframeworksettings.h",
|
"iframeworksettings.h",
|
||||||
"itestsettingspage.h",
|
|
||||||
"testframeworkmanager.cpp",
|
"testframeworkmanager.cpp",
|
||||||
"testframeworkmanager.h",
|
"testframeworkmanager.h",
|
||||||
"testrunconfiguration.h"
|
"testrunconfiguration.h"
|
||||||
|
|||||||
@@ -62,9 +62,9 @@ IFrameworkSettings *BoostTestFramework::createFrameworkSettings() const
|
|||||||
return new BoostTestSettings;
|
return new BoostTestSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
ITestSettingsPage *BoostTestFramework::createSettingsPage(QSharedPointer<IFrameworkSettings> settings) const
|
Core::IOptionsPage *BoostTestFramework::createSettingsPage(QSharedPointer<IFrameworkSettings> settings) const
|
||||||
{
|
{
|
||||||
return new BoostTestSettingsPage(settings, this);
|
return new BoostTestSettingsPage(settings, settingsId());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BoostTestFramework::hasFrameworkSettings() const
|
bool BoostTestFramework::hasFrameworkSettings() const
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public:
|
|||||||
const char *name() const override;
|
const char *name() const override;
|
||||||
unsigned priority() const override;
|
unsigned priority() const override;
|
||||||
IFrameworkSettings *createFrameworkSettings() const override;
|
IFrameworkSettings *createFrameworkSettings() const override;
|
||||||
ITestSettingsPage *createSettingsPage(QSharedPointer<IFrameworkSettings> settings) const override;
|
Core::IOptionsPage *createSettingsPage(QSharedPointer<IFrameworkSettings> settings) const override;
|
||||||
bool hasFrameworkSettings() const override;
|
bool hasFrameworkSettings() const override;
|
||||||
protected:
|
protected:
|
||||||
ITestParser *createTestParser() const override;
|
ITestParser *createTestParser() const override;
|
||||||
|
|||||||
@@ -103,9 +103,10 @@ void BoostTestSettingsWidget::fillComboBoxes()
|
|||||||
}
|
}
|
||||||
|
|
||||||
BoostTestSettingsPage::BoostTestSettingsPage(QSharedPointer<IFrameworkSettings> settings,
|
BoostTestSettingsPage::BoostTestSettingsPage(QSharedPointer<IFrameworkSettings> settings,
|
||||||
const ITestFramework *framework)
|
Core::Id settingsId)
|
||||||
: ITestSettingsPage(framework)
|
|
||||||
{
|
{
|
||||||
|
setId(settingsId);
|
||||||
|
setCategory(Constants::AUTOTEST_SETTINGS_CATEGORY);
|
||||||
setDisplayName(QCoreApplication::translate("BoostTestFramework",
|
setDisplayName(QCoreApplication::translate("BoostTestFramework",
|
||||||
BoostTest::Constants::FRAMEWORK_SETTINGS_CATEGORY));
|
BoostTest::Constants::FRAMEWORK_SETTINGS_CATEGORY));
|
||||||
setWidgetCreator([settings] {
|
setWidgetCreator([settings] {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../itestsettingspage.h"
|
#include <coreplugin/dialogs/ioptionspage.h>
|
||||||
|
|
||||||
namespace Autotest {
|
namespace Autotest {
|
||||||
|
|
||||||
@@ -33,11 +33,10 @@ class IFrameworkSettings;
|
|||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class BoostTestSettingsPage final : public ITestSettingsPage
|
class BoostTestSettingsPage final : public Core::IOptionsPage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BoostTestSettingsPage(QSharedPointer<IFrameworkSettings> settings,
|
BoostTestSettingsPage(QSharedPointer<IFrameworkSettings> settings, Core::Id settingsId);
|
||||||
const ITestFramework *framework);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
|
|||||||
@@ -61,9 +61,9 @@ IFrameworkSettings *GTestFramework::createFrameworkSettings() const
|
|||||||
return new GTestSettings;
|
return new GTestSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
ITestSettingsPage *GTestFramework::createSettingsPage(QSharedPointer<IFrameworkSettings> settings) const
|
Core::IOptionsPage *GTestFramework::createSettingsPage(QSharedPointer<IFrameworkSettings> settings) const
|
||||||
{
|
{
|
||||||
return new GTestSettingsPage(settings, this);
|
return new GTestSettingsPage(settings, settingsId());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GTestFramework::hasFrameworkSettings() const
|
bool GTestFramework::hasFrameworkSettings() const
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public:
|
|||||||
const char *name() const override;
|
const char *name() const override;
|
||||||
unsigned priority() const override;
|
unsigned priority() const override;
|
||||||
IFrameworkSettings *createFrameworkSettings() const override;
|
IFrameworkSettings *createFrameworkSettings() const override;
|
||||||
ITestSettingsPage *createSettingsPage(QSharedPointer<IFrameworkSettings> settings) const override;
|
Core::IOptionsPage *createSettingsPage(QSharedPointer<IFrameworkSettings> settings) const override;
|
||||||
bool hasFrameworkSettings() const override;
|
bool hasFrameworkSettings() const override;
|
||||||
static GTest::Constants::GroupMode groupMode();
|
static GTest::Constants::GroupMode groupMode();
|
||||||
static QString currentGTestFilter();
|
static QString currentGTestFilter();
|
||||||
|
|||||||
@@ -111,9 +111,10 @@ void GTestSettingsWidget::apply()
|
|||||||
}
|
}
|
||||||
|
|
||||||
GTestSettingsPage::GTestSettingsPage(QSharedPointer<IFrameworkSettings> settings,
|
GTestSettingsPage::GTestSettingsPage(QSharedPointer<IFrameworkSettings> settings,
|
||||||
const ITestFramework *framework)
|
Core::Id settingsId)
|
||||||
: ITestSettingsPage(framework)
|
|
||||||
{
|
{
|
||||||
|
setId(settingsId);
|
||||||
|
setCategory(Constants::AUTOTEST_SETTINGS_CATEGORY);
|
||||||
setDisplayName(QCoreApplication::translate("GTestFramework",
|
setDisplayName(QCoreApplication::translate("GTestFramework",
|
||||||
GTest::Constants::FRAMEWORK_SETTINGS_CATEGORY));
|
GTest::Constants::FRAMEWORK_SETTINGS_CATEGORY));
|
||||||
setWidgetCreator([settings] { return new GTestSettingsWidget(qSharedPointerCast<GTestSettings>(settings)); });
|
setWidgetCreator([settings] { return new GTestSettingsWidget(qSharedPointerCast<GTestSettings>(settings)); });
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../itestsettingspage.h"
|
#include <coreplugin/dialogs/ioptionspage.h>
|
||||||
|
|
||||||
namespace Autotest {
|
namespace Autotest {
|
||||||
|
|
||||||
@@ -33,10 +33,10 @@ class IFrameworkSettings;
|
|||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class GTestSettingsPage final : public ITestSettingsPage
|
class GTestSettingsPage final : public Core::IOptionsPage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GTestSettingsPage(QSharedPointer<IFrameworkSettings> settings, const ITestFramework *framework);
|
GTestSettingsPage(QSharedPointer<IFrameworkSettings> settings, Core::Id settingsId);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -28,10 +28,11 @@
|
|||||||
#include "testtreeitem.h"
|
#include "testtreeitem.h"
|
||||||
#include "itestparser.h"
|
#include "itestparser.h"
|
||||||
|
|
||||||
|
namespace Core { class IOptionsPage; }
|
||||||
|
|
||||||
namespace Autotest {
|
namespace Autotest {
|
||||||
|
|
||||||
class IFrameworkSettings;
|
class IFrameworkSettings;
|
||||||
class ITestSettingsPage;
|
|
||||||
|
|
||||||
class ITestFramework
|
class ITestFramework
|
||||||
{
|
{
|
||||||
@@ -47,7 +48,7 @@ public:
|
|||||||
virtual unsigned priority() const = 0; // should this be modifyable?
|
virtual unsigned priority() const = 0; // should this be modifyable?
|
||||||
virtual bool hasFrameworkSettings() const { return false; }
|
virtual bool hasFrameworkSettings() const { return false; }
|
||||||
virtual IFrameworkSettings *createFrameworkSettings() const { return nullptr; }
|
virtual IFrameworkSettings *createFrameworkSettings() const { return nullptr; }
|
||||||
virtual ITestSettingsPage *createSettingsPage(QSharedPointer<IFrameworkSettings> settings) const
|
virtual Core::IOptionsPage *createSettingsPage(QSharedPointer<IFrameworkSettings> settings) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(settings)
|
Q_UNUSED(settings)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@@ -66,6 +67,8 @@ public:
|
|||||||
return m_testParser;
|
return m_testParser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Core::Id settingsId() const;
|
||||||
|
|
||||||
bool active() const { return m_active; }
|
bool active() const { return m_active; }
|
||||||
void setActive(bool active) { m_active = active; }
|
void setActive(bool active) { m_active = active; }
|
||||||
bool grouping() const { return m_grouping; }
|
bool grouping() const { return m_grouping; }
|
||||||
|
|||||||
@@ -1,66 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "autotestconstants.h"
|
|
||||||
#include "itestframework.h"
|
|
||||||
|
|
||||||
#include <coreplugin/dialogs/ioptionspage.h>
|
|
||||||
|
|
||||||
namespace Autotest {
|
|
||||||
|
|
||||||
class IFrameworkSettings;
|
|
||||||
|
|
||||||
class ITestSettingsPage : public Core::IOptionsPage
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit ITestSettingsPage(const ITestFramework *framework)
|
|
||||||
{
|
|
||||||
setId(Core::Id(Constants::SETTINGSPAGE_PREFIX).withSuffix(
|
|
||||||
QString("%1.%2").arg(framework->priority()).arg(QLatin1String(framework->name()))));
|
|
||||||
setCategory(Constants::AUTOTEST_SETTINGS_CATEGORY);
|
|
||||||
}
|
|
||||||
|
|
||||||
void finish() override {}
|
|
||||||
|
|
||||||
private:
|
|
||||||
void setId(Core::Id id)
|
|
||||||
{
|
|
||||||
Core::IOptionsPage::setId(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
void setCategory(Core::Id category)
|
|
||||||
{
|
|
||||||
Core::IOptionsPage::setCategory(category);
|
|
||||||
}
|
|
||||||
|
|
||||||
void setDisplayCategory(const QString &displayCategory)
|
|
||||||
{
|
|
||||||
Core::IOptionsPage::setDisplayCategory(displayCategory);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Autotest
|
|
||||||
@@ -51,9 +51,9 @@ IFrameworkSettings *QtTestFramework::createFrameworkSettings() const
|
|||||||
return new QtTestSettings;
|
return new QtTestSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
ITestSettingsPage *QtTestFramework::createSettingsPage(QSharedPointer<IFrameworkSettings> settings) const
|
Core::IOptionsPage *QtTestFramework::createSettingsPage(QSharedPointer<IFrameworkSettings> settings) const
|
||||||
{
|
{
|
||||||
return new QtTestSettingsPage(settings, this);
|
return new QtTestSettingsPage(settings, settingsId());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QtTestFramework::hasFrameworkSettings() const
|
bool QtTestFramework::hasFrameworkSettings() const
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public:
|
|||||||
const char *name() const override;
|
const char *name() const override;
|
||||||
unsigned priority() const override;
|
unsigned priority() const override;
|
||||||
IFrameworkSettings *createFrameworkSettings() const override;
|
IFrameworkSettings *createFrameworkSettings() const override;
|
||||||
ITestSettingsPage *createSettingsPage(QSharedPointer<IFrameworkSettings> settings) const override;
|
Core::IOptionsPage *createSettingsPage(QSharedPointer<IFrameworkSettings> settings) const override;
|
||||||
bool hasFrameworkSettings() const override;
|
bool hasFrameworkSettings() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -102,9 +102,10 @@ void QtTestSettingsWidget::apply()
|
|||||||
}
|
}
|
||||||
|
|
||||||
QtTestSettingsPage::QtTestSettingsPage(QSharedPointer<IFrameworkSettings> settings,
|
QtTestSettingsPage::QtTestSettingsPage(QSharedPointer<IFrameworkSettings> settings,
|
||||||
const ITestFramework *framework)
|
Core::Id settingsId)
|
||||||
: ITestSettingsPage(framework)
|
|
||||||
{
|
{
|
||||||
|
setId(settingsId);
|
||||||
|
setCategory(Constants::AUTOTEST_SETTINGS_CATEGORY);
|
||||||
setDisplayName(QCoreApplication::translate("QtTestFramework",
|
setDisplayName(QCoreApplication::translate("QtTestFramework",
|
||||||
QtTest::Constants::FRAMEWORK_SETTINGS_CATEGORY));
|
QtTest::Constants::FRAMEWORK_SETTINGS_CATEGORY));
|
||||||
setWidgetCreator([settings] {
|
setWidgetCreator([settings] {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../itestsettingspage.h"
|
#include <coreplugin/dialogs/ioptionspage.h>
|
||||||
|
|
||||||
namespace Autotest {
|
namespace Autotest {
|
||||||
|
|
||||||
@@ -33,10 +33,10 @@ class IFrameworkSettings;
|
|||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class QtTestSettingsPage final : public ITestSettingsPage
|
class QtTestSettingsPage final : public Core::IOptionsPage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QtTestSettingsPage(QSharedPointer<IFrameworkSettings> settings, const ITestFramework *framework);
|
QtTestSettingsPage(QSharedPointer<IFrameworkSettings> settings, Core::Id settingsId);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -28,12 +28,13 @@
|
|||||||
#include "autotestplugin.h"
|
#include "autotestplugin.h"
|
||||||
#include "iframeworksettings.h"
|
#include "iframeworksettings.h"
|
||||||
#include "itestparser.h"
|
#include "itestparser.h"
|
||||||
#include "itestsettingspage.h"
|
|
||||||
#include "testrunner.h"
|
#include "testrunner.h"
|
||||||
#include "testsettings.h"
|
#include "testsettings.h"
|
||||||
#include "testtreeitem.h"
|
#include "testtreeitem.h"
|
||||||
#include "testtreemodel.h"
|
#include "testtreemodel.h"
|
||||||
|
|
||||||
|
#include <coreplugin/dialogs/ioptionspage.h>
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
@@ -218,4 +219,10 @@ unsigned TestFrameworkManager::priority(const Id &frameworkId) const
|
|||||||
return unsigned(-1);
|
return unsigned(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Id ITestFramework::settingsId() const
|
||||||
|
{
|
||||||
|
return Core::Id(Constants::SETTINGSPAGE_PREFIX)
|
||||||
|
.withSuffix(QString("%1.%2").arg(priority()).arg(QLatin1String(name())));
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Autotest
|
} // namespace Autotest
|
||||||
|
|||||||
@@ -44,12 +44,10 @@ namespace Internal {
|
|||||||
|
|
||||||
class TestRunner;
|
class TestRunner;
|
||||||
struct TestSettings;
|
struct TestSettings;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class IFrameworkSettings;
|
class IFrameworkSettings;
|
||||||
class ITestParser;
|
class ITestParser;
|
||||||
class ITestSettingsPage;
|
|
||||||
class TestTreeModel;
|
class TestTreeModel;
|
||||||
|
|
||||||
class TestFrameworkManager
|
class TestFrameworkManager
|
||||||
@@ -80,7 +78,7 @@ private:
|
|||||||
explicit TestFrameworkManager();
|
explicit TestFrameworkManager();
|
||||||
QHash<Core::Id, ITestFramework *> m_registeredFrameworks;
|
QHash<Core::Id, ITestFramework *> m_registeredFrameworks;
|
||||||
QHash<Core::Id, QSharedPointer<IFrameworkSettings> > m_frameworkSettings;
|
QHash<Core::Id, QSharedPointer<IFrameworkSettings> > m_frameworkSettings;
|
||||||
QVector<ITestSettingsPage *> m_frameworkSettingsPages;
|
QVector<Core::IOptionsPage *> m_frameworkSettingsPages;
|
||||||
TestTreeModel *m_testTreeModel;
|
TestTreeModel *m_testTreeModel;
|
||||||
Internal::TestRunner *m_testRunner;
|
Internal::TestRunner *m_testRunner;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user