diff --git a/src/plugins/autotest/autotest.pro b/src/plugins/autotest/autotest.pro index 3898c4b8269..ab10b9bd6a2 100644 --- a/src/plugins/autotest/autotest.pro +++ b/src/plugins/autotest/autotest.pro @@ -70,6 +70,7 @@ HEADERS += \ testoutputreader.h \ autotesticons.h \ itestframework.h \ + iframeworksettings.h \ itestparser.h \ gtest/gtestconfiguration.h \ gtest/gtestparser.h \ diff --git a/src/plugins/autotest/autotest.qbs b/src/plugins/autotest/autotest.qbs index dd8070571a4..1318968989d 100644 --- a/src/plugins/autotest/autotest.qbs +++ b/src/plugins/autotest/autotest.qbs @@ -71,6 +71,7 @@ QtcPlugin { "itestparser.cpp", "itestparser.h", "itestframework.h", + "iframeworksettings", "testframeworkmanager.cpp", "testframeworkmanager.h", "testrunconfiguration.h" diff --git a/src/plugins/autotest/gtest/gtestsettings.cpp b/src/plugins/autotest/gtest/gtestsettings.cpp index 3d93b84f2a2..4303327c904 100644 --- a/src/plugins/autotest/gtest/gtestsettings.cpp +++ b/src/plugins/autotest/gtest/gtestsettings.cpp @@ -36,6 +36,11 @@ static const char seedKey[] = "Seed"; static const char shuffleKey[] = "Shuffle"; static const char throwOnFailureKey[] = "ThrowOnFailure"; +QString GTestSettings::name() const +{ + return QString("GTest"); +} + void GTestSettings::fromSettings(const QSettings *s) { runDisabled = s->value(QLatin1String(runDisabledKey), false).toBool(); diff --git a/src/plugins/autotest/gtest/gtestsettings.h b/src/plugins/autotest/gtest/gtestsettings.h index fa119837c9e..f79bf645521 100644 --- a/src/plugins/autotest/gtest/gtestsettings.h +++ b/src/plugins/autotest/gtest/gtestsettings.h @@ -25,17 +25,18 @@ #pragma once -#include +#include "../iframeworksettings.h" namespace Autotest { namespace Internal { -class GTestSettings +class GTestSettings : public IFrameworkSettings { public: GTestSettings() {} - void fromSettings(const QSettings *s); - void toSettings(QSettings *s) const; + QString name() const override; + void fromSettings(const QSettings *s) override; + void toSettings(QSettings *s) const override; int iterations = 1; int seed = 0; diff --git a/src/plugins/autotest/iframeworksettings.h b/src/plugins/autotest/iframeworksettings.h new file mode 100644 index 00000000000..8cc3f0b3ea7 --- /dev/null +++ b/src/plugins/autotest/iframeworksettings.h @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** 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 + +namespace Autotest { +namespace Internal { + +class IFrameworkSettings +{ +public: + IFrameworkSettings() {} + virtual ~IFrameworkSettings() {} + + virtual QString name() const = 0; + virtual void toSettings(QSettings *s) const = 0; + virtual void fromSettings(const QSettings *s) = 0; +}; + +} // namespace Internal +} // namespace Autotest diff --git a/src/plugins/autotest/qtest/qttestsettings.cpp b/src/plugins/autotest/qtest/qttestsettings.cpp index 40620559c1c..38bd50db7ab 100644 --- a/src/plugins/autotest/qtest/qttestsettings.cpp +++ b/src/plugins/autotest/qtest/qttestsettings.cpp @@ -49,6 +49,11 @@ static MetricsType intToMetrics(int value) } } +QString QtTestSettings::name() const +{ + return QString("QtTest"); +} + void QtTestSettings::fromSettings(const QSettings *s) { metrics = intToMetrics(s->value(QLatin1String(metricsKey), Walltime).toInt()); diff --git a/src/plugins/autotest/qtest/qttestsettings.h b/src/plugins/autotest/qtest/qttestsettings.h index ce6676e0a67..d1811d52287 100644 --- a/src/plugins/autotest/qtest/qttestsettings.h +++ b/src/plugins/autotest/qtest/qttestsettings.h @@ -25,7 +25,7 @@ #pragma once -#include +#include "../iframeworksettings.h" namespace Autotest { namespace Internal { @@ -39,12 +39,13 @@ enum MetricsType Perf }; -class QtTestSettings +class QtTestSettings : public IFrameworkSettings { public: QtTestSettings() {} - void fromSettings(const QSettings *s); - void toSettings(QSettings *s) const; + QString name() const override; + void fromSettings(const QSettings *s) override; + void toSettings(QSettings *s) const override; static QString metricsTypeToOption(const MetricsType type); MetricsType metrics = Walltime; diff --git a/src/plugins/autotest/testsettings.cpp b/src/plugins/autotest/testsettings.cpp index 501dd7d9675..17d1d2bc0d7 100644 --- a/src/plugins/autotest/testsettings.cpp +++ b/src/plugins/autotest/testsettings.cpp @@ -61,10 +61,10 @@ void TestSettings::toSettings(QSettings *s) const for (const Core::Id &id : frameworks.keys()) s->setValue(QLatin1String(id.name()), frameworks.value(id)); - s->beginGroup("QtTest"); + s->beginGroup(qtTestSettings.name()); qtTestSettings.toSettings(s); s->endGroup(); - s->beginGroup("GTest"); + s->beginGroup(gTestSettings.name()); gTestSettings.toSettings(s); s->endGroup(); @@ -89,10 +89,10 @@ void TestSettings::fromSettings(QSettings *s) frameworkManager->isActive(id)).toBool()); } - s->beginGroup("QtTest"); + s->beginGroup(qtTestSettings.name()); qtTestSettings.fromSettings(s); s->endGroup(); - s->beginGroup("GTest"); + s->beginGroup(gTestSettings.name()); gTestSettings.fromSettings(s); s->endGroup();