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 <christian.stenger@qt.io>
This commit is contained in:
Bernhard Beschow
2021-01-25 16:19:38 +01:00
parent e740295b8d
commit 2d92ae391a
2 changed files with 4 additions and 4 deletions

View File

@@ -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<const TestConfiguration *>(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<ITestConfiguration *> 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);

View File

@@ -374,7 +374,7 @@ void TestTreeModel::synchronizeTestTools()
QList<ITestTreeItem *> oldFrameworkRoots;
for (Utils::TreeItem *oldFrameworkRoot : *invisibleRoot) {
auto item = static_cast<ITestTreeItem *>(oldFrameworkRoot);
if (item->testBase()->asTestTool())
if (item->testBase()->type() == ITestBase::Tool)
oldFrameworkRoots.append(item);
}