2014-12-04 14:05:19 +01:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2016-01-22 10:37:55 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2014-12-04 14:05:19 +01:00
|
|
|
**
|
2016-01-22 10:37:55 +01:00
|
|
|
** This file is part of Qt Creator.
|
2014-12-04 14:05:19 +01:00
|
|
|
**
|
2016-01-22 10:37:55 +01:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
2014-12-04 14:05:19 +01:00
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-22 10:37:55 +01:00
|
|
|
** 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.
|
2014-12-04 14:05:19 +01:00
|
|
|
**
|
2016-01-22 10:37:55 +01:00
|
|
|
** 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.
|
2014-12-04 14:05:19 +01:00
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "testsettings.h"
|
2016-06-06 15:35:00 +02:00
|
|
|
#include "testframeworkmanager.h"
|
|
|
|
|
|
|
|
|
|
#include <coreplugin/id.h>
|
2014-12-04 14:05:19 +01:00
|
|
|
|
|
|
|
|
#include <QSettings>
|
|
|
|
|
|
|
|
|
|
namespace Autotest {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2016-09-13 09:30:59 +02:00
|
|
|
static const char group[] = "Autotest";
|
|
|
|
|
static const char timeoutKey[] = "Timeout";
|
|
|
|
|
static const char omitInternalKey[] = "OmitInternal";
|
|
|
|
|
static const char omitRunConfigWarnKey[] = "OmitRCWarnings";
|
|
|
|
|
static const char limitResultOutputKey[] = "LimitResultOutput";
|
|
|
|
|
static const char autoScrollKey[] = "AutoScrollResults";
|
|
|
|
|
static const char alwaysParseKey[] = "AlwaysParse";
|
2016-06-06 15:35:00 +02:00
|
|
|
|
2014-12-04 14:05:19 +01:00
|
|
|
static const int defaultTimeout = 60000;
|
|
|
|
|
|
|
|
|
|
TestSettings::TestSettings()
|
2016-09-13 09:30:59 +02:00
|
|
|
: timeout(defaultTimeout)
|
2014-12-04 14:05:19 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TestSettings::toSettings(QSettings *s) const
|
|
|
|
|
{
|
|
|
|
|
s->beginGroup(QLatin1String(group));
|
|
|
|
|
s->setValue(QLatin1String(timeoutKey), timeout);
|
|
|
|
|
s->setValue(QLatin1String(omitInternalKey), omitInternalMssg);
|
2015-02-17 10:33:35 +01:00
|
|
|
s->setValue(QLatin1String(omitRunConfigWarnKey), omitRunConfigWarn);
|
2015-04-09 15:51:42 +02:00
|
|
|
s->setValue(QLatin1String(limitResultOutputKey), limitResultOutput);
|
2015-04-16 08:54:41 +02:00
|
|
|
s->setValue(QLatin1String(autoScrollKey), autoScroll);
|
2016-02-01 15:12:10 +01:00
|
|
|
s->setValue(QLatin1String(alwaysParseKey), alwaysParse);
|
2016-06-06 15:35:00 +02:00
|
|
|
// store frameworks and their current active state
|
|
|
|
|
for (const Core::Id &id : frameworks.keys())
|
|
|
|
|
s->setValue(QLatin1String(id.name()), frameworks.value(id));
|
2016-09-13 09:30:59 +02:00
|
|
|
|
|
|
|
|
s->beginGroup("QtTest");
|
|
|
|
|
qtTestSettings.toSettings(s);
|
|
|
|
|
s->endGroup();
|
|
|
|
|
s->beginGroup("GTest");
|
|
|
|
|
gTestSettings.toSettings(s);
|
2014-12-04 14:05:19 +01:00
|
|
|
s->endGroup();
|
|
|
|
|
|
2016-09-13 09:30:59 +02:00
|
|
|
s->endGroup();
|
2014-12-04 14:05:19 +01:00
|
|
|
}
|
|
|
|
|
|
2016-09-13 09:30:59 +02:00
|
|
|
void TestSettings::fromSettings(QSettings *s)
|
2014-12-04 14:05:19 +01:00
|
|
|
{
|
2016-09-13 09:30:59 +02:00
|
|
|
s->beginGroup(group);
|
|
|
|
|
timeout = s->value(QLatin1String(timeoutKey), defaultTimeout).toInt();
|
|
|
|
|
omitInternalMssg = s->value(QLatin1String(omitInternalKey), true).toBool();
|
|
|
|
|
omitRunConfigWarn = s->value(QLatin1String(omitRunConfigWarnKey), false).toBool();
|
|
|
|
|
limitResultOutput = s->value(QLatin1String(limitResultOutputKey), true).toBool();
|
|
|
|
|
autoScroll = s->value(QLatin1String(autoScrollKey), true).toBool();
|
|
|
|
|
alwaysParse = s->value(QLatin1String(alwaysParseKey), true).toBool();
|
2016-06-06 15:35:00 +02:00
|
|
|
// try to get settings for registered frameworks
|
|
|
|
|
TestFrameworkManager *frameworkManager = TestFrameworkManager::instance();
|
|
|
|
|
const QList<Core::Id> ®istered = frameworkManager->registeredFrameworkIds();
|
|
|
|
|
frameworks.clear();
|
|
|
|
|
for (const Core::Id &id : registered) {
|
2016-09-13 09:30:59 +02:00
|
|
|
frameworks.insert(id, s->value(QLatin1String(id.name()),
|
2016-06-06 15:35:00 +02:00
|
|
|
frameworkManager->isActive(id)).toBool());
|
|
|
|
|
}
|
2014-12-04 14:05:19 +01:00
|
|
|
|
2016-09-13 09:30:59 +02:00
|
|
|
s->beginGroup("QtTest");
|
|
|
|
|
qtTestSettings.fromSettings(s);
|
|
|
|
|
s->endGroup();
|
|
|
|
|
s->beginGroup("GTest");
|
|
|
|
|
gTestSettings.fromSettings(s);
|
|
|
|
|
s->endGroup();
|
|
|
|
|
|
|
|
|
|
s->endGroup();
|
2014-12-04 14:05:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Autotest
|