2016-05-11 13:02:42 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** Copyright (C) 2016 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.
|
|
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
2016-05-31 14:24:42 +02:00
|
|
|
#include "qttesttreeitem.h"
|
2016-05-11 13:02:42 +02:00
|
|
|
#include "qttestconfiguration.h"
|
|
|
|
|
#include "qttestparser.h"
|
2017-12-06 08:45:36 +01:00
|
|
|
#include "../testframeworkmanager.h"
|
2016-05-11 13:02:42 +02:00
|
|
|
|
|
|
|
|
#include <projectexplorer/session.h>
|
|
|
|
|
#include <utils/qtcassert.h>
|
|
|
|
|
|
|
|
|
|
namespace Autotest {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2020-03-26 10:11:39 +01:00
|
|
|
QtTestTreeItem::QtTestTreeItem(ITestFramework *framework, const QString &name,
|
|
|
|
|
const QString &filePath, TestTreeItem::Type type)
|
|
|
|
|
: TestTreeItem(framework, name, filePath, type)
|
2016-10-11 16:00:05 +02:00
|
|
|
{
|
|
|
|
|
if (type == TestDataTag)
|
2018-01-23 16:12:47 +01:00
|
|
|
setData(0, Qt::Checked, Qt::CheckStateRole);
|
2016-10-11 16:00:05 +02:00
|
|
|
}
|
|
|
|
|
|
2018-03-06 10:38:36 +01:00
|
|
|
TestTreeItem *QtTestTreeItem::copyWithoutChildren()
|
|
|
|
|
{
|
2020-03-26 10:11:39 +01:00
|
|
|
QtTestTreeItem *copied = new QtTestTreeItem(framework());
|
2018-03-06 10:38:36 +01:00
|
|
|
copied->copyBasicDataFrom(this);
|
|
|
|
|
copied->m_inherited = m_inherited;
|
|
|
|
|
return copied;
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-31 14:24:42 +02:00
|
|
|
QVariant QtTestTreeItem::data(int column, int role) const
|
2016-05-11 13:02:42 +02:00
|
|
|
{
|
|
|
|
|
switch (role) {
|
2017-01-04 12:06:46 +01:00
|
|
|
case Qt::DisplayRole:
|
|
|
|
|
if (type() == Root)
|
|
|
|
|
break;
|
|
|
|
|
return QVariant(name() + nameSuffix());
|
2016-05-11 13:02:42 +02:00
|
|
|
case Qt::CheckStateRole:
|
|
|
|
|
switch (type()) {
|
|
|
|
|
case TestDataFunction:
|
|
|
|
|
case TestSpecialFunction:
|
|
|
|
|
return QVariant();
|
|
|
|
|
default:
|
|
|
|
|
return checked();
|
|
|
|
|
}
|
|
|
|
|
case ItalicRole:
|
|
|
|
|
switch (type()) {
|
|
|
|
|
case TestDataFunction:
|
|
|
|
|
case TestSpecialFunction:
|
|
|
|
|
return true;
|
|
|
|
|
default:
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return TestTreeItem::data(column, role);
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-11 16:00:05 +02:00
|
|
|
Qt::ItemFlags QtTestTreeItem::flags(int column) const
|
|
|
|
|
{
|
|
|
|
|
static const Qt::ItemFlags defaultFlags = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
|
|
|
|
switch (type()) {
|
|
|
|
|
case TestDataTag:
|
|
|
|
|
return defaultFlags | Qt::ItemIsUserCheckable;
|
2019-05-21 07:50:34 +02:00
|
|
|
case TestFunction:
|
2016-10-11 16:00:05 +02:00
|
|
|
return defaultFlags | Qt::ItemIsAutoTristate | Qt::ItemIsUserCheckable;
|
|
|
|
|
default:
|
|
|
|
|
return TestTreeItem::flags(column);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-31 14:24:42 +02:00
|
|
|
bool QtTestTreeItem::canProvideTestConfiguration() const
|
2016-05-11 13:02:42 +02:00
|
|
|
{
|
|
|
|
|
switch (type()) {
|
|
|
|
|
case TestCase:
|
2019-05-21 07:50:34 +02:00
|
|
|
case TestFunction:
|
2016-05-11 13:02:42 +02:00
|
|
|
case TestDataTag:
|
|
|
|
|
return true;
|
|
|
|
|
default:
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-15 12:29:24 +02:00
|
|
|
bool QtTestTreeItem::canProvideDebugConfiguration() const
|
|
|
|
|
{
|
|
|
|
|
return canProvideTestConfiguration();
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-31 14:24:42 +02:00
|
|
|
TestConfiguration *QtTestTreeItem::testConfiguration() const
|
2016-05-11 13:02:42 +02:00
|
|
|
{
|
|
|
|
|
ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject();
|
2017-02-13 10:05:06 +01:00
|
|
|
QTC_ASSERT(project, return nullptr);
|
2016-05-11 13:02:42 +02:00
|
|
|
|
2017-02-13 10:05:06 +01:00
|
|
|
QtTestConfiguration *config = nullptr;
|
2016-05-11 13:02:42 +02:00
|
|
|
switch (type()) {
|
|
|
|
|
case TestCase:
|
2020-03-26 10:11:39 +01:00
|
|
|
config = new QtTestConfiguration(framework());
|
2016-05-11 13:02:42 +02:00
|
|
|
config->setTestCaseCount(childCount());
|
2017-02-21 14:53:58 +01:00
|
|
|
config->setProjectFile(proFile());
|
2016-05-11 13:02:42 +02:00
|
|
|
config->setProject(project);
|
|
|
|
|
break;
|
2019-05-21 07:50:34 +02:00
|
|
|
case TestFunction: {
|
2016-05-11 13:02:42 +02:00
|
|
|
TestTreeItem *parent = parentItem();
|
2020-03-26 10:11:39 +01:00
|
|
|
config = new QtTestConfiguration(framework());
|
2016-05-11 13:02:42 +02:00
|
|
|
config->setTestCases(QStringList(name()));
|
2017-02-21 14:53:58 +01:00
|
|
|
config->setProjectFile(parent->proFile());
|
2016-05-11 13:02:42 +02:00
|
|
|
config->setProject(project);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2016-05-31 14:24:42 +02:00
|
|
|
case TestDataTag: {
|
2016-05-11 13:02:42 +02:00
|
|
|
const TestTreeItem *function = parentItem();
|
2017-02-13 10:05:06 +01:00
|
|
|
const TestTreeItem *parent = function ? function->parentItem() : nullptr;
|
2016-05-11 13:02:42 +02:00
|
|
|
if (!parent)
|
2017-02-13 10:05:06 +01:00
|
|
|
return nullptr;
|
2016-09-29 12:15:43 +02:00
|
|
|
const QString functionWithTag = function->name() + ':' + name();
|
2020-03-26 10:11:39 +01:00
|
|
|
config = new QtTestConfiguration(framework());
|
2016-05-11 13:02:42 +02:00
|
|
|
config->setTestCases(QStringList(functionWithTag));
|
2017-02-21 14:53:58 +01:00
|
|
|
config->setProjectFile(parent->proFile());
|
2016-05-11 13:02:42 +02:00
|
|
|
config->setProject(project);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
default:
|
2017-02-13 10:05:06 +01:00
|
|
|
return nullptr;
|
2016-05-11 13:02:42 +02:00
|
|
|
}
|
2017-06-09 09:30:21 +02:00
|
|
|
if (config)
|
|
|
|
|
config->setInternalTargets(internalTargets());
|
2016-05-11 13:02:42 +02:00
|
|
|
return config;
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-17 09:51:45 +01:00
|
|
|
static void fillTestConfigurationsFromCheckState(const TestTreeItem *item,
|
|
|
|
|
QList<TestConfiguration *> &testConfigurations)
|
|
|
|
|
{
|
|
|
|
|
QTC_ASSERT(item, return);
|
|
|
|
|
if (item->type() == TestTreeItem::GroupNode) {
|
|
|
|
|
for (int row = 0, count = item->childCount(); row < count; ++row)
|
2018-04-17 15:53:06 +02:00
|
|
|
fillTestConfigurationsFromCheckState(item->childAt(row), testConfigurations);
|
2018-01-17 09:51:45 +01:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
QTC_ASSERT(item->type() == TestTreeItem::TestCase, return);
|
|
|
|
|
QtTestConfiguration *testConfig = nullptr;
|
|
|
|
|
switch (item->checked()) {
|
|
|
|
|
case Qt::Unchecked:
|
|
|
|
|
return;
|
|
|
|
|
case Qt::Checked:
|
|
|
|
|
testConfig = static_cast<QtTestConfiguration *>(item->testConfiguration());
|
|
|
|
|
QTC_ASSERT(testConfig, return);
|
|
|
|
|
testConfigurations << testConfig;
|
|
|
|
|
return;
|
|
|
|
|
case Qt::PartiallyChecked:
|
|
|
|
|
QStringList testCases;
|
2018-04-17 15:53:06 +02:00
|
|
|
item->forFirstLevelChildren([&testCases](TestTreeItem *grandChild) {
|
2018-01-17 09:51:45 +01:00
|
|
|
if (grandChild->checked() == Qt::Checked) {
|
|
|
|
|
testCases << grandChild->name();
|
|
|
|
|
} else if (grandChild->checked() == Qt::PartiallyChecked) {
|
|
|
|
|
const QString funcName = grandChild->name();
|
2018-04-17 15:53:06 +02:00
|
|
|
grandChild->forFirstLevelChildren([&testCases, &funcName](TestTreeItem *dataTag) {
|
2018-01-17 09:51:45 +01:00
|
|
|
if (dataTag->checked() == Qt::Checked)
|
|
|
|
|
testCases << funcName + ':' + dataTag->name();
|
2018-04-17 15:53:06 +02:00
|
|
|
});
|
2018-01-17 09:51:45 +01:00
|
|
|
}
|
2018-04-17 15:53:06 +02:00
|
|
|
});
|
2018-01-17 09:51:45 +01:00
|
|
|
|
2020-03-26 10:11:39 +01:00
|
|
|
testConfig = new QtTestConfiguration(item->framework());
|
2018-01-17 09:51:45 +01:00
|
|
|
testConfig->setTestCases(testCases);
|
|
|
|
|
testConfig->setProjectFile(item->proFile());
|
|
|
|
|
testConfig->setProject(ProjectExplorer::SessionManager::startupProject());
|
|
|
|
|
testConfig->setInternalTargets(item->internalTargets());
|
|
|
|
|
testConfigurations << testConfig;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-11 14:30:15 +02:00
|
|
|
static void collectFailedTestInfo(TestTreeItem *item, QList<TestConfiguration *> &testConfigs)
|
|
|
|
|
{
|
|
|
|
|
QTC_ASSERT(item, return);
|
|
|
|
|
if (item->type() == TestTreeItem::GroupNode) {
|
|
|
|
|
for (int row = 0, count = item->childCount(); row < count; ++row)
|
|
|
|
|
collectFailedTestInfo(item->childAt(row), testConfigs);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
QTC_ASSERT(item->type() == TestTreeItem::TestCase, return);
|
|
|
|
|
QStringList testCases;
|
|
|
|
|
item->forFirstLevelChildren([&testCases](TestTreeItem *func) {
|
|
|
|
|
if (func->data(0, FailedRole).toBool()) {
|
|
|
|
|
testCases << func->name();
|
|
|
|
|
} else {
|
|
|
|
|
func->forFirstLevelChildren([&testCases, func](TestTreeItem *dataTag) {
|
|
|
|
|
if (dataTag->data(0, FailedRole).toBool())
|
|
|
|
|
testCases << func->name() + ':' + dataTag->name();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
if (testCases.isEmpty())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
QtTestConfiguration *testConfig = new QtTestConfiguration(item->framework());
|
|
|
|
|
testConfig->setTestCases(testCases);
|
|
|
|
|
testConfig->setProjectFile(item->proFile());
|
|
|
|
|
testConfig->setProject(ProjectExplorer::SessionManager::startupProject());
|
|
|
|
|
testConfig->setInternalTargets(item->internalTargets());
|
|
|
|
|
testConfigs << testConfig;
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-15 12:29:24 +02:00
|
|
|
TestConfiguration *QtTestTreeItem::debugConfiguration() const
|
|
|
|
|
{
|
|
|
|
|
QtTestConfiguration *config = static_cast<QtTestConfiguration *>(testConfiguration());
|
2016-08-12 09:07:38 +02:00
|
|
|
if (config)
|
2017-09-05 13:57:22 +02:00
|
|
|
config->setRunMode(TestRunMode::Debug);
|
2016-06-15 12:29:24 +02:00
|
|
|
return config;
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-31 14:24:42 +02:00
|
|
|
QList<TestConfiguration *> QtTestTreeItem::getAllTestConfigurations() const
|
2016-05-11 13:02:42 +02:00
|
|
|
{
|
|
|
|
|
QList<TestConfiguration *> result;
|
|
|
|
|
|
|
|
|
|
ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject();
|
|
|
|
|
if (!project || type() != Root)
|
|
|
|
|
return result;
|
|
|
|
|
|
2018-04-17 15:53:06 +02:00
|
|
|
forFirstLevelChildren([&result](TestTreeItem *child) {
|
2018-01-17 09:51:45 +01:00
|
|
|
if (child->type() == TestCase) {
|
2018-04-17 15:53:06 +02:00
|
|
|
TestConfiguration *tc = child->testConfiguration();
|
|
|
|
|
QTC_ASSERT(tc, return);
|
2018-01-17 09:51:45 +01:00
|
|
|
result << tc;
|
|
|
|
|
} else if (child->type() == GroupNode) {
|
2018-04-17 15:53:06 +02:00
|
|
|
child->forFirstLevelChildren([&result](TestTreeItem *groupChild) {
|
|
|
|
|
TestConfiguration *tc = groupChild->testConfiguration();
|
|
|
|
|
QTC_ASSERT(tc, return);
|
2018-01-17 09:51:45 +01:00
|
|
|
result << tc;
|
2018-04-17 15:53:06 +02:00
|
|
|
});
|
2018-01-17 09:51:45 +01:00
|
|
|
}
|
2018-04-17 15:53:06 +02:00
|
|
|
});
|
2016-05-11 13:02:42 +02:00
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-31 14:24:42 +02:00
|
|
|
QList<TestConfiguration *> QtTestTreeItem::getSelectedTestConfigurations() const
|
2016-05-11 13:02:42 +02:00
|
|
|
{
|
|
|
|
|
QList<TestConfiguration *> result;
|
|
|
|
|
ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject();
|
|
|
|
|
if (!project || type() != Root)
|
|
|
|
|
return result;
|
|
|
|
|
|
2018-01-17 09:51:45 +01:00
|
|
|
for (int row = 0, count = childCount(); row < count; ++row)
|
2018-04-17 15:53:06 +02:00
|
|
|
fillTestConfigurationsFromCheckState(childAt(row), result);
|
2016-05-11 13:02:42 +02:00
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-11 14:30:15 +02:00
|
|
|
QList<TestConfiguration *> QtTestTreeItem::getFailedTestConfigurations() const
|
|
|
|
|
{
|
|
|
|
|
QList<TestConfiguration *> result;
|
|
|
|
|
QTC_ASSERT(type() == TestTreeItem::Root, return result);
|
|
|
|
|
forFirstLevelChildren([&result](TestTreeItem *child) {
|
|
|
|
|
collectFailedTestInfo(child, result);
|
|
|
|
|
});
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-28 13:49:26 +02:00
|
|
|
QList<TestConfiguration *> QtTestTreeItem::getTestConfigurationsForFile(const Utils::FilePath &fileName) const
|
2018-05-05 22:28:55 +03:00
|
|
|
{
|
|
|
|
|
QList<TestConfiguration *> result;
|
|
|
|
|
|
|
|
|
|
ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject();
|
|
|
|
|
if (!project || type() != Root)
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
|
|
QHash<TestTreeItem *, QStringList> testFunctions;
|
|
|
|
|
const QString &file = fileName.toString();
|
|
|
|
|
forAllChildren([&testFunctions, &file](TestTreeItem *node) {
|
2019-05-21 07:50:34 +02:00
|
|
|
if (node->type() == Type::TestFunction && node->filePath() == file) {
|
2018-05-05 22:28:55 +03:00
|
|
|
QTC_ASSERT(node->parentItem(), return);
|
|
|
|
|
TestTreeItem *testCase = node->parentItem();
|
|
|
|
|
QTC_ASSERT(testCase->type() == Type::TestCase, return);
|
|
|
|
|
testFunctions[testCase] << node->name();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
for (auto it = testFunctions.cbegin(), end = testFunctions.cend(); it != end; ++it) {
|
|
|
|
|
TestConfiguration *tc = it.key()->testConfiguration();
|
|
|
|
|
QTC_ASSERT(tc, continue);
|
|
|
|
|
tc->setTestCases(it.value());
|
|
|
|
|
result << tc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-31 14:24:42 +02:00
|
|
|
TestTreeItem *QtTestTreeItem::find(const TestParseResult *result)
|
2016-05-11 13:02:42 +02:00
|
|
|
{
|
2017-02-13 10:05:06 +01:00
|
|
|
QTC_ASSERT(result, return nullptr);
|
2016-05-11 13:02:42 +02:00
|
|
|
|
|
|
|
|
switch (type()) {
|
|
|
|
|
case Root:
|
2020-03-13 13:54:33 +01:00
|
|
|
if (result->framework->grouping()) {
|
2017-12-06 08:45:36 +01:00
|
|
|
const QString path = QFileInfo(result->fileName).absolutePath();
|
|
|
|
|
for (int row = 0; row < childCount(); ++row) {
|
2018-04-17 15:53:06 +02:00
|
|
|
TestTreeItem *group = childAt(row);
|
2017-12-06 08:45:36 +01:00
|
|
|
if (group->filePath() != path)
|
|
|
|
|
continue;
|
|
|
|
|
if (auto groupChild = group->findChildByFile(result->fileName))
|
|
|
|
|
return groupChild;
|
|
|
|
|
}
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
return findChildByFile(result->fileName);
|
|
|
|
|
case GroupNode:
|
2016-05-11 13:02:42 +02:00
|
|
|
return findChildByFile(result->fileName);
|
2017-01-04 12:15:39 +01:00
|
|
|
case TestCase: {
|
|
|
|
|
const QtTestParseResult *qtResult = static_cast<const QtTestParseResult *>(result);
|
|
|
|
|
return findChildByNameAndInheritance(qtResult->displayName, qtResult->inherited());
|
|
|
|
|
}
|
2019-05-21 07:50:34 +02:00
|
|
|
case TestFunction:
|
2016-05-11 13:02:42 +02:00
|
|
|
case TestDataFunction:
|
|
|
|
|
case TestSpecialFunction:
|
|
|
|
|
return findChildByName(result->name);
|
|
|
|
|
default:
|
2017-02-13 10:05:06 +01:00
|
|
|
return nullptr;
|
2016-05-11 13:02:42 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-13 13:38:43 +01:00
|
|
|
TestTreeItem *QtTestTreeItem::findChild(const TestTreeItem *other)
|
|
|
|
|
{
|
|
|
|
|
QTC_ASSERT(other, return nullptr);
|
|
|
|
|
const Type otherType = other->type();
|
|
|
|
|
switch (type()) {
|
|
|
|
|
case Root:
|
|
|
|
|
return findChildByFileAndType(other->filePath(), otherType);
|
|
|
|
|
case GroupNode:
|
|
|
|
|
return otherType == TestCase ? findChildByFile(other->filePath()) : nullptr;
|
|
|
|
|
case TestCase: {
|
2019-05-21 07:50:34 +02:00
|
|
|
if (otherType != TestFunction && otherType != TestDataFunction && otherType != TestSpecialFunction)
|
2018-03-13 13:38:43 +01:00
|
|
|
return nullptr;
|
|
|
|
|
auto qtOther = static_cast<const QtTestTreeItem *>(other);
|
|
|
|
|
return findChildByNameAndInheritance(other->filePath(), qtOther->inherited());
|
|
|
|
|
}
|
2019-05-21 07:50:34 +02:00
|
|
|
case TestFunction:
|
2018-03-13 13:38:43 +01:00
|
|
|
case TestDataFunction:
|
|
|
|
|
case TestSpecialFunction:
|
|
|
|
|
return otherType == TestDataTag ? findChildByName(other->name()) : nullptr;
|
|
|
|
|
default:
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-31 14:24:42 +02:00
|
|
|
bool QtTestTreeItem::modify(const TestParseResult *result)
|
2016-05-11 13:02:42 +02:00
|
|
|
{
|
|
|
|
|
QTC_ASSERT(result, return false);
|
|
|
|
|
|
|
|
|
|
switch (type()) {
|
|
|
|
|
case TestCase:
|
2019-05-14 11:26:16 +02:00
|
|
|
return modifyTestCaseOrSuiteContent(result);
|
2019-05-21 07:50:34 +02:00
|
|
|
case TestFunction:
|
2016-05-11 13:02:42 +02:00
|
|
|
case TestDataFunction:
|
|
|
|
|
case TestSpecialFunction:
|
|
|
|
|
return modifyTestFunctionContent(result);
|
|
|
|
|
case TestDataTag:
|
2017-05-10 13:42:44 +02:00
|
|
|
return modifyDataTagContent(result);
|
2016-05-11 13:02:42 +02:00
|
|
|
default:
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-12-06 08:45:36 +01:00
|
|
|
TestTreeItem *QtTestTreeItem::createParentGroupNode() const
|
|
|
|
|
{
|
|
|
|
|
const QFileInfo fileInfo(filePath());
|
|
|
|
|
const QFileInfo base(fileInfo.absolutePath());
|
2020-03-26 10:11:39 +01:00
|
|
|
return new QtTestTreeItem(framework(), base.baseName(), fileInfo.absolutePath(), TestTreeItem::GroupNode);
|
2017-12-06 08:45:36 +01:00
|
|
|
}
|
|
|
|
|
|
2018-08-06 13:57:17 +02:00
|
|
|
bool QtTestTreeItem::isGroupable() const
|
|
|
|
|
{
|
|
|
|
|
return type() == TestCase;
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-04 12:15:39 +01:00
|
|
|
TestTreeItem *QtTestTreeItem::findChildByNameAndInheritance(const QString &name, bool inherited) const
|
|
|
|
|
{
|
2018-04-17 15:53:06 +02:00
|
|
|
return findFirstLevelChild([name, inherited](const TestTreeItem *other) {
|
2017-01-04 12:15:39 +01:00
|
|
|
const QtTestTreeItem *qtOther = static_cast<const QtTestTreeItem *>(other);
|
|
|
|
|
return qtOther->inherited() == inherited && qtOther->name() == name;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-04 12:06:46 +01:00
|
|
|
QString QtTestTreeItem::nameSuffix() const
|
|
|
|
|
{
|
2017-02-13 10:05:06 +01:00
|
|
|
static QString inheritedSuffix = QString(" [")
|
2017-01-04 12:06:46 +01:00
|
|
|
+ QCoreApplication::translate("QtTestTreeItem", "inherited")
|
2017-02-13 10:05:06 +01:00
|
|
|
+ QString("]");
|
2017-01-04 12:06:46 +01:00
|
|
|
return m_inherited ? inheritedSuffix : QString();
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-11 13:02:42 +02:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Autotest
|