AutoTest: Use new approach for settings

Avoids a couple of unneeded casts.

Change-Id: Ib3361d4ad2c69e4f0e4a44c5e9b3f385cefb6084
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Stenger
2023-07-13 10:06:14 +02:00
parent af998dae2c
commit fa815edae3
8 changed files with 11 additions and 18 deletions

View File

@@ -77,10 +77,7 @@ void AutoTestUnitTests::initTestCase()
}
// Enable quick check for derived tests
static const Id id = Id("AutoTest.Framework.QtTest");
static_cast<Autotest::Internal::QtTestFramework *>(
TestFrameworkManager::frameworkForId(id))
->quickCheckForDerivedTests.setValue(true);
theQtTestFramework().quickCheckForDerivedTests.setValue(true);
}
void AutoTestUnitTests::cleanupTestCase()

View File

@@ -17,7 +17,7 @@ namespace Internal {
TestOutputReader *BoostTestConfiguration::createOutputReader(Process *app) const
{
BoostTestFramework &settings = *static_cast<BoostTestFramework *>(framework());
BoostTestFramework &settings = theBoostTestFramework();
return new BoostTestOutputReader(app, buildDirectory(), projectFile(),
LogLevel(settings.logLevel()),
ReportLevel(settings.reportLevel()));
@@ -85,7 +85,7 @@ static QStringList filterInterfering(const QStringList &provided, QStringList *o
QStringList BoostTestConfiguration::argumentsForTestRunner(QStringList *omitted) const
{
BoostTestFramework &boostSettings = *static_cast<BoostTestFramework *>(framework());
BoostTestFramework &boostSettings = theBoostTestFramework();
QStringList arguments;
arguments << "-l" << BoostTestFramework::logLevelToOption(LogLevel(boostSettings.logLevel()));
arguments << "-r" << BoostTestFramework::reportLevelToOption(ReportLevel(boostSettings.reportLevel()));

View File

@@ -83,7 +83,7 @@ QStringList CatchConfiguration::argumentsForTestRunner(QStringList *omitted) con
' ', Qt::SkipEmptyParts), omitted);
}
CatchFramework &settings = *static_cast<CatchFramework *>(framework());
CatchFramework &settings = theCatchFramework();
if (settings.abortAfterChecked())
arguments << "-x" << QString::number(settings.abortAfter());

View File

@@ -88,8 +88,7 @@ QList<ITestConfiguration *> CTestTreeItem::testConfigurationsFor(const QStringLi
const ProjectExplorer::BuildSystem *buildSystem = target->buildSystem();
QStringList options{"--timeout", QString::number(testSettings().timeout() / 1000)};
auto ctestSettings = static_cast<CTestTool *>(testBase());
options << ctestSettings->activeSettingsAsOptions();
options << theCTestTool().activeSettingsAsOptions();
CommandLine command = buildSystem->commandLineForTests(selected, options);
if (command.executable().isEmpty())
return {};

View File

@@ -66,7 +66,7 @@ QStringList GTestConfiguration::argumentsForTestRunner(QStringList *omitted) con
arguments << "--gtest_filter=\"" + testSets.join(':') + '"';
}
GTestFramework &gSettings = *static_cast<GTestFramework *>(framework());
GTestFramework &gSettings = theGTestFramework();
if (gSettings.runDisabled())
arguments << "--gtest_also_run_disabled_tests";

View File

@@ -28,8 +28,7 @@ static QStringList quoteIfNeeded(const QStringList &testCases, bool debugMode)
TestOutputReader *QtTestConfiguration::createOutputReader(Process *app) const
{
QtTestFramework &qtSettings = *static_cast<QtTestFramework *>(framework());
const QtTestOutputReader::OutputMode mode = qtSettings.useXMLOutput()
const QtTestOutputReader::OutputMode mode = theQtTestFramework().useXMLOutput()
? QtTestOutputReader::XML
: QtTestOutputReader::PlainText;
return new QtTestOutputReader(app, buildDirectory(), projectFile(), mode, TestType::QtTest);
@@ -43,7 +42,7 @@ QStringList QtTestConfiguration::argumentsForTestRunner(QStringList *omitted) co
runnable().command.arguments().split(' ', Qt::SkipEmptyParts),
omitted, false));
}
QtTestFramework &qtSettings = *static_cast<QtTestFramework *>(framework());
QtTestFramework &qtSettings = theQtTestFramework();
if (qtSettings.useXMLOutput())
arguments << "-xml";
if (!testCases().isEmpty())

View File

@@ -21,8 +21,7 @@ QuickTestConfiguration::QuickTestConfiguration(ITestFramework *framework)
TestOutputReader *QuickTestConfiguration::createOutputReader(Process *app) const
{
QtTestFramework &qtSettings = *static_cast<QtTestFramework *>(framework());
const QtTestOutputReader::OutputMode mode = qtSettings.useXMLOutput()
const QtTestOutputReader::OutputMode mode = theQtTestFramework().useXMLOutput()
? QtTestOutputReader::XML
: QtTestOutputReader::PlainText;
return new QtTestOutputReader(app, buildDirectory(), projectFile(), mode, TestType::QuickTest);
@@ -37,7 +36,7 @@ QStringList QuickTestConfiguration::argumentsForTestRunner(QStringList *omitted)
omitted, true));
}
QtTestFramework &qtSettings = *static_cast<QtTestFramework *>(framework());
QtTestFramework &qtSettings = theQtTestFramework();
if (qtSettings.useXMLOutput())
arguments << "-xml";
if (!testCases().isEmpty())

View File

@@ -357,8 +357,7 @@ void QuickTestParser::init(const QSet<FilePath> &filesToParse, bool fullParse)
m_mainCppFiles.clear();
}
QtTestFramework &qtSettings = *static_cast<QtTestFramework *>(framework());
m_checkForDerivedTests = qtSettings.quickCheckForDerivedTests();
m_checkForDerivedTests = theQtTestFramework().quickCheckForDerivedTests();
CppParser::init(filesToParse, fullParse);
}