forked from qt-creator/qt-creator
AutoTest: Rename IFrameworkSettings to ITestSettings
...and move and rename frameworkSettings() function from ITestFramework to the new base class. Change-Id: Iedd883d1ffb9a57a4215a24f66f5422a46060a09 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
committed by
Oliver Wolff
parent
5cc7fc6a2d
commit
f9cb699211
@@ -39,10 +39,10 @@ add_qtc_plugin(AutoTest
|
||||
gtest/gtestsettingspage.cpp gtest/gtestsettingspage.h gtest/gtestsettingspage.ui
|
||||
gtest/gtesttreeitem.cpp gtest/gtesttreeitem.h
|
||||
gtest/gtestvisitors.cpp gtest/gtestvisitors.h
|
||||
iframeworksettings.h
|
||||
itemdatacache.h
|
||||
itestframework.cpp itestframework.h
|
||||
itestparser.cpp itestparser.h
|
||||
itestsettings.h
|
||||
projectsettingswidget.cpp projectsettingswidget.h
|
||||
qtest/qttest_utils.cpp qtest/qttest_utils.h
|
||||
qtest/qttestconfiguration.cpp qtest/qttestconfiguration.h
|
||||
|
@@ -78,10 +78,10 @@ HEADERS += \
|
||||
autotestconstants.h \
|
||||
autotesticons.h \
|
||||
autotestplugin.h \
|
||||
iframeworksettings.h \
|
||||
itemdatacache.h \
|
||||
itestframework.h \
|
||||
itestparser.h \
|
||||
itestsettings.h \
|
||||
projectsettingswidget.h \
|
||||
testcodeparser.h \
|
||||
testconfiguration.h \
|
||||
|
@@ -79,7 +79,7 @@ QtcPlugin {
|
||||
"itestparser.h",
|
||||
"itestframework.cpp",
|
||||
"itestframework.h",
|
||||
"iframeworksettings.h",
|
||||
"itestsettings.h",
|
||||
"testframeworkmanager.cpp",
|
||||
"testframeworkmanager.h",
|
||||
"testrunconfiguration.h"
|
||||
|
@@ -40,7 +40,7 @@ namespace Internal {
|
||||
TestOutputReader *BoostTestConfiguration::outputReader(const QFutureInterface<TestResultPtr> &fi,
|
||||
QProcess *app) const
|
||||
{
|
||||
auto settings = dynamic_cast<BoostTestSettings *>(framework()->frameworkSettings());
|
||||
auto settings = dynamic_cast<BoostTestSettings *>(framework()->testSettings());
|
||||
return new BoostTestOutputReader(fi, app, buildDirectory(), projectFile(),
|
||||
settings->logLevel, settings->reportLevel);
|
||||
}
|
||||
@@ -107,7 +107,7 @@ static QStringList filterInterfering(const QStringList &provided, QStringList *o
|
||||
|
||||
QStringList BoostTestConfiguration::argumentsForTestRunner(QStringList *omitted) const
|
||||
{
|
||||
auto boostSettings = dynamic_cast<BoostTestSettings *>(framework()->frameworkSettings());
|
||||
auto boostSettings = dynamic_cast<BoostTestSettings *>(framework()->testSettings());
|
||||
QStringList arguments;
|
||||
arguments << "-l" << BoostTestSettings::logLevelToOption(boostSettings->logLevel);
|
||||
arguments << "-r" << BoostTestSettings::reportLevelToOption(boostSettings->reportLevel);
|
||||
|
@@ -41,7 +41,7 @@ public:
|
||||
private:
|
||||
const char *name() const override;
|
||||
unsigned priority() const override;
|
||||
IFrameworkSettings *frameworkSettings() override { return &m_settings; }
|
||||
ITestSettings *testSettings() override { return &m_settings; }
|
||||
ITestParser *createTestParser() override;
|
||||
TestTreeItem *createRootNode() override;
|
||||
|
||||
|
@@ -41,7 +41,7 @@ QString BoostTestSettings::name() const
|
||||
return QString("BoostTest");
|
||||
}
|
||||
|
||||
void BoostTestSettings::fromFrameworkSettings(const QSettings *s)
|
||||
void BoostTestSettings::fromTestSettings(const QSettings *s)
|
||||
|
||||
{
|
||||
logLevel = LogLevel((s->value(logLevelKey, int(LogLevel::All)).toInt()));
|
||||
@@ -53,7 +53,7 @@ void BoostTestSettings::fromFrameworkSettings(const QSettings *s)
|
||||
seed = s->value(seedKey, 0).toInt();
|
||||
}
|
||||
|
||||
void BoostTestSettings::toFrameworkSettings(QSettings *s) const
|
||||
void BoostTestSettings::toTestSettings(QSettings *s) const
|
||||
{
|
||||
s->setValue(logLevelKey, int(logLevel));
|
||||
s->setValue(reportLevelKey, int(reportLevel));
|
||||
|
@@ -25,7 +25,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../iframeworksettings.h"
|
||||
#include "../itestsettings.h"
|
||||
|
||||
namespace Autotest {
|
||||
namespace Internal {
|
||||
@@ -53,7 +53,7 @@ enum class ReportLevel
|
||||
No
|
||||
};
|
||||
|
||||
class BoostTestSettings : public IFrameworkSettings
|
||||
class BoostTestSettings : public ITestSettings
|
||||
{
|
||||
public:
|
||||
BoostTestSettings() = default;
|
||||
@@ -70,8 +70,8 @@ public:
|
||||
bool memLeaks = true;
|
||||
|
||||
protected:
|
||||
void fromFrameworkSettings(const QSettings *s) override;
|
||||
void toFrameworkSettings(QSettings *s) const override;
|
||||
void fromTestSettings(const QSettings *s) override;
|
||||
void toTestSettings(QSettings *s) const override;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -104,7 +104,7 @@ QStringList CatchConfiguration::argumentsForTestRunner(QStringList *omitted) con
|
||||
' ', Qt::SkipEmptyParts), omitted);
|
||||
}
|
||||
|
||||
auto settings = dynamic_cast<CatchTestSettings *>(framework()->frameworkSettings());
|
||||
auto settings = dynamic_cast<CatchTestSettings *>(framework()->testSettings());
|
||||
if (!settings)
|
||||
return arguments;
|
||||
|
||||
|
@@ -45,7 +45,7 @@ protected:
|
||||
TestTreeItem *createRootNode() override;
|
||||
|
||||
private:
|
||||
IFrameworkSettings * frameworkSettings() override { return &m_settings; }
|
||||
ITestSettings * testSettings() override { return &m_settings; }
|
||||
CatchTestSettings m_settings;
|
||||
CatchTestSettingsPage m_settingsPage{&m_settings, settingsId()};
|
||||
};
|
||||
|
@@ -50,7 +50,7 @@ QString CatchTestSettings::name() const
|
||||
return QString("Catch2");
|
||||
}
|
||||
|
||||
void CatchTestSettings::toFrameworkSettings(QSettings *s) const
|
||||
void CatchTestSettings::toTestSettings(QSettings *s) const
|
||||
{
|
||||
s->setValue(abortAfterCheckedKey, abortAfterChecked);
|
||||
s->setValue(abortAfterKey, abortAfter);
|
||||
@@ -70,7 +70,7 @@ void CatchTestSettings::toFrameworkSettings(QSettings *s) const
|
||||
s->setValue(warnOnEmptyKey, warnOnEmpty);
|
||||
}
|
||||
|
||||
void CatchTestSettings::fromFrameworkSettings(const QSettings *s)
|
||||
void CatchTestSettings::fromTestSettings(const QSettings *s)
|
||||
{
|
||||
abortAfterChecked = s->value(abortAfterCheckedKey, false).toBool();
|
||||
abortAfter = s->value(abortAfterKey, 0).toInt();
|
||||
|
@@ -25,12 +25,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../iframeworksettings.h"
|
||||
#include "../itestsettings.h"
|
||||
|
||||
namespace Autotest {
|
||||
namespace Internal {
|
||||
|
||||
class CatchTestSettings : public IFrameworkSettings
|
||||
class CatchTestSettings : public ITestSettings
|
||||
{
|
||||
public:
|
||||
CatchTestSettings() = default;
|
||||
@@ -54,8 +54,8 @@ public:
|
||||
bool warnOnEmpty = false;
|
||||
|
||||
protected:
|
||||
void toFrameworkSettings(QSettings *s) const override;
|
||||
void fromFrameworkSettings(const QSettings *s) override;
|
||||
void toTestSettings(QSettings *s) const override;
|
||||
void fromTestSettings(const QSettings *s) override;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -84,7 +84,7 @@ QStringList GTestConfiguration::argumentsForTestRunner(QStringList *omitted) con
|
||||
if (!testSets.isEmpty())
|
||||
arguments << "--gtest_filter=" + testSets.join(':');
|
||||
|
||||
auto gSettings = dynamic_cast<GTestSettings *>(framework()->frameworkSettings());
|
||||
auto gSettings = dynamic_cast<GTestSettings *>(framework()->testSettings());
|
||||
if (!gSettings)
|
||||
return arguments;
|
||||
|
||||
|
@@ -45,7 +45,7 @@ private:
|
||||
const char *name() const override;
|
||||
unsigned priority() const override;
|
||||
QString groupingToolTip() const override;
|
||||
IFrameworkSettings *frameworkSettings() override { return &m_settings; }
|
||||
ITestSettings *testSettings() override { return &m_settings; }
|
||||
ITestParser *createTestParser() override;
|
||||
TestTreeItem *createRootNode() override;
|
||||
|
||||
|
@@ -44,7 +44,7 @@ QString GTestSettings::name() const
|
||||
return QString("GTest");
|
||||
}
|
||||
|
||||
void GTestSettings::fromFrameworkSettings(const QSettings *s)
|
||||
void GTestSettings::fromTestSettings(const QSettings *s)
|
||||
{
|
||||
runDisabled = s->value(runDisabledKey, false).toBool();
|
||||
repeat = s->value(repeatKey, false).toBool();
|
||||
@@ -62,7 +62,7 @@ void GTestSettings::fromFrameworkSettings(const QSettings *s)
|
||||
gtestFilter = GTest::Constants::DEFAULT_FILTER;
|
||||
}
|
||||
|
||||
void GTestSettings::toFrameworkSettings(QSettings *s) const
|
||||
void GTestSettings::toTestSettings(QSettings *s) const
|
||||
{
|
||||
s->setValue(runDisabledKey, runDisabled);
|
||||
s->setValue(repeatKey, repeat);
|
||||
|
@@ -25,13 +25,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../iframeworksettings.h"
|
||||
#include "../itestsettings.h"
|
||||
#include "gtestconstants.h"
|
||||
|
||||
namespace Autotest {
|
||||
namespace Internal {
|
||||
|
||||
class GTestSettings : public IFrameworkSettings
|
||||
class GTestSettings : public ITestSettings
|
||||
{
|
||||
public:
|
||||
GTestSettings() {}
|
||||
@@ -48,8 +48,8 @@ public:
|
||||
QString gtestFilter{GTest::Constants::DEFAULT_FILTER};
|
||||
|
||||
protected:
|
||||
void fromFrameworkSettings(const QSettings *s) override;
|
||||
void toFrameworkSettings(QSettings *s) const override;
|
||||
void fromTestSettings(const QSettings *s) override;
|
||||
void toTestSettings(QSettings *s) const override;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -30,7 +30,7 @@
|
||||
|
||||
namespace Autotest {
|
||||
|
||||
class IFrameworkSettings;
|
||||
class ITestSettings;
|
||||
|
||||
class ITestBase
|
||||
{
|
||||
@@ -41,6 +41,8 @@ public:
|
||||
virtual const char *name() const = 0;
|
||||
virtual unsigned priority() const = 0; // should this be modifyable?
|
||||
|
||||
virtual ITestSettings *testSettings() { return nullptr; }
|
||||
|
||||
TestTreeItem *rootNode();
|
||||
|
||||
Utils::Id settingsId() const;
|
||||
@@ -65,8 +67,6 @@ public:
|
||||
explicit ITestFramework(bool activeByDefault);
|
||||
~ITestFramework() override;
|
||||
|
||||
virtual IFrameworkSettings *frameworkSettings() { return nullptr; }
|
||||
|
||||
ITestParser *testParser();
|
||||
|
||||
bool grouping() const { return m_grouping; }
|
||||
|
@@ -31,11 +31,11 @@
|
||||
|
||||
namespace Autotest {
|
||||
|
||||
class IFrameworkSettings
|
||||
class ITestSettings
|
||||
{
|
||||
public:
|
||||
IFrameworkSettings() {}
|
||||
virtual ~IFrameworkSettings() {}
|
||||
ITestSettings() {}
|
||||
virtual ~ITestSettings() {}
|
||||
|
||||
virtual QString name() const = 0;
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
{
|
||||
s->beginGroup(Constants::SETTINGSGROUP);
|
||||
s->beginGroup(name());
|
||||
toFrameworkSettings(s);
|
||||
toTestSettings(s);
|
||||
s->endGroup();
|
||||
s->endGroup();
|
||||
}
|
||||
@@ -52,14 +52,14 @@ public:
|
||||
{
|
||||
s->beginGroup(Constants::SETTINGSGROUP);
|
||||
s->beginGroup(name());
|
||||
fromFrameworkSettings(s);
|
||||
fromTestSettings(s);
|
||||
s->endGroup();
|
||||
s->endGroup();
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void toFrameworkSettings(QSettings *s) const = 0;
|
||||
virtual void fromFrameworkSettings(const QSettings *s) = 0;
|
||||
virtual void toTestSettings(QSettings *s) const = 0;
|
||||
virtual void fromTestSettings(const QSettings *s) = 0;
|
||||
};
|
||||
|
||||
} // namespace Autotest
|
@@ -40,7 +40,7 @@ namespace Internal {
|
||||
TestOutputReader *QtTestConfiguration::outputReader(const QFutureInterface<TestResultPtr> &fi,
|
||||
QProcess *app) const
|
||||
{
|
||||
auto qtSettings = dynamic_cast<QtTestSettings *>(framework()->frameworkSettings());
|
||||
auto qtSettings = dynamic_cast<QtTestSettings *>(framework()->testSettings());
|
||||
const QtTestOutputReader::OutputMode mode = qtSettings && qtSettings->useXMLOutput
|
||||
? QtTestOutputReader::XML
|
||||
: QtTestOutputReader::PlainText;
|
||||
@@ -55,7 +55,7 @@ QStringList QtTestConfiguration::argumentsForTestRunner(QStringList *omitted) co
|
||||
runnable().commandLineArguments.split(' ', Qt::SkipEmptyParts),
|
||||
omitted, false));
|
||||
}
|
||||
auto qtSettings = dynamic_cast<QtTestSettings *>(framework()->frameworkSettings());
|
||||
auto qtSettings = dynamic_cast<QtTestSettings *>(framework()->testSettings());
|
||||
if (!qtSettings)
|
||||
return arguments;
|
||||
if (qtSettings->useXMLOutput)
|
||||
|
@@ -43,7 +43,7 @@ private:
|
||||
unsigned priority() const override;
|
||||
ITestParser *createTestParser() override;
|
||||
TestTreeItem *createRootNode() override;
|
||||
IFrameworkSettings *frameworkSettings() override { return &m_settings; }
|
||||
ITestSettings *testSettings() override { return &m_settings; }
|
||||
|
||||
QtTestSettings m_settings;
|
||||
QtTestSettingsPage m_settingsPage{&m_settings, settingsId()};
|
||||
|
@@ -57,7 +57,7 @@ QString QtTestSettings::name() const
|
||||
return QString("QtTest");
|
||||
}
|
||||
|
||||
void QtTestSettings::fromFrameworkSettings(const QSettings *s)
|
||||
void QtTestSettings::fromTestSettings(const QSettings *s)
|
||||
{
|
||||
metrics = intToMetrics(s->value(metricsKey, Walltime).toInt());
|
||||
noCrashHandler = s->value(noCrashhandlerKey, true).toBool();
|
||||
@@ -66,7 +66,7 @@ void QtTestSettings::fromFrameworkSettings(const QSettings *s)
|
||||
logSignalsSlots = s->value(logSignalsSlotsKey, false).toBool();
|
||||
}
|
||||
|
||||
void QtTestSettings::toFrameworkSettings(QSettings *s) const
|
||||
void QtTestSettings::toTestSettings(QSettings *s) const
|
||||
{
|
||||
s->setValue(metricsKey, metrics);
|
||||
s->setValue(noCrashhandlerKey, noCrashHandler);
|
||||
|
@@ -25,7 +25,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../iframeworksettings.h"
|
||||
#include "../itestsettings.h"
|
||||
|
||||
namespace Autotest {
|
||||
namespace Internal {
|
||||
@@ -39,7 +39,7 @@ enum MetricsType
|
||||
Perf
|
||||
};
|
||||
|
||||
class QtTestSettings : public IFrameworkSettings
|
||||
class QtTestSettings : public ITestSettings
|
||||
{
|
||||
public:
|
||||
QtTestSettings() {}
|
||||
@@ -53,8 +53,8 @@ public:
|
||||
bool logSignalsSlots = false;
|
||||
|
||||
protected:
|
||||
void fromFrameworkSettings(const QSettings *s) override;
|
||||
void toFrameworkSettings(QSettings *s) const override;
|
||||
void fromTestSettings(const QSettings *s) override;
|
||||
void toTestSettings(QSettings *s) const override;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -46,7 +46,7 @@ QuickTestConfiguration::QuickTestConfiguration(ITestFramework *framework)
|
||||
TestOutputReader *QuickTestConfiguration::outputReader(const QFutureInterface<TestResultPtr> &fi,
|
||||
QProcess *app) const
|
||||
{
|
||||
auto qtSettings = dynamic_cast<QtTestSettings *>(framework()->frameworkSettings());
|
||||
auto qtSettings = dynamic_cast<QtTestSettings *>(framework()->testSettings());
|
||||
const QtTestOutputReader::OutputMode mode = qtSettings && qtSettings->useXMLOutput
|
||||
? QtTestOutputReader::XML
|
||||
: QtTestOutputReader::PlainText;
|
||||
@@ -63,7 +63,7 @@ QStringList QuickTestConfiguration::argumentsForTestRunner(QStringList *omitted)
|
||||
omitted, true));
|
||||
}
|
||||
|
||||
auto qtSettings = dynamic_cast<QtTestSettings *>(framework()->frameworkSettings());
|
||||
auto qtSettings = dynamic_cast<QtTestSettings *>(framework()->testSettings());
|
||||
if (!qtSettings)
|
||||
return arguments;
|
||||
if (qtSettings->useXMLOutput)
|
||||
|
@@ -54,12 +54,12 @@ unsigned QuickTestFramework::priority() const
|
||||
return 5;
|
||||
}
|
||||
|
||||
IFrameworkSettings *QuickTestFramework::frameworkSettings()
|
||||
ITestSettings *QuickTestFramework::testSettings()
|
||||
{
|
||||
static const Utils::Id id
|
||||
= Utils::Id(Constants::FRAMEWORK_PREFIX).withSuffix(QtTest::Constants::FRAMEWORK_NAME);
|
||||
ITestFramework *qtTestFramework = TestFrameworkManager::frameworkForId(id);
|
||||
return qtTestFramework->frameworkSettings();
|
||||
return qtTestFramework->testSettings();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -44,7 +44,7 @@ public:
|
||||
QuickTestFramework() : ITestFramework(true) {}
|
||||
const char *name() const override;
|
||||
unsigned priority() const override;
|
||||
IFrameworkSettings *frameworkSettings() override;
|
||||
ITestSettings *testSettings() override;
|
||||
|
||||
protected:
|
||||
ITestParser *createTestParser() override;
|
||||
|
@@ -26,7 +26,7 @@
|
||||
#include "testframeworkmanager.h"
|
||||
#include "autotestconstants.h"
|
||||
#include "autotestplugin.h"
|
||||
#include "iframeworksettings.h"
|
||||
#include "itestsettings.h"
|
||||
#include "testsettings.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
@@ -87,7 +87,7 @@ void TestFrameworkManager::synchronizeSettings(QSettings *s)
|
||||
{
|
||||
Internal::AutotestPlugin::settings()->fromSettings(s);
|
||||
for (ITestFramework *framework : qAsConst(m_registeredFrameworks)) {
|
||||
if (IFrameworkSettings *fSettings = framework->frameworkSettings())
|
||||
if (ITestSettings *fSettings = framework->testSettings())
|
||||
fSettings->fromSettings(s);
|
||||
}
|
||||
}
|
||||
|
@@ -87,7 +87,7 @@ TestSettings TestSettingsWidget::settings() const
|
||||
result.popupOnFinish = m_ui.openResultsOnFinishCB->isChecked();
|
||||
result.popupOnFail = m_ui.openResultsOnFailCB->isChecked();
|
||||
result.runAfterBuild = RunAfterBuildMode(m_ui.runAfterBuildCB->currentIndex());
|
||||
frameworkSettings(result);
|
||||
testSettings(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ void TestSettingsWidget::populateFrameworksListWidget(const QHash<Utils::Id, boo
|
||||
}
|
||||
}
|
||||
|
||||
void TestSettingsWidget::frameworkSettings(TestSettings &settings) const
|
||||
void TestSettingsWidget::testSettings(TestSettings &settings) const
|
||||
{
|
||||
const QAbstractItemModel *model = m_ui.frameworkTreeWidget->model();
|
||||
QTC_ASSERT(model, return);
|
||||
|
@@ -47,7 +47,7 @@ public:
|
||||
|
||||
private:
|
||||
void populateFrameworksListWidget(const QHash<Utils::Id, bool> &frameworks);
|
||||
void frameworkSettings(TestSettings &settings) const;
|
||||
void testSettings(TestSettings &settings) const;
|
||||
void onFrameworkItemChanged();
|
||||
Ui::TestSettingsPage m_ui;
|
||||
|
||||
|
Reference in New Issue
Block a user