forked from qt-creator/qt-creator
AutoTest: Generalize framework specific settings
Change-Id: Ie8a1db6408d2ceac7331d29ef25d193a15186a4c Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -70,6 +70,7 @@ HEADERS += \
|
||||
testoutputreader.h \
|
||||
autotesticons.h \
|
||||
itestframework.h \
|
||||
iframeworksettings.h \
|
||||
itestparser.h \
|
||||
gtest/gtestconfiguration.h \
|
||||
gtest/gtestparser.h \
|
||||
|
||||
@@ -71,6 +71,7 @@ QtcPlugin {
|
||||
"itestparser.cpp",
|
||||
"itestparser.h",
|
||||
"itestframework.h",
|
||||
"iframeworksettings",
|
||||
"testframeworkmanager.cpp",
|
||||
"testframeworkmanager.h",
|
||||
"testrunconfiguration.h"
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -25,17 +25,18 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QSettings>
|
||||
#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;
|
||||
|
||||
45
src/plugins/autotest/iframeworksettings.h
Normal file
45
src/plugins/autotest/iframeworksettings.h
Normal file
@@ -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 <QSettings>
|
||||
|
||||
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
|
||||
@@ -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());
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QSettings>
|
||||
#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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user