forked from qt-creator/qt-creator
AutoTest: Aspectify BoostTest settings page
Change-Id: I68e10a283fcd59f58c77301ef176b4347f68264a Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -16,7 +16,6 @@ add_qtc_plugin(AutoTest
|
||||
boost/boosttestparser.cpp boost/boosttestparser.h
|
||||
boost/boosttestresult.cpp boost/boosttestresult.h
|
||||
boost/boosttestsettings.cpp boost/boosttestsettings.h
|
||||
boost/boosttestsettingspage.cpp boost/boosttestsettingspage.h boost/boosttestsettingspage.ui
|
||||
boost/boosttesttreeitem.cpp boost/boosttesttreeitem.h
|
||||
catch/catchcodeparser.cpp catch/catchcodeparser.h
|
||||
catch/catchconfiguration.cpp catch/catchconfiguration.h
|
||||
|
||||
@@ -72,8 +72,7 @@ SOURCES += \
|
||||
boost/boosttestconfiguration.cpp \
|
||||
boost/boosttestoutputreader.cpp \
|
||||
boost/boosttestresult.cpp \
|
||||
boost/boosttestsettings.cpp \
|
||||
boost/boosttestsettingspage.cpp
|
||||
boost/boosttestsettings.cpp
|
||||
|
||||
HEADERS += \
|
||||
autotest_global.h \
|
||||
@@ -150,7 +149,6 @@ HEADERS += \
|
||||
boost/boosttestconfiguration.h \
|
||||
boost/boosttestoutputreader.h \
|
||||
boost/boosttestresult.h \
|
||||
boost/boosttestsettingspage.h \
|
||||
boost/boosttestsettings.h
|
||||
|
||||
RESOURCES += \
|
||||
@@ -158,7 +156,6 @@ RESOURCES += \
|
||||
|
||||
FORMS += \
|
||||
testsettingspage.ui \
|
||||
boost/boosttestsettingspage.ui \
|
||||
gtest/gtestsettingspage.ui
|
||||
|
||||
equals(TEST, 1) {
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "../itestframework.h"
|
||||
|
||||
#include "boosttestsettings.h"
|
||||
#include "boosttestsettingspage.h"
|
||||
|
||||
namespace Autotest {
|
||||
namespace Internal {
|
||||
|
||||
@@ -25,6 +25,14 @@
|
||||
|
||||
#include "boosttestsettings.h"
|
||||
|
||||
#include "boosttestconstants.h"
|
||||
|
||||
#include "../autotestconstants.h"
|
||||
|
||||
#include <utils/layoutbuilder.h>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace Autotest {
|
||||
namespace Internal {
|
||||
|
||||
@@ -35,27 +43,90 @@ BoostTestSettings::BoostTestSettings()
|
||||
|
||||
registerAspect(&logLevel);
|
||||
logLevel.setSettingsKey("LogLevel");
|
||||
logLevel.setDisplayStyle(SelectionAspect::DisplayStyle::ComboBox);
|
||||
logLevel.addOption("All");
|
||||
logLevel.addOption("Success");
|
||||
logLevel.addOption("Test Suite");
|
||||
logLevel.addOption("Unit Scope");
|
||||
logLevel.addOption("Message");
|
||||
logLevel.addOption("Warning");
|
||||
logLevel.addOption("Error");
|
||||
logLevel.addOption("C++ Exception");
|
||||
logLevel.addOption("System Error");
|
||||
logLevel.addOption("Fatal Error");
|
||||
logLevel.addOption("Nothing");
|
||||
logLevel.setDefaultValue(int(LogLevel::Warning));
|
||||
logLevel.setLabelText(tr("Log format:"));
|
||||
|
||||
registerAspect(&reportLevel);
|
||||
reportLevel.setSettingsKey("ReportLevel");
|
||||
reportLevel.setDisplayStyle(SelectionAspect::DisplayStyle::ComboBox);
|
||||
reportLevel.addOption("Confirm");
|
||||
reportLevel.addOption("Short");
|
||||
reportLevel.addOption("Detailed");
|
||||
reportLevel.addOption("No");
|
||||
reportLevel.setDefaultValue(int(ReportLevel::Confirm));
|
||||
reportLevel.setLabelText(tr("Report level:"));
|
||||
|
||||
registerAspect(&seed);
|
||||
seed.setSettingsKey("Seed");
|
||||
seed.setEnabled(false);
|
||||
seed.setLabelText(tr("Seed:"));
|
||||
seed.setToolTip(tr("A seed of 0 means no randomization. A value of 1 uses the current "
|
||||
"time, any other value is used as random seed generator."));
|
||||
|
||||
registerAspect(&randomize);
|
||||
randomize.setSettingsKey("Randomize");
|
||||
randomize.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel);
|
||||
randomize.setLabelText(tr("Randomize"));
|
||||
randomize.setToolTip(tr("Randomize execution order."));
|
||||
|
||||
registerAspect(&systemErrors);
|
||||
systemErrors.setSettingsKey("SystemErrors");
|
||||
systemErrors.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel);
|
||||
systemErrors.setLabelText(tr("Catch system errors"));
|
||||
systemErrors.setToolTip(tr("Catch or ignore system errors."));
|
||||
|
||||
registerAspect(&fpExceptions);
|
||||
fpExceptions.setSettingsKey("FPExceptions");
|
||||
fpExceptions.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel);
|
||||
fpExceptions.setLabelText(tr("Floating point exceptions"));
|
||||
fpExceptions.setToolTip(tr("Enable floating point exception traps."));
|
||||
|
||||
registerAspect(&memLeaks);
|
||||
memLeaks.setSettingsKey("MemoryLeaks");
|
||||
memLeaks.setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel);
|
||||
memLeaks.setDefaultValue(true);
|
||||
memLeaks.setLabelText(tr("Detect memory leaks"));
|
||||
memLeaks.setToolTip(tr("Enable memory leak detection."));
|
||||
|
||||
QObject::connect(&randomize, &BoolAspect::volatileValueChanged, &seed, &BaseAspect::setEnabled);
|
||||
}
|
||||
|
||||
BoostTestSettingsPage::BoostTestSettingsPage(BoostTestSettings *settings, Utils::Id settingsId)
|
||||
{
|
||||
setId(settingsId);
|
||||
setCategory(Constants::AUTOTEST_SETTINGS_CATEGORY);
|
||||
setDisplayName(QCoreApplication::translate("BoostTestFramework",
|
||||
BoostTest::Constants::FRAMEWORK_SETTINGS_CATEGORY));
|
||||
setSettings(settings);
|
||||
|
||||
setLayouter([settings](QWidget *widget) {
|
||||
BoostTestSettings &s = *settings;
|
||||
using namespace Layouting;
|
||||
const Break nl;
|
||||
|
||||
Grid grid {
|
||||
s.logLevel, nl,
|
||||
s.reportLevel, nl,
|
||||
s.randomize, Row { s.seed }, nl,
|
||||
s.systemErrors, nl,
|
||||
s.fpExceptions, nl,
|
||||
s.memLeaks,
|
||||
};
|
||||
|
||||
Column { Row { Column { grid, Stretch() }, Stretch() } }.attachTo(widget);
|
||||
});
|
||||
}
|
||||
|
||||
QString BoostTestSettings::logLevelToOption(const LogLevel logLevel)
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
|
||||
#include <utils/aspects.h>
|
||||
|
||||
namespace Autotest {
|
||||
@@ -55,6 +57,8 @@ enum class ReportLevel
|
||||
|
||||
class BoostTestSettings : public Utils::AspectContainer
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(Autotest::Internal::BoostTestSettings)
|
||||
|
||||
public:
|
||||
BoostTestSettings();
|
||||
|
||||
@@ -70,6 +74,13 @@ public:
|
||||
Utils::BoolAspect memLeaks;
|
||||
};
|
||||
|
||||
|
||||
class BoostTestSettingsPage final : public Core::IOptionsPage
|
||||
{
|
||||
public:
|
||||
BoostTestSettingsPage(BoostTestSettings *settings, Utils::Id settingsId);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Autotest
|
||||
|
||||
|
||||
@@ -1,115 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2019 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.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "boosttestsettingspage.h"
|
||||
#include "boosttestconstants.h"
|
||||
#include "boosttestsettings.h"
|
||||
#include "../testframeworkmanager.h"
|
||||
#include "../autotestconstants.h"
|
||||
#include "ui_boosttestsettingspage.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
namespace Autotest {
|
||||
namespace Internal {
|
||||
|
||||
class BoostTestSettingsWidget : public Core::IOptionsPageWidget
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(Autotest::Internal::BoostTestSettingsWidget)
|
||||
|
||||
public:
|
||||
explicit BoostTestSettingsWidget(BoostTestSettings *settings);
|
||||
|
||||
void apply() final;
|
||||
|
||||
void setSettings(const BoostTestSettings &settings);
|
||||
BoostTestSettings settings() const;
|
||||
|
||||
private:
|
||||
void fillComboBoxes();
|
||||
Ui::BoostSettingsPage m_ui;
|
||||
BoostTestSettings *m_settings;
|
||||
};
|
||||
|
||||
BoostTestSettingsWidget::BoostTestSettingsWidget(BoostTestSettings *settings)
|
||||
: m_settings(settings)
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
fillComboBoxes();
|
||||
connect(m_ui.randomizeCB, &QCheckBox::toggled, m_ui.seedSB, &QSpinBox::setEnabled);
|
||||
|
||||
m_ui.logFormatCB->setCurrentIndex(m_settings->logLevel.value());
|
||||
m_ui.reportLevelCB->setCurrentIndex(m_settings->reportLevel.value());
|
||||
m_ui.randomizeCB->setChecked(m_settings->randomize.value());
|
||||
m_ui.seedSB->setValue(m_settings->seed.value());
|
||||
m_ui.systemErrorCB->setChecked(m_settings->systemErrors.value());
|
||||
m_ui.fpExceptions->setChecked(m_settings->fpExceptions.value());
|
||||
m_ui.memoryLeakCB->setChecked(m_settings->memLeaks.value());
|
||||
}
|
||||
|
||||
void BoostTestSettingsWidget::apply()
|
||||
{
|
||||
m_settings->logLevel.setValue(m_ui.logFormatCB->currentData().toInt());
|
||||
m_settings->reportLevel.setValue(m_ui.reportLevelCB->currentData().toInt());
|
||||
m_settings->randomize.setValue(m_ui.randomizeCB->isChecked());
|
||||
m_settings->seed.setValue(m_ui.seedSB->value());
|
||||
m_settings->systemErrors.setValue(m_ui.systemErrorCB->isChecked());
|
||||
m_settings->fpExceptions.setValue(m_ui.fpExceptions->isChecked());
|
||||
m_settings->memLeaks.setValue(m_ui.memoryLeakCB->isChecked());
|
||||
|
||||
m_settings->writeSettings(Core::ICore::settings());
|
||||
}
|
||||
|
||||
void BoostTestSettingsWidget::fillComboBoxes()
|
||||
{
|
||||
m_ui.logFormatCB->addItem("All", QVariant::fromValue(LogLevel::All));
|
||||
m_ui.logFormatCB->addItem("Success", QVariant::fromValue(LogLevel::Success));
|
||||
m_ui.logFormatCB->addItem("Test Suite", QVariant::fromValue(LogLevel::TestSuite));
|
||||
m_ui.logFormatCB->addItem("Unit Scope", QVariant::fromValue(LogLevel::UnitScope));
|
||||
m_ui.logFormatCB->addItem("Message", QVariant::fromValue(LogLevel::Message));
|
||||
m_ui.logFormatCB->addItem("Warning", QVariant::fromValue(LogLevel::Warning));
|
||||
m_ui.logFormatCB->addItem("Error", QVariant::fromValue(LogLevel::Error));
|
||||
m_ui.logFormatCB->addItem("C++ Exception", QVariant::fromValue(LogLevel::CppException));
|
||||
m_ui.logFormatCB->addItem("System Error", QVariant::fromValue(LogLevel::SystemError));
|
||||
m_ui.logFormatCB->addItem("Fatal Error", QVariant::fromValue(LogLevel::FatalError));
|
||||
m_ui.logFormatCB->addItem("Nothing", QVariant::fromValue(LogLevel::Nothing));
|
||||
|
||||
m_ui.reportLevelCB->addItem("Confirm", QVariant::fromValue(ReportLevel::Confirm));
|
||||
m_ui.reportLevelCB->addItem("Short", QVariant::fromValue(ReportLevel::Short));
|
||||
m_ui.reportLevelCB->addItem("Detailed", QVariant::fromValue(ReportLevel::Detailed));
|
||||
m_ui.reportLevelCB->addItem("No", QVariant::fromValue(ReportLevel::No));
|
||||
}
|
||||
|
||||
BoostTestSettingsPage::BoostTestSettingsPage(BoostTestSettings *settings, Utils::Id settingsId)
|
||||
{
|
||||
setId(settingsId);
|
||||
setCategory(Constants::AUTOTEST_SETTINGS_CATEGORY);
|
||||
setDisplayName(QCoreApplication::translate("BoostTestFramework",
|
||||
BoostTest::Constants::FRAMEWORK_SETTINGS_CATEGORY));
|
||||
setWidgetCreator([settings] { return new BoostTestSettingsWidget(settings); });
|
||||
}
|
||||
|
||||
} // Internal
|
||||
} // Autotest
|
||||
@@ -1,42 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2019 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 <coreplugin/dialogs/ioptionspage.h>
|
||||
|
||||
namespace Autotest {
|
||||
namespace Internal {
|
||||
|
||||
class BoostTestSettings;
|
||||
|
||||
class BoostTestSettingsPage final : public Core::IOptionsPage
|
||||
{
|
||||
public:
|
||||
BoostTestSettingsPage(BoostTestSettings *settings, Utils::Id settingsId);
|
||||
};
|
||||
|
||||
} // Internal
|
||||
} // Autotest
|
||||
@@ -1,160 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>BoostSettingsPage</class>
|
||||
<widget class="QWidget" name="BoostSettingsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>309</width>
|
||||
<height>284</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Log format:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="logFormatCB"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Report level:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="reportLevelCB"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="randomizeCB">
|
||||
<property name="toolTip">
|
||||
<string>Randomize execution order.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Randomize</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Seed:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="seedSB">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>A seed of 0 means no randomization. A value of 1 uses the current time any other value is used as random seed generator.</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="systemErrorCB">
|
||||
<property name="toolTip">
|
||||
<string>Catch or ignore system errors.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Catch system errors</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="fpExceptions">
|
||||
<property name="toolTip">
|
||||
<string>Enable floating point exception traps.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Floating point exceptions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="memoryLeakCB">
|
||||
<property name="toolTip">
|
||||
<string>Enable memory leak detection.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Detect memory leaks</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>84</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user