aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/autotest/gtest/gtesttreeitem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/autotest/gtest/gtesttreeitem.cpp')
-rw-r--r--src/plugins/autotest/gtest/gtesttreeitem.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/plugins/autotest/gtest/gtesttreeitem.cpp b/src/plugins/autotest/gtest/gtesttreeitem.cpp
index fdae1fa309..8b5c9eafc7 100644
--- a/src/plugins/autotest/gtest/gtesttreeitem.cpp
+++ b/src/plugins/autotest/gtest/gtesttreeitem.cpp
@@ -32,9 +32,11 @@
#include <cpptools/cppmodelmanager.h>
#include <projectexplorer/session.h>
+
#include <utils/algorithm.h>
#include <utils/icon.h>
#include <utils/qtcassert.h>
+#include <utils/stringutils.h>
#include <utils/theme/theme.h>
#include <QRegularExpression>
@@ -65,7 +67,7 @@ static QString gtestFilter(GTestTreeItem::TestStates states)
TestTreeItem *GTestTreeItem::copyWithoutChildren()
{
- GTestTreeItem *copied = new GTestTreeItem;
+ GTestTreeItem *copied = new GTestTreeItem(framework());
copied->copyBasicDataFrom(this);
copied->m_state = m_state;
return copied;
@@ -91,10 +93,10 @@ static bool matchesFilter(const QString &filter, const QString &fullTestName)
QStringList negative;
int startOfNegative = filter.indexOf('-');
if (startOfNegative == -1) {
- positive.append(filter.split(':', QString::SkipEmptyParts));
+ positive.append(filter.split(':', Utils::SkipEmptyParts));
} else {
- positive.append(filter.left(startOfNegative).split(':', QString::SkipEmptyParts));
- negative.append(filter.mid(startOfNegative + 1).split(':', QString::SkipEmptyParts));
+ positive.append(filter.left(startOfNegative).split(':', Utils::SkipEmptyParts));
+ negative.append(filter.mid(startOfNegative + 1).split(':', Utils::SkipEmptyParts));
}
QString testName = fullTestName;
@@ -170,7 +172,7 @@ TestConfiguration *GTestTreeItem::testConfiguration() const
case TestSuite: {
const QString &testSpecifier = gtestFilter(state()).arg(name()).arg('*');
if (int count = childCount()) {
- config = new GTestConfiguration;
+ config = new GTestConfiguration(framework());
config->setTestCases(QStringList(testSpecifier));
config->setTestCaseCount(count);
config->setProjectFile(proFile());
@@ -183,7 +185,7 @@ TestConfiguration *GTestTreeItem::testConfiguration() const
if (!parent)
return nullptr;
const QString &testSpecifier = gtestFilter(parent->state()).arg(parent->name()).arg(name());
- config = new GTestConfiguration;
+ config = new GTestConfiguration(framework());
config->setTestCases(QStringList(testSpecifier));
config->setProjectFile(proFile());
config->setProject(project);
@@ -261,7 +263,7 @@ QList<TestConfiguration *> GTestTreeItem::getTestConfigurations(bool ignoreCheck
for (auto it = testCasesForProFile.begin(), end = testCasesForProFile.end(); it != end; ++it) {
for (const QString &target : qAsConst(it.value().internalTargets)) {
- GTestConfiguration *tc = new GTestConfiguration;
+ GTestConfiguration *tc = new GTestConfiguration(framework());
if (!ignoreCheckState)
tc->setTestCases(it.value().filters);
tc->setTestCaseCount(tc->testCaseCount() + it.value().testSetCount);
@@ -307,7 +309,7 @@ QList<TestConfiguration *> GTestTreeItem::getTestConfigurationsForFile(const Uti
});
for (auto it = testCases.begin(), end = testCases.end(); it != end; ++it) {
for (const QString &target : qAsConst(it.value().internalTargets)) {
- GTestConfiguration *tc = new GTestConfiguration;
+ GTestConfiguration *tc = new GTestConfiguration(framework());
tc->setTestCases(it.value().filters);
tc->setProjectFile(it.key());
tc->setProject(project);
@@ -331,7 +333,7 @@ TestTreeItem *GTestTreeItem::find(const TestParseResult *result)
states |= GTestTreeItem::Typed;
switch (type()) {
case Root:
- if (TestFrameworkManager::instance()->groupingEnabled(result->frameworkId)) {
+ if (result->framework->grouping()) {
if (GTestFramework::groupMode() == GTest::Constants::Directory) {
const QFileInfo fileInfo(parseResult->fileName);
const QFileInfo base(fileInfo.absolutePath());
@@ -420,7 +422,7 @@ TestTreeItem *GTestTreeItem::createParentGroupNode() const
if (GTestFramework::groupMode() == GTest::Constants::Directory) {
const QFileInfo fileInfo(filePath());
const QFileInfo base(fileInfo.absolutePath());
- return new GTestTreeItem(base.baseName(), fileInfo.absolutePath(), TestTreeItem::GroupNode);
+ return new GTestTreeItem(framework(), base.baseName(), fileInfo.absolutePath(), TestTreeItem::GroupNode);
} else { // GTestFilter
QTC_ASSERT(childCount(), return nullptr); // paranoia
const TestTreeItem *firstChild = childAt(0);
@@ -428,7 +430,7 @@ TestTreeItem *GTestTreeItem::createParentGroupNode() const
const QString fullTestName = name() + '.' + firstChild->name();
const QString groupNodeName =
matchesFilter(activeFilter, fullTestName) ? matchingString() : notMatchingString();
- auto groupNode = new GTestTreeItem(groupNodeName, activeFilter, TestTreeItem::GroupNode);
+ auto groupNode = new GTestTreeItem(framework(), groupNodeName, activeFilter, TestTreeItem::GroupNode);
if (groupNodeName == notMatchingString())
groupNode->setData(0, Qt::Unchecked, Qt::CheckStateRole);
return groupNode;