forked from qt-creator/qt-creator
AutoTest: Tie framework settings explicitly to ITestFramework instance
This leaves no doubts regarding lifetime and type. Change-Id: I1fdd60427a469f32236ea0fa923ec9fa308c338e Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -35,12 +35,12 @@
|
||||
namespace Autotest {
|
||||
namespace Internal {
|
||||
|
||||
static QSharedPointer<BoostTestSettings> getBoostSettings()
|
||||
static BoostTestSettings *getBoostSettings()
|
||||
{
|
||||
const Core::Id id = Core::Id(Constants::FRAMEWORK_PREFIX).withSuffix(
|
||||
BoostTest::Constants::FRAMEWORK_NAME);
|
||||
TestFrameworkManager *manager = TestFrameworkManager::instance();
|
||||
return qSharedPointerCast<BoostTestSettings>(manager->settingsForTestFramework(id));
|
||||
return dynamic_cast<BoostTestSettings *>(manager->settingsForTestFramework(id));
|
||||
}
|
||||
|
||||
TestOutputReader *BoostTestConfiguration::outputReader(const QFutureInterface<TestResultPtr> &fi,
|
||||
|
@@ -25,8 +25,6 @@
|
||||
|
||||
#include "boosttestframework.h"
|
||||
#include "boosttestconstants.h"
|
||||
#include "boosttestsettings.h"
|
||||
#include "boosttestsettingspage.h"
|
||||
#include "boosttesttreeitem.h"
|
||||
#include "boosttestparser.h"
|
||||
#include "../testframeworkmanager.h"
|
||||
@@ -57,20 +55,5 @@ unsigned BoostTestFramework::priority() const
|
||||
return BoostTest::Constants::FRAMEWORK_PRIORITY;
|
||||
}
|
||||
|
||||
IFrameworkSettings *BoostTestFramework::createFrameworkSettings() const
|
||||
{
|
||||
return new BoostTestSettings;
|
||||
}
|
||||
|
||||
Core::IOptionsPage *BoostTestFramework::createSettingsPage(QSharedPointer<IFrameworkSettings> settings) const
|
||||
{
|
||||
return new BoostTestSettingsPage(settings, settingsId());
|
||||
}
|
||||
|
||||
bool BoostTestFramework::hasFrameworkSettings() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Autotest
|
||||
|
@@ -27,6 +27,9 @@
|
||||
|
||||
#include "../itestframework.h"
|
||||
|
||||
#include "boosttestsettings.h"
|
||||
#include "boosttestsettingspage.h"
|
||||
|
||||
namespace Autotest {
|
||||
namespace Internal {
|
||||
|
||||
@@ -34,14 +37,16 @@ class BoostTestFramework : public ITestFramework
|
||||
{
|
||||
public:
|
||||
BoostTestFramework() : ITestFramework(true) {}
|
||||
|
||||
private:
|
||||
const char *name() const override;
|
||||
unsigned priority() const override;
|
||||
IFrameworkSettings *createFrameworkSettings() const override;
|
||||
Core::IOptionsPage *createSettingsPage(QSharedPointer<IFrameworkSettings> settings) const override;
|
||||
bool hasFrameworkSettings() const override;
|
||||
protected:
|
||||
IFrameworkSettings *frameworkSettings() override { return &m_settings; }
|
||||
ITestParser *createTestParser() const override;
|
||||
TestTreeItem *createRootNode() const override;
|
||||
|
||||
BoostTestSettings m_settings;
|
||||
BoostTestSettingsPage m_settingsPage{&m_settings, settingsId()};
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -39,7 +39,7 @@ class BoostTestSettingsWidget : public Core::IOptionsPageWidget
|
||||
Q_DECLARE_TR_FUNCTIONS(Autotest::Internal::BoostTestSettingsWidget)
|
||||
|
||||
public:
|
||||
explicit BoostTestSettingsWidget(QSharedPointer<BoostTestSettings> settings);
|
||||
explicit BoostTestSettingsWidget(BoostTestSettings *settings);
|
||||
|
||||
void apply() final;
|
||||
|
||||
@@ -49,10 +49,10 @@ public:
|
||||
private:
|
||||
void fillComboBoxes();
|
||||
Ui::BoostSettingsPage m_ui;
|
||||
QSharedPointer<BoostTestSettings> m_settings;
|
||||
BoostTestSettings *m_settings;
|
||||
};
|
||||
|
||||
BoostTestSettingsWidget::BoostTestSettingsWidget(QSharedPointer<BoostTestSettings> settings)
|
||||
BoostTestSettingsWidget::BoostTestSettingsWidget(BoostTestSettings *settings)
|
||||
: m_settings(settings)
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
@@ -101,16 +101,13 @@ void BoostTestSettingsWidget::fillComboBoxes()
|
||||
m_ui.reportLevelCB->addItem("No", QVariant::fromValue(ReportLevel::No));
|
||||
}
|
||||
|
||||
BoostTestSettingsPage::BoostTestSettingsPage(QSharedPointer<IFrameworkSettings> settings,
|
||||
Core::Id settingsId)
|
||||
BoostTestSettingsPage::BoostTestSettingsPage(BoostTestSettings *settings, Core::Id settingsId)
|
||||
{
|
||||
setId(settingsId);
|
||||
setCategory(Constants::AUTOTEST_SETTINGS_CATEGORY);
|
||||
setDisplayName(QCoreApplication::translate("BoostTestFramework",
|
||||
BoostTest::Constants::FRAMEWORK_SETTINGS_CATEGORY));
|
||||
setWidgetCreator([settings] {
|
||||
return new BoostTestSettingsWidget(qSharedPointerCast<BoostTestSettings>(settings));
|
||||
});
|
||||
setWidgetCreator([settings] { return new BoostTestSettingsWidget(settings); });
|
||||
}
|
||||
|
||||
} // Internal
|
||||
|
@@ -28,15 +28,14 @@
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
|
||||
namespace Autotest {
|
||||
|
||||
class IFrameworkSettings;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class BoostTestSettings;
|
||||
|
||||
class BoostTestSettingsPage final : public Core::IOptionsPage
|
||||
{
|
||||
public:
|
||||
BoostTestSettingsPage(QSharedPointer<IFrameworkSettings> settings, Core::Id settingsId);
|
||||
BoostTestSettingsPage(BoostTestSettings *settings, Core::Id settingsId);
|
||||
};
|
||||
|
||||
} // Internal
|
||||
|
@@ -87,8 +87,8 @@ QStringList GTestConfiguration::argumentsForTestRunner(QStringList *omitted) con
|
||||
arguments << "--gtest_filter=" + testSets.join(':');
|
||||
|
||||
TestFrameworkManager *manager = TestFrameworkManager::instance();
|
||||
auto gSettings = qSharedPointerCast<GTestSettings>(manager->settingsForTestFramework(id));
|
||||
if (gSettings.isNull())
|
||||
auto gSettings = dynamic_cast<GTestSettings *>(manager->settingsForTestFramework(id));
|
||||
if (!gSettings)
|
||||
return arguments;
|
||||
|
||||
if (gSettings->runDisabled)
|
||||
|
@@ -24,8 +24,6 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "gtestframework.h"
|
||||
#include "gtestsettings.h"
|
||||
#include "gtestsettingspage.h"
|
||||
#include "gtesttreeitem.h"
|
||||
#include "gtestparser.h"
|
||||
#include "../testframeworkmanager.h"
|
||||
@@ -33,6 +31,14 @@
|
||||
namespace Autotest {
|
||||
namespace Internal {
|
||||
|
||||
static GTestSettings *g_settings;
|
||||
|
||||
GTestFramework::GTestFramework()
|
||||
: ITestFramework(true)
|
||||
{
|
||||
g_settings = &m_settings;
|
||||
}
|
||||
|
||||
ITestParser *GTestFramework::createTestParser() const
|
||||
{
|
||||
return new GTestParser;
|
||||
@@ -56,29 +62,9 @@ unsigned GTestFramework::priority() const
|
||||
return GTest::Constants::FRAMEWORK_PRIORITY;
|
||||
}
|
||||
|
||||
IFrameworkSettings *GTestFramework::createFrameworkSettings() const
|
||||
{
|
||||
return new GTestSettings;
|
||||
}
|
||||
|
||||
Core::IOptionsPage *GTestFramework::createSettingsPage(QSharedPointer<IFrameworkSettings> settings) const
|
||||
{
|
||||
return new GTestSettingsPage(settings, settingsId());
|
||||
}
|
||||
|
||||
bool GTestFramework::hasFrameworkSettings() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
QString GTestFramework::currentGTestFilter()
|
||||
{
|
||||
static const Core::Id id
|
||||
= Core::Id(Constants::FRAMEWORK_PREFIX).withSuffix(GTest::Constants::FRAMEWORK_NAME);
|
||||
const auto manager = TestFrameworkManager::instance();
|
||||
|
||||
auto gSettings = qSharedPointerCast<GTestSettings>(manager->settingsForTestFramework(id));
|
||||
return gSettings.isNull() ? QString(GTest::Constants::DEFAULT_FILTER) : gSettings->gtestFilter;
|
||||
return g_settings->gtestFilter;
|
||||
}
|
||||
|
||||
QString GTestFramework::groupingToolTip() const
|
||||
@@ -90,14 +76,7 @@ QString GTestFramework::groupingToolTip() const
|
||||
|
||||
GTest::Constants::GroupMode GTestFramework::groupMode()
|
||||
{
|
||||
static const Core::Id id
|
||||
= Core::Id(Constants::FRAMEWORK_PREFIX).withSuffix(GTest::Constants::FRAMEWORK_NAME);
|
||||
const auto manager = TestFrameworkManager::instance();
|
||||
if (!manager->groupingEnabled(id))
|
||||
return GTest::Constants::None;
|
||||
|
||||
auto gSettings = qSharedPointerCast<GTestSettings>(manager->settingsForTestFramework(id));
|
||||
return gSettings.isNull() ? GTest::Constants::Directory : gSettings->groupMode;
|
||||
return g_settings->groupMode;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -27,6 +27,8 @@
|
||||
|
||||
#include "../itestframework.h"
|
||||
#include "gtestconstants.h"
|
||||
#include "gtestsettings.h"
|
||||
#include "gtestsettingspage.h"
|
||||
|
||||
namespace Autotest {
|
||||
namespace Internal {
|
||||
@@ -34,18 +36,21 @@ namespace Internal {
|
||||
class GTestFramework : public ITestFramework
|
||||
{
|
||||
public:
|
||||
GTestFramework() : ITestFramework(true) {}
|
||||
const char *name() const override;
|
||||
unsigned priority() const override;
|
||||
IFrameworkSettings *createFrameworkSettings() const override;
|
||||
Core::IOptionsPage *createSettingsPage(QSharedPointer<IFrameworkSettings> settings) const override;
|
||||
bool hasFrameworkSettings() const override;
|
||||
GTestFramework();
|
||||
|
||||
static GTest::Constants::GroupMode groupMode();
|
||||
static QString currentGTestFilter();
|
||||
|
||||
private:
|
||||
const char *name() const override;
|
||||
unsigned priority() const override;
|
||||
QString groupingToolTip() const override;
|
||||
protected:
|
||||
IFrameworkSettings *frameworkSettings() override { return &m_settings; }
|
||||
ITestParser *createTestParser() const override;
|
||||
TestTreeItem *createRootNode() const override;
|
||||
|
||||
GTestSettings m_settings;
|
||||
GTestSettingsPage m_settingsPage{&m_settings, settingsId()};
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -46,17 +46,17 @@ class GTestSettingsWidget final : public Core::IOptionsPageWidget
|
||||
Q_DECLARE_TR_FUNCTIONS(Autotest::Internal::GTestSettingsWidget)
|
||||
|
||||
public:
|
||||
explicit GTestSettingsWidget(const QSharedPointer<GTestSettings> &settings);
|
||||
explicit GTestSettingsWidget(GTestSettings *settings);
|
||||
|
||||
private:
|
||||
void apply() final;
|
||||
|
||||
Ui::GTestSettingsPage m_ui;
|
||||
QString m_currentGTestFilter;
|
||||
QSharedPointer<GTestSettings> m_settings;
|
||||
GTestSettings *m_settings;
|
||||
};
|
||||
|
||||
GTestSettingsWidget::GTestSettingsWidget(const QSharedPointer<GTestSettings> &settings)
|
||||
GTestSettingsWidget::GTestSettingsWidget(GTestSettings *settings)
|
||||
: m_settings(settings)
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
@@ -109,14 +109,13 @@ void GTestSettingsWidget::apply()
|
||||
TestTreeModel::instance()->rebuild({id});
|
||||
}
|
||||
|
||||
GTestSettingsPage::GTestSettingsPage(QSharedPointer<IFrameworkSettings> settings,
|
||||
Core::Id settingsId)
|
||||
GTestSettingsPage::GTestSettingsPage(GTestSettings *settings, Core::Id settingsId)
|
||||
{
|
||||
setId(settingsId);
|
||||
setCategory(Constants::AUTOTEST_SETTINGS_CATEGORY);
|
||||
setDisplayName(QCoreApplication::translate("GTestFramework",
|
||||
GTest::Constants::FRAMEWORK_SETTINGS_CATEGORY));
|
||||
setWidgetCreator([settings] { return new GTestSettingsWidget(qSharedPointerCast<GTestSettings>(settings)); });
|
||||
setWidgetCreator([settings] { return new GTestSettingsWidget(settings); });
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -28,15 +28,14 @@
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
|
||||
namespace Autotest {
|
||||
|
||||
class IFrameworkSettings;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class GTestSettings;
|
||||
|
||||
class GTestSettingsPage final : public Core::IOptionsPage
|
||||
{
|
||||
public:
|
||||
GTestSettingsPage(QSharedPointer<IFrameworkSettings> settings, Core::Id settingsId);
|
||||
GTestSettingsPage(GTestSettings *settings, Core::Id settingsId);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -28,8 +28,6 @@
|
||||
#include "testtreeitem.h"
|
||||
#include "itestparser.h"
|
||||
|
||||
namespace Core { class IOptionsPage; }
|
||||
|
||||
namespace Autotest {
|
||||
|
||||
class IFrameworkSettings;
|
||||
@@ -46,13 +44,8 @@ public:
|
||||
|
||||
virtual const char *name() const = 0;
|
||||
virtual unsigned priority() const = 0; // should this be modifyable?
|
||||
virtual bool hasFrameworkSettings() const { return false; }
|
||||
virtual IFrameworkSettings *createFrameworkSettings() const { return nullptr; }
|
||||
virtual Core::IOptionsPage *createSettingsPage(QSharedPointer<IFrameworkSettings> settings) const
|
||||
{
|
||||
Q_UNUSED(settings)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
virtual IFrameworkSettings *frameworkSettings() { return nullptr; }
|
||||
|
||||
TestTreeItem *rootNode()
|
||||
{ if (!m_rootNode)
|
||||
|
@@ -41,7 +41,7 @@ TestOutputReader *QtTestConfiguration::outputReader(const QFutureInterface<TestR
|
||||
static const Core::Id id
|
||||
= Core::Id(Constants::FRAMEWORK_PREFIX).withSuffix(QtTest::Constants::FRAMEWORK_NAME);
|
||||
TestFrameworkManager *manager = TestFrameworkManager::instance();
|
||||
auto qtSettings = qSharedPointerCast<QtTestSettings>(manager->settingsForTestFramework(id));
|
||||
auto qtSettings = dynamic_cast<QtTestSettings *>(manager->settingsForTestFramework(id));
|
||||
const QtTestOutputReader::OutputMode mode = qtSettings && qtSettings->useXMLOutput
|
||||
? QtTestOutputReader::XML
|
||||
: QtTestOutputReader::PlainText;
|
||||
@@ -60,8 +60,8 @@ QStringList QtTestConfiguration::argumentsForTestRunner(QStringList *omitted) co
|
||||
omitted, false));
|
||||
}
|
||||
TestFrameworkManager *manager = TestFrameworkManager::instance();
|
||||
auto qtSettings = qSharedPointerCast<QtTestSettings>(manager->settingsForTestFramework(id));
|
||||
if (qtSettings.isNull())
|
||||
auto qtSettings = dynamic_cast<QtTestSettings *>(manager->settingsForTestFramework(id));
|
||||
if (!qtSettings)
|
||||
return arguments;
|
||||
if (qtSettings->useXMLOutput)
|
||||
arguments << "-xml";
|
||||
|
@@ -26,8 +26,6 @@
|
||||
#include "qttestframework.h"
|
||||
#include "qttestconstants.h"
|
||||
#include "qttestparser.h"
|
||||
#include "qttestsettings.h"
|
||||
#include "qttestsettingspage.h"
|
||||
#include "qttesttreeitem.h"
|
||||
|
||||
namespace Autotest {
|
||||
@@ -46,21 +44,6 @@ TestTreeItem *QtTestFramework::createRootNode() const
|
||||
QString(), TestTreeItem::Root);
|
||||
}
|
||||
|
||||
IFrameworkSettings *QtTestFramework::createFrameworkSettings() const
|
||||
{
|
||||
return new QtTestSettings;
|
||||
}
|
||||
|
||||
Core::IOptionsPage *QtTestFramework::createSettingsPage(QSharedPointer<IFrameworkSettings> settings) const
|
||||
{
|
||||
return new QtTestSettingsPage(settings, settingsId());
|
||||
}
|
||||
|
||||
bool QtTestFramework::hasFrameworkSettings() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
const char *QtTestFramework::name() const
|
||||
{
|
||||
return QtTest::Constants::FRAMEWORK_NAME;
|
||||
|
@@ -27,6 +27,9 @@
|
||||
|
||||
#include "../itestframework.h"
|
||||
|
||||
#include "qttestsettings.h"
|
||||
#include "qttestsettingspage.h"
|
||||
|
||||
namespace Autotest {
|
||||
namespace Internal {
|
||||
|
||||
@@ -34,15 +37,16 @@ class QtTestFramework : public ITestFramework
|
||||
{
|
||||
public:
|
||||
QtTestFramework() : ITestFramework(true) {}
|
||||
|
||||
private:
|
||||
const char *name() const override;
|
||||
unsigned priority() const override;
|
||||
IFrameworkSettings *createFrameworkSettings() const override;
|
||||
Core::IOptionsPage *createSettingsPage(QSharedPointer<IFrameworkSettings> settings) const override;
|
||||
bool hasFrameworkSettings() const override;
|
||||
|
||||
protected:
|
||||
ITestParser *createTestParser() const override;
|
||||
TestTreeItem *createRootNode() const override;
|
||||
IFrameworkSettings *frameworkSettings() override { return &m_settings; }
|
||||
|
||||
QtTestSettings m_settings;
|
||||
QtTestSettingsPage m_settingsPage{&m_settings, settingsId()};
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -41,16 +41,16 @@ class QtTestSettingsWidget final : public Core::IOptionsPageWidget
|
||||
Q_DECLARE_TR_FUNCTIONS(Autotest::Internal::QtTestSettingsWidget)
|
||||
|
||||
public:
|
||||
explicit QtTestSettingsWidget(QSharedPointer<QtTestSettings> settings);
|
||||
explicit QtTestSettingsWidget(QtTestSettings *settings);
|
||||
|
||||
void apply() final;
|
||||
|
||||
private:
|
||||
Ui::QtTestSettingsPage m_ui;
|
||||
QSharedPointer<QtTestSettings> m_settings;
|
||||
QtTestSettings *m_settings;
|
||||
};
|
||||
|
||||
QtTestSettingsWidget::QtTestSettingsWidget(QSharedPointer<QtTestSettings> settings)
|
||||
QtTestSettingsWidget::QtTestSettingsWidget(QtTestSettings *settings)
|
||||
: m_settings(settings)
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
@@ -100,16 +100,13 @@ void QtTestSettingsWidget::apply()
|
||||
m_settings->toSettings(Core::ICore::settings());
|
||||
}
|
||||
|
||||
QtTestSettingsPage::QtTestSettingsPage(QSharedPointer<IFrameworkSettings> settings,
|
||||
Core::Id settingsId)
|
||||
QtTestSettingsPage::QtTestSettingsPage(QtTestSettings *settings, Core::Id settingsId)
|
||||
{
|
||||
setId(settingsId);
|
||||
setCategory(Constants::AUTOTEST_SETTINGS_CATEGORY);
|
||||
setDisplayName(QCoreApplication::translate("QtTestFramework",
|
||||
QtTest::Constants::FRAMEWORK_SETTINGS_CATEGORY));
|
||||
setWidgetCreator([settings] {
|
||||
return new QtTestSettingsWidget(qSharedPointerCast<QtTestSettings>(settings));
|
||||
});
|
||||
setWidgetCreator([settings] { return new QtTestSettingsWidget(settings); });
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -28,15 +28,14 @@
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
|
||||
namespace Autotest {
|
||||
|
||||
class IFrameworkSettings;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class QtTestSettings;
|
||||
|
||||
class QtTestSettingsPage final : public Core::IOptionsPage
|
||||
{
|
||||
public:
|
||||
QtTestSettingsPage(QSharedPointer<IFrameworkSettings> settings, Core::Id settingsId);
|
||||
QtTestSettingsPage(QtTestSettings *settings, Core::Id settingsId);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -46,7 +46,7 @@ TestOutputReader *QuickTestConfiguration::outputReader(const QFutureInterface<Te
|
||||
static const Core::Id id
|
||||
= Core::Id(Constants::FRAMEWORK_PREFIX).withSuffix(QtTest::Constants::FRAMEWORK_NAME);
|
||||
TestFrameworkManager *manager = TestFrameworkManager::instance();
|
||||
auto qtSettings = qSharedPointerCast<QtTestSettings>(manager->settingsForTestFramework(id));
|
||||
auto qtSettings = dynamic_cast<QtTestSettings *>(manager->settingsForTestFramework(id));
|
||||
const QtTestOutputReader::OutputMode mode = qtSettings && qtSettings->useXMLOutput
|
||||
? QtTestOutputReader::XML
|
||||
: QtTestOutputReader::PlainText;
|
||||
@@ -67,8 +67,8 @@ QStringList QuickTestConfiguration::argumentsForTestRunner(QStringList *omitted)
|
||||
}
|
||||
|
||||
TestFrameworkManager *manager = TestFrameworkManager::instance();
|
||||
auto qtSettings = qSharedPointerCast<QtTestSettings>(manager->settingsForTestFramework(id));
|
||||
if (qtSettings.isNull())
|
||||
auto qtSettings = dynamic_cast<QtTestSettings *>(manager->settingsForTestFramework(id));
|
||||
if (!qtSettings)
|
||||
return arguments;
|
||||
if (qtSettings->useXMLOutput)
|
||||
arguments << "-xml";
|
||||
|
@@ -67,8 +67,6 @@ TestFrameworkManager::~TestFrameworkManager()
|
||||
{
|
||||
delete m_testRunner;
|
||||
delete m_testTreeModel;
|
||||
qDeleteAll(m_frameworkSettingsPages);
|
||||
m_frameworkSettingsPages.clear();
|
||||
for (ITestFramework *framework : m_registeredFrameworks.values())
|
||||
delete framework;
|
||||
}
|
||||
@@ -82,12 +80,9 @@ bool TestFrameworkManager::registerTestFramework(ITestFramework *framework)
|
||||
qCDebug(LOG) << "Registering" << id;
|
||||
m_registeredFrameworks.insert(id, framework);
|
||||
|
||||
if (framework->hasFrameworkSettings()) {
|
||||
QSharedPointer<IFrameworkSettings> frameworkSettings(framework->createFrameworkSettings());
|
||||
if (IFrameworkSettings *frameworkSettings = framework->frameworkSettings())
|
||||
m_frameworkSettings.insert(id, frameworkSettings);
|
||||
if (auto page = framework->createSettingsPage(frameworkSettings))
|
||||
m_frameworkSettingsPages.append(page);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -161,19 +156,17 @@ ITestParser *TestFrameworkManager::testParserForTestFramework(const Id &framewor
|
||||
return testParser;
|
||||
}
|
||||
|
||||
QSharedPointer<IFrameworkSettings> TestFrameworkManager::settingsForTestFramework(
|
||||
IFrameworkSettings *TestFrameworkManager::settingsForTestFramework(
|
||||
const Id &frameworkId) const
|
||||
{
|
||||
return m_frameworkSettings.contains(frameworkId) ? m_frameworkSettings.value(frameworkId)
|
||||
: QSharedPointer<IFrameworkSettings>();
|
||||
return m_frameworkSettings.value(frameworkId, nullptr);
|
||||
}
|
||||
|
||||
void TestFrameworkManager::synchronizeSettings(QSettings *s)
|
||||
{
|
||||
Internal::AutotestPlugin::settings()->fromSettings(s);
|
||||
for (const Id &id : m_frameworkSettings.keys()) {
|
||||
QSharedPointer<IFrameworkSettings> fSettings = settingsForTestFramework(id);
|
||||
if (!fSettings.isNull())
|
||||
if (IFrameworkSettings *fSettings = settingsForTestFramework(id))
|
||||
fSettings->fromSettings(s);
|
||||
}
|
||||
}
|
||||
|
@@ -28,7 +28,6 @@
|
||||
#include "itestframework.h"
|
||||
|
||||
#include <QHash>
|
||||
#include <QSharedPointer>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QSettings;
|
||||
@@ -65,7 +64,7 @@ public:
|
||||
|
||||
TestTreeItem *rootNodeForTestFramework(const Core::Id &frameworkId) const;
|
||||
ITestParser *testParserForTestFramework(const Core::Id &frameworkId) const;
|
||||
QSharedPointer<IFrameworkSettings> settingsForTestFramework(const Core::Id &frameworkId) const;
|
||||
IFrameworkSettings *settingsForTestFramework(const Core::Id &frameworkId) const;
|
||||
void synchronizeSettings(QSettings *s);
|
||||
bool isActive(const Core::Id &frameworkId) const;
|
||||
bool groupingEnabled(const Core::Id &frameworkId) const;
|
||||
@@ -77,8 +76,7 @@ private:
|
||||
QList<Core::Id> activeFrameworkIds() const;
|
||||
explicit TestFrameworkManager();
|
||||
QHash<Core::Id, ITestFramework *> m_registeredFrameworks;
|
||||
QHash<Core::Id, QSharedPointer<IFrameworkSettings> > m_frameworkSettings;
|
||||
QVector<Core::IOptionsPage *> m_frameworkSettingsPages;
|
||||
QHash<Core::Id, IFrameworkSettings *> m_frameworkSettings;
|
||||
TestTreeModel *m_testTreeModel;
|
||||
Internal::TestRunner *m_testRunner;
|
||||
|
||||
|
Reference in New Issue
Block a user