From 2d92ae391a229b84aaefc7aa3297b1e15851a25b Mon Sep 17 00:00:00 2001 From: Bernhard Beschow Date: Mon, 25 Jan 2021 16:19:38 +0100 Subject: [PATCH] AutoTest: Prefer ITestBase::type() to ITestBase::asTest*() The casting provided by the asTest*() methods isn't made use of here, so using the "data-oriented" type() method seems more expressive. Change-Id: Ia3e1a28d126f096afed54eeb0d884c52332f4350 Reviewed-by: Christian Stenger --- src/plugins/autotest/testrunner.cpp | 6 +++--- src/plugins/autotest/testtreemodel.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/autotest/testrunner.cpp b/src/plugins/autotest/testrunner.cpp index c4c3f9ea8d1..c807f6b8635 100644 --- a/src/plugins/autotest/testrunner.cpp +++ b/src/plugins/autotest/testrunner.cpp @@ -148,7 +148,7 @@ static QString processInformation(const QProcess *proc) static QString rcInfo(const ITestConfiguration * const config) { - if (config->testBase()->asTestTool()) + if (config->testBase()->type() == ITestBase::Tool) return {}; const TestConfiguration *current = static_cast(config); QString info; @@ -477,7 +477,7 @@ int TestRunner::precheckTestConfigurations() const bool omitWarnings = AutotestPlugin::settings()->omitRunConfigWarn; int testCaseCount = 0; for (ITestConfiguration *itc : qAsConst(m_selectedTests)) { - if (itc->testBase()->asTestTool()) { + if (itc->testBase()->type() == ITestBase::Tool) { if (itc->project()) { testCaseCount += itc->testCaseCount(); } else { @@ -524,7 +524,7 @@ void TestRunner::runTests() QList toBeRemoved; bool projectChanged = false; for (ITestConfiguration *itc : qAsConst(m_selectedTests)) { - if (itc->testBase()->asTestTool()) { + if (itc->testBase()->type() == ITestBase::Tool) { if (itc->project() != SessionManager::startupProject()) { projectChanged = true; toBeRemoved.append(itc); diff --git a/src/plugins/autotest/testtreemodel.cpp b/src/plugins/autotest/testtreemodel.cpp index 2ac9e369ec7..963d827ae1a 100644 --- a/src/plugins/autotest/testtreemodel.cpp +++ b/src/plugins/autotest/testtreemodel.cpp @@ -374,7 +374,7 @@ void TestTreeModel::synchronizeTestTools() QList oldFrameworkRoots; for (Utils::TreeItem *oldFrameworkRoot : *invisibleRoot) { auto item = static_cast(oldFrameworkRoot); - if (item->testBase()->asTestTool()) + if (item->testBase()->type() == ITestBase::Tool) oldFrameworkRoots.append(item); }