2020-04-17 13:45:38 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** Copyright (C) 2020 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 "catchtestsettings.h"
|
|
|
|
|
|
2021-03-31 10:36:25 +02:00
|
|
|
#include "../autotestconstants.h"
|
|
|
|
|
|
|
|
|
|
#include <coreplugin/icore.h>
|
|
|
|
|
|
|
|
|
|
#include <utils/layoutbuilder.h>
|
|
|
|
|
|
|
|
|
|
using namespace Utils;
|
|
|
|
|
|
2020-04-17 13:45:38 +02:00
|
|
|
namespace Autotest {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2021-03-24 12:40:03 +01:00
|
|
|
CatchTestSettings::CatchTestSettings()
|
2020-04-17 13:45:38 +02:00
|
|
|
{
|
2021-03-24 12:40:03 +01:00
|
|
|
setSettingsGroups("Autotest", "Catch2");
|
|
|
|
|
setAutoApply(false);
|
2020-04-17 13:45:38 +02:00
|
|
|
|
2021-03-24 12:40:03 +01:00
|
|
|
registerAspect(&abortAfter);
|
|
|
|
|
abortAfter.setSettingsKey("AbortAfter");
|
2021-03-31 10:36:25 +02:00
|
|
|
abortAfter.setRange(1, 9999);
|
2021-04-12 13:43:24 +02:00
|
|
|
abortAfter.setEnabler(&abortAfterChecked);
|
2020-04-17 13:45:38 +02:00
|
|
|
|
2021-03-24 12:40:03 +01:00
|
|
|
registerAspect(&benchmarkSamples);
|
|
|
|
|
benchmarkSamples.setSettingsKey("BenchSamples");
|
2021-03-31 10:36:25 +02:00
|
|
|
benchmarkSamples.setRange(1, 999999);
|
2021-03-24 12:40:03 +01:00
|
|
|
benchmarkSamples.setDefaultValue(100);
|
2021-04-12 13:43:24 +02:00
|
|
|
benchmarkSamples.setEnabler(&samplesChecked);
|
2021-03-24 12:40:03 +01:00
|
|
|
|
|
|
|
|
registerAspect(&benchmarkResamples);
|
|
|
|
|
benchmarkResamples.setSettingsKey("BenchResamples");
|
2021-03-31 10:36:25 +02:00
|
|
|
benchmarkResamples.setRange(1, 9999999);
|
2021-03-24 12:40:03 +01:00
|
|
|
benchmarkResamples.setDefaultValue(100000);
|
2021-03-31 10:36:25 +02:00
|
|
|
benchmarkResamples.setToolTip(tr("Number of resamples for bootstrapping."));
|
2021-04-12 13:43:24 +02:00
|
|
|
benchmarkResamples.setEnabler(&resamplesChecked);
|
2021-03-24 12:40:03 +01:00
|
|
|
|
|
|
|
|
registerAspect(&confidenceInterval);
|
|
|
|
|
confidenceInterval.setSettingsKey("BenchConfInt");
|
2021-03-31 10:36:25 +02:00
|
|
|
confidenceInterval.setRange(0., 1.);
|
|
|
|
|
confidenceInterval.setSingleStep(0.05);
|
2021-03-24 12:40:03 +01:00
|
|
|
confidenceInterval.setDefaultValue(0.95);
|
2021-04-12 13:43:24 +02:00
|
|
|
confidenceInterval.setEnabler(&confidenceIntervalChecked);
|
2021-03-24 12:40:03 +01:00
|
|
|
|
|
|
|
|
registerAspect(&benchmarkWarmupTime);
|
|
|
|
|
benchmarkWarmupTime.setSettingsKey("BenchWarmup");
|
2021-03-31 10:36:25 +02:00
|
|
|
benchmarkWarmupTime.setSuffix(tr(" ms"));
|
|
|
|
|
benchmarkWarmupTime.setRange(0, 10000);
|
2021-04-12 13:43:24 +02:00
|
|
|
benchmarkWarmupTime.setEnabler(&warmupChecked);
|
2021-03-24 12:40:03 +01:00
|
|
|
|
|
|
|
|
registerAspect(&abortAfterChecked);
|
|
|
|
|
abortAfterChecked.setSettingsKey("AbortChecked");
|
2021-03-31 10:36:25 +02:00
|
|
|
abortAfterChecked.setLabelText(tr("Abort after"));
|
|
|
|
|
abortAfterChecked.setToolTip(tr("Aborts after the specified number of failures."));
|
2021-03-24 12:40:03 +01:00
|
|
|
|
|
|
|
|
registerAspect(&samplesChecked);
|
|
|
|
|
samplesChecked.setSettingsKey("SamplesChecked");
|
2021-03-31 10:36:25 +02:00
|
|
|
samplesChecked.setLabelText(tr("Benchmark samples"));
|
|
|
|
|
samplesChecked.setToolTip(tr("Number of samples to collect while running benchmarks."));
|
2021-03-24 12:40:03 +01:00
|
|
|
|
|
|
|
|
registerAspect(&resamplesChecked);
|
|
|
|
|
resamplesChecked.setSettingsKey("ResamplesChecked");
|
2021-03-31 10:36:25 +02:00
|
|
|
resamplesChecked.setLabelText(tr("Benchmark resamples"));
|
|
|
|
|
resamplesChecked.setToolTip(tr("Number of resamples used for statistical bootstrapping."));
|
2021-03-24 12:40:03 +01:00
|
|
|
|
|
|
|
|
registerAspect(&confidenceIntervalChecked);
|
|
|
|
|
confidenceIntervalChecked.setSettingsKey("ConfIntChecked");
|
2021-03-31 10:36:25 +02:00
|
|
|
confidenceIntervalChecked.setToolTip(tr("Confidence interval used for statistical bootstrapping."));
|
|
|
|
|
confidenceIntervalChecked.setLabelText(tr("Benchmark confidence interval"));
|
2021-03-24 12:40:03 +01:00
|
|
|
|
|
|
|
|
registerAspect(&warmupChecked);
|
|
|
|
|
warmupChecked.setSettingsKey("WarmupChecked");
|
2021-03-31 10:36:25 +02:00
|
|
|
warmupChecked.setLabelText(tr("Benchmark warmup time"));
|
|
|
|
|
warmupChecked.setToolTip(tr("Warmup time for each test."));
|
2021-03-24 12:40:03 +01:00
|
|
|
|
|
|
|
|
registerAspect(&noAnalysis);
|
|
|
|
|
noAnalysis.setSettingsKey("NoAnalysis");
|
2021-03-31 10:36:25 +02:00
|
|
|
noAnalysis.setLabelText(tr("Disable analysis"));
|
|
|
|
|
noAnalysis.setToolTip(tr("Disables statistical analysis and bootstrapping."));
|
2021-03-24 12:40:03 +01:00
|
|
|
|
|
|
|
|
registerAspect(&showSuccess);
|
|
|
|
|
showSuccess.setSettingsKey("ShowSuccess");
|
2021-03-31 10:36:25 +02:00
|
|
|
showSuccess.setLabelText(tr("Show success"));
|
|
|
|
|
showSuccess.setToolTip(tr("Show success for tests."));
|
2021-03-24 12:40:03 +01:00
|
|
|
|
|
|
|
|
registerAspect(&breakOnFailure);
|
|
|
|
|
breakOnFailure.setSettingsKey("BreakOnFailure");
|
|
|
|
|
breakOnFailure.setDefaultValue(true);
|
2021-03-31 10:36:25 +02:00
|
|
|
breakOnFailure.setLabelText(tr("Break on failure while debugging"));
|
|
|
|
|
breakOnFailure.setToolTip(tr("Turns failures into debugger breakpoints."));
|
2021-03-24 12:40:03 +01:00
|
|
|
|
|
|
|
|
registerAspect(&noThrow);
|
|
|
|
|
noThrow.setSettingsKey("NoThrow");
|
2021-03-31 10:36:25 +02:00
|
|
|
noThrow.setLabelText(tr("Skip throwing assertions"));
|
|
|
|
|
noThrow.setToolTip(tr("Skips all assertions that test for thrown exceptions."));
|
2021-03-24 12:40:03 +01:00
|
|
|
|
|
|
|
|
registerAspect(&visibleWhitespace);
|
|
|
|
|
visibleWhitespace.setSettingsKey("VisibleWS");
|
2021-03-31 10:36:25 +02:00
|
|
|
visibleWhitespace.setLabelText(tr("Visualize whitespace"));
|
|
|
|
|
visibleWhitespace.setToolTip(tr("Makes whitespace visible."));
|
2021-03-24 12:40:03 +01:00
|
|
|
|
|
|
|
|
registerAspect(&warnOnEmpty);
|
|
|
|
|
warnOnEmpty.setSettingsKey("WarnEmpty");
|
2021-03-31 10:36:25 +02:00
|
|
|
warnOnEmpty.setLabelText(tr("Warn on empty tests"));
|
|
|
|
|
warnOnEmpty.setToolTip(tr("Warns if a test section does not check any assertion."));
|
|
|
|
|
|
|
|
|
|
forEachAspect([](BaseAspect *aspect) {
|
|
|
|
|
// FIXME: Make the positioning part of the LayoutBuilder later
|
|
|
|
|
if (auto boolAspect = dynamic_cast<BoolAspect *>(aspect))
|
|
|
|
|
boolAspect->setLabelPlacement(BoolAspect::LabelPlacement::AtCheckBoxWithoutDummyLabel);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CatchTestSettingsPage::CatchTestSettingsPage(CatchTestSettings *settings, Utils::Id settingsId)
|
|
|
|
|
{
|
|
|
|
|
setId(settingsId);
|
|
|
|
|
setCategory(Constants::AUTOTEST_SETTINGS_CATEGORY);
|
|
|
|
|
setDisplayName(QCoreApplication::translate("CatchTestFramework", "Catch Test"));
|
|
|
|
|
setSettings(settings);
|
|
|
|
|
|
|
|
|
|
setLayouter([settings](QWidget *widget) {
|
|
|
|
|
CatchTestSettings &s = *settings;
|
|
|
|
|
using namespace Layouting;
|
|
|
|
|
const Break nl;
|
|
|
|
|
|
|
|
|
|
Grid col {
|
|
|
|
|
s.showSuccess, nl,
|
|
|
|
|
s.breakOnFailure, nl,
|
|
|
|
|
s.noThrow, nl,
|
|
|
|
|
s.visibleWhitespace, nl,
|
|
|
|
|
s.abortAfterChecked, s.abortAfter, nl,
|
|
|
|
|
s.samplesChecked, s.benchmarkSamples, nl,
|
|
|
|
|
s.resamplesChecked, s.benchmarkResamples, nl,
|
|
|
|
|
s.confidenceIntervalChecked, s.confidenceInterval, nl,
|
|
|
|
|
s.warmupChecked, s.benchmarkWarmupTime, nl,
|
|
|
|
|
s.noAnalysis
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Column { Row { col, Stretch() }, Stretch() }.attachTo(widget);
|
|
|
|
|
});
|
2020-04-17 13:45:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Autotest
|