forked from qt-creator/qt-creator
AutoTest: Use TypedTreeItem for test tree items
Change-Id: I739b6aefc868550b01c7421b4b304293564bb7b6 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -202,7 +202,7 @@ static void collectTestInfo(const GTestTreeItem *item,
|
|||||||
QTC_ASSERT(item, return);
|
QTC_ASSERT(item, return);
|
||||||
if (item->type() == TestTreeItem::GroupNode) {
|
if (item->type() == TestTreeItem::GroupNode) {
|
||||||
for (int row = 0, count = item->childCount(); row < count; ++row) {
|
for (int row = 0, count = item->childCount(); row < count; ++row) {
|
||||||
auto child = static_cast<const GTestTreeItem *>(item->childItem(row));
|
auto child = static_cast<const GTestTreeItem *>(item->childAt(row));
|
||||||
collectTestInfo(child, testCasesForProFile, ignoreCheckState);
|
collectTestInfo(child, testCasesForProFile, ignoreCheckState);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@@ -211,22 +211,21 @@ static void collectTestInfo(const GTestTreeItem *item,
|
|||||||
QTC_ASSERT(childCount != 0, return);
|
QTC_ASSERT(childCount != 0, return);
|
||||||
QTC_ASSERT(item->type() == TestTreeItem::TestCase, return);
|
QTC_ASSERT(item->type() == TestTreeItem::TestCase, return);
|
||||||
if (ignoreCheckState || item->checked() == Qt::Checked) {
|
if (ignoreCheckState || item->checked() == Qt::Checked) {
|
||||||
const QString &projectFile = item->childItem(0)->proFile();
|
const QString &projectFile = item->childAt(0)->proFile();
|
||||||
testCasesForProFile[projectFile].filters.append(
|
testCasesForProFile[projectFile].filters.append(
|
||||||
gtestFilter(item->state()).arg(item->name()).arg('*'));
|
gtestFilter(item->state()).arg(item->name()).arg('*'));
|
||||||
testCasesForProFile[projectFile].testSetCount += childCount - 1;
|
testCasesForProFile[projectFile].testSetCount += childCount - 1;
|
||||||
testCasesForProFile[projectFile].internalTargets.unite(item->internalTargets());
|
testCasesForProFile[projectFile].internalTargets.unite(item->internalTargets());
|
||||||
} else if (item->checked() == Qt::PartiallyChecked) {
|
} else if (item->checked() == Qt::PartiallyChecked) {
|
||||||
for (int childRow = 0; childRow < childCount; ++childRow) {
|
item->forFirstLevelChildren([&testCasesForProFile, item](TestTreeItem *child){
|
||||||
const TestTreeItem *child = item->childItem(childRow);
|
QTC_ASSERT(child->type() == TestTreeItem::TestFunctionOrSet, return);
|
||||||
QTC_ASSERT(child->type() == TestTreeItem::TestFunctionOrSet, continue);
|
|
||||||
if (child->checked() == Qt::Checked) {
|
if (child->checked() == Qt::Checked) {
|
||||||
testCasesForProFile[child->proFile()].filters.append(
|
testCasesForProFile[child->proFile()].filters.append(
|
||||||
gtestFilter(item->state()).arg(item->name()).arg(child->name()));
|
gtestFilter(item->state()).arg(item->name()).arg(child->name()));
|
||||||
testCasesForProFile[child->proFile()].internalTargets.unite(
|
testCasesForProFile[child->proFile()].internalTargets.unite(
|
||||||
child->internalTargets());
|
child->internalTargets());
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,7 +238,7 @@ QList<TestConfiguration *> GTestTreeItem::getTestConfigurations(bool ignoreCheck
|
|||||||
|
|
||||||
QHash<QString, TestCases> testCasesForProFile;
|
QHash<QString, TestCases> testCasesForProFile;
|
||||||
for (int row = 0, count = childCount(); row < count; ++row) {
|
for (int row = 0, count = childCount(); row < count; ++row) {
|
||||||
auto child = static_cast<const GTestTreeItem *>(childItem(row));
|
auto child = static_cast<const GTestTreeItem *>(childAt(row));
|
||||||
collectTestInfo(child, testCasesForProFile, ignoreCheckState);
|
collectTestInfo(child, testCasesForProFile, ignoreCheckState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -376,7 +375,7 @@ TestTreeItem *GTestTreeItem::createParentGroupNode() const
|
|||||||
return new GTestTreeItem(base.baseName(), fileInfo.absolutePath(), TestTreeItem::GroupNode);
|
return new GTestTreeItem(base.baseName(), fileInfo.absolutePath(), TestTreeItem::GroupNode);
|
||||||
} else { // GTestFilter
|
} else { // GTestFilter
|
||||||
QTC_ASSERT(childCount(), return nullptr); // paranoia
|
QTC_ASSERT(childCount(), return nullptr); // paranoia
|
||||||
const TestTreeItem *firstChild = childItem(0);
|
const TestTreeItem *firstChild = childAt(0);
|
||||||
const QString activeFilter = GTestFramework::currentGTestFilter();
|
const QString activeFilter = GTestFramework::currentGTestFilter();
|
||||||
const QString fullTestName = name() + '.' + firstChild->name();
|
const QString fullTestName = name() + '.' + firstChild->name();
|
||||||
const QString groupNodeName =
|
const QString groupNodeName =
|
||||||
@@ -404,11 +403,9 @@ TestTreeItem *GTestTreeItem::findChildByNameStateAndFile(const QString &name,
|
|||||||
GTestTreeItem::TestStates state,
|
GTestTreeItem::TestStates state,
|
||||||
const QString &proFile) const
|
const QString &proFile) const
|
||||||
{
|
{
|
||||||
return findChildBy([name, state, proFile](const TestTreeItem *other) -> bool {
|
return findFirstLevelChild([name, state, proFile](const TestTreeItem *other) {
|
||||||
const GTestTreeItem *gtestItem = static_cast<const GTestTreeItem *>(other);
|
const GTestTreeItem *gtestItem = static_cast<const GTestTreeItem *>(other);
|
||||||
return other->proFile() == proFile
|
return other->proFile() == proFile && other->name() == name && gtestItem->state() == state;
|
||||||
&& other->name() == name
|
|
||||||
&& gtestItem->state() == state;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -461,7 +458,7 @@ bool GTestTreeItem::isGroupNodeFor(const TestTreeItem *other) const
|
|||||||
if (other->type() == TestCase) {
|
if (other->type() == TestCase) {
|
||||||
fullName = other->name();
|
fullName = other->name();
|
||||||
if (other->childCount())
|
if (other->childCount())
|
||||||
fullName += '.' + other->childItem(0)->name();
|
fullName += '.' + other->childAt(0)->name();
|
||||||
} else if (other->type() == TestFunctionOrSet) {
|
} else if (other->type() == TestFunctionOrSet) {
|
||||||
QTC_ASSERT(other->parentItem(), return false);
|
QTC_ASSERT(other->parentItem(), return false);
|
||||||
fullName = other->parentItem()->name() + '.' + other->name();
|
fullName = other->parentItem()->name() + '.' + other->name();
|
||||||
@@ -489,7 +486,7 @@ TestTreeItem *GTestTreeItem::applyFilters()
|
|||||||
const QString gtestFilter = GTestFramework::currentGTestFilter();
|
const QString gtestFilter = GTestFramework::currentGTestFilter();
|
||||||
TestTreeItem *filtered = nullptr;
|
TestTreeItem *filtered = nullptr;
|
||||||
for (int row = childCount() - 1; row >= 0; --row) {
|
for (int row = childCount() - 1; row >= 0; --row) {
|
||||||
GTestTreeItem *child = static_cast<GTestTreeItem *>(childItem(row));
|
GTestTreeItem *child = static_cast<GTestTreeItem *>(childAt(row));
|
||||||
if (!matchesFilter(gtestFilter, name() + '.' + child->name())) {
|
if (!matchesFilter(gtestFilter, name() + '.' + child->name())) {
|
||||||
if (!filtered) {
|
if (!filtered) {
|
||||||
filtered = copyWithoutChildren();
|
filtered = copyWithoutChildren();
|
||||||
|
|||||||
@@ -50,17 +50,14 @@ QHash<QString, QString> testCaseNamesForFiles(const Core::Id &id, const QStringL
|
|||||||
TestTreeItem *rootNode = TestFrameworkManager::instance()->rootNodeForTestFramework(id);
|
TestTreeItem *rootNode = TestFrameworkManager::instance()->rootNodeForTestFramework(id);
|
||||||
QTC_ASSERT(rootNode, return result);
|
QTC_ASSERT(rootNode, return result);
|
||||||
|
|
||||||
for (int row = 0, rootCount = rootNode->childCount(); row < rootCount; ++row) {
|
rootNode->forFirstLevelChildren([&result, &files](TestTreeItem *child) {
|
||||||
const TestTreeItem *child = rootNode->childItem(row);
|
if (files.contains(child->filePath()))
|
||||||
if (files.contains(child->filePath())) {
|
|
||||||
result.insert(child->filePath(), child->name());
|
result.insert(child->filePath(), child->name());
|
||||||
}
|
child->forFirstLevelChildren([&result, &files, child](TestTreeItem *grandChild) {
|
||||||
for (int childRow = 0, count = child->childCount(); childRow < count; ++childRow) {
|
|
||||||
const TestTreeItem *grandChild = child->childItem(childRow);
|
|
||||||
if (files.contains(grandChild->filePath()))
|
if (files.contains(grandChild->filePath()))
|
||||||
result.insert(grandChild->filePath(), child->name());
|
result.insert(grandChild->filePath(), child->name());
|
||||||
}
|
});
|
||||||
}
|
});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,18 +67,17 @@ QMultiHash<QString, QString> alternativeFiles(const Core::Id &id, const QStringL
|
|||||||
TestTreeItem *rootNode = TestFrameworkManager::instance()->rootNodeForTestFramework(id);
|
TestTreeItem *rootNode = TestFrameworkManager::instance()->rootNodeForTestFramework(id);
|
||||||
QTC_ASSERT(rootNode, return result);
|
QTC_ASSERT(rootNode, return result);
|
||||||
|
|
||||||
for (int row = 0, rootCount = rootNode->childCount(); row < rootCount; ++row) {
|
rootNode->forFirstLevelChildren([&result, &files](TestTreeItem *child) {
|
||||||
const TestTreeItem *child = rootNode->childItem(row);
|
|
||||||
const QString &baseFilePath = child->filePath();
|
const QString &baseFilePath = child->filePath();
|
||||||
for (int childRow = 0, count = child->childCount(); childRow < count; ++childRow) {
|
for (int childRow = 0, count = child->childCount(); childRow < count; ++childRow) {
|
||||||
auto grandChild = static_cast<const QtTestTreeItem *>(child->childItem(childRow));
|
auto grandChild = static_cast<const QtTestTreeItem *>(child->childAt(childRow));
|
||||||
const QString &filePath = grandChild->filePath();
|
const QString &filePath = grandChild->filePath();
|
||||||
if (grandChild->inherited() && baseFilePath != filePath && files.contains(filePath)) {
|
if (grandChild->inherited() && baseFilePath != filePath && files.contains(filePath)) {
|
||||||
if (!result.contains(filePath, baseFilePath))
|
if (!result.contains(filePath, baseFilePath))
|
||||||
result.insert(filePath, baseFilePath);
|
result.insert(filePath, baseFilePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ static void fillTestConfigurationsFromCheckState(const TestTreeItem *item,
|
|||||||
QTC_ASSERT(item, return);
|
QTC_ASSERT(item, return);
|
||||||
if (item->type() == TestTreeItem::GroupNode) {
|
if (item->type() == TestTreeItem::GroupNode) {
|
||||||
for (int row = 0, count = item->childCount(); row < count; ++row)
|
for (int row = 0, count = item->childCount(); row < count; ++row)
|
||||||
fillTestConfigurationsFromCheckState(item->childItem(row), testConfigurations);
|
fillTestConfigurationsFromCheckState(item->childAt(row), testConfigurations);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QTC_ASSERT(item->type() == TestTreeItem::TestCase, return);
|
QTC_ASSERT(item->type() == TestTreeItem::TestCase, return);
|
||||||
@@ -168,22 +168,18 @@ static void fillTestConfigurationsFromCheckState(const TestTreeItem *item,
|
|||||||
return;
|
return;
|
||||||
case Qt::PartiallyChecked:
|
case Qt::PartiallyChecked:
|
||||||
default:
|
default:
|
||||||
int grandChildCount = item->childCount();
|
|
||||||
QStringList testCases;
|
QStringList testCases;
|
||||||
for (int grandChildRow = 0; grandChildRow < grandChildCount; ++grandChildRow) {
|
item->forFirstLevelChildren([&testCases](TestTreeItem *grandChild) {
|
||||||
const TestTreeItem *grandChild = item->childItem(grandChildRow);
|
|
||||||
if (grandChild->checked() == Qt::Checked) {
|
if (grandChild->checked() == Qt::Checked) {
|
||||||
testCases << grandChild->name();
|
testCases << grandChild->name();
|
||||||
} else if (grandChild->checked() == Qt::PartiallyChecked) {
|
} else if (grandChild->checked() == Qt::PartiallyChecked) {
|
||||||
const int dtCount = grandChild->childCount();
|
|
||||||
const QString funcName = grandChild->name();
|
const QString funcName = grandChild->name();
|
||||||
for (int dtRow = 0; dtRow < dtCount; ++dtRow) {
|
grandChild->forFirstLevelChildren([&testCases, &funcName](TestTreeItem *dataTag) {
|
||||||
const TestTreeItem *dataTag = grandChild->childItem(dtRow);
|
|
||||||
if (dataTag->checked() == Qt::Checked)
|
if (dataTag->checked() == Qt::Checked)
|
||||||
testCases << funcName + ':' + dataTag->name();
|
testCases << funcName + ':' + dataTag->name();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
|
||||||
|
|
||||||
testConfig = new QtTestConfiguration();
|
testConfig = new QtTestConfiguration();
|
||||||
testConfig->setTestCases(testCases);
|
testConfig->setTestCases(testCases);
|
||||||
@@ -210,22 +206,19 @@ QList<TestConfiguration *> QtTestTreeItem::getAllTestConfigurations() const
|
|||||||
if (!project || type() != Root)
|
if (!project || type() != Root)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
for (int row = 0, count = childCount(); row < count; ++row) {
|
forFirstLevelChildren([&result](TestTreeItem *child) {
|
||||||
const TestTreeItem *child = childItem(row);
|
|
||||||
TestConfiguration *tc = nullptr;
|
|
||||||
if (child->type() == TestCase) {
|
if (child->type() == TestCase) {
|
||||||
tc = child->testConfiguration();
|
TestConfiguration *tc = child->testConfiguration();
|
||||||
QTC_ASSERT(tc, continue);
|
QTC_ASSERT(tc, return);
|
||||||
result << tc;
|
result << tc;
|
||||||
} else if (child->type() == GroupNode) {
|
} else if (child->type() == GroupNode) {
|
||||||
const int groupChildCount = child->childCount();
|
child->forFirstLevelChildren([&result](TestTreeItem *groupChild) {
|
||||||
for (int groupChildRow = 0; groupChildRow < groupChildCount; ++groupChildRow) {
|
TestConfiguration *tc = groupChild->testConfiguration();
|
||||||
tc = child->childItem(groupChildRow)->testConfiguration();
|
QTC_ASSERT(tc, return);
|
||||||
QTC_ASSERT(tc, continue);
|
|
||||||
result << tc;
|
result << tc;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,7 +230,7 @@ QList<TestConfiguration *> QtTestTreeItem::getSelectedTestConfigurations() const
|
|||||||
return result;
|
return result;
|
||||||
|
|
||||||
for (int row = 0, count = childCount(); row < count; ++row)
|
for (int row = 0, count = childCount(); row < count; ++row)
|
||||||
fillTestConfigurationsFromCheckState(childItem(row), result);
|
fillTestConfigurationsFromCheckState(childAt(row), result);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -251,7 +244,7 @@ TestTreeItem *QtTestTreeItem::find(const TestParseResult *result)
|
|||||||
if (TestFrameworkManager::instance()->groupingEnabled(result->frameworkId)) {
|
if (TestFrameworkManager::instance()->groupingEnabled(result->frameworkId)) {
|
||||||
const QString path = QFileInfo(result->fileName).absolutePath();
|
const QString path = QFileInfo(result->fileName).absolutePath();
|
||||||
for (int row = 0; row < childCount(); ++row) {
|
for (int row = 0; row < childCount(); ++row) {
|
||||||
TestTreeItem *group = childItem(row);
|
TestTreeItem *group = childAt(row);
|
||||||
if (group->filePath() != path)
|
if (group->filePath() != path)
|
||||||
continue;
|
continue;
|
||||||
if (auto groupChild = group->findChildByFile(result->fileName))
|
if (auto groupChild = group->findChildByFile(result->fileName))
|
||||||
@@ -326,7 +319,7 @@ TestTreeItem *QtTestTreeItem::createParentGroupNode() const
|
|||||||
|
|
||||||
TestTreeItem *QtTestTreeItem::findChildByNameAndInheritance(const QString &name, bool inherited) const
|
TestTreeItem *QtTestTreeItem::findChildByNameAndInheritance(const QString &name, bool inherited) const
|
||||||
{
|
{
|
||||||
return findChildBy([name, inherited](const TestTreeItem *other) -> bool {
|
return findFirstLevelChild([name, inherited](const TestTreeItem *other) {
|
||||||
const QtTestTreeItem *qtOther = static_cast<const QtTestTreeItem *>(other);
|
const QtTestTreeItem *qtOther = static_cast<const QtTestTreeItem *>(other);
|
||||||
return qtOther->inherited() == inherited && qtOther->name() == name;
|
return qtOther->inherited() == inherited && qtOther->name() == name;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -51,24 +51,22 @@ QHash<QString, QString> proFilesForQmlFiles(const Core::Id &id, const QStringLis
|
|||||||
if (files.isEmpty())
|
if (files.isEmpty())
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
for (int row = 0, rootCount = rootNode->childCount(); row < rootCount; ++row) {
|
rootNode->forFirstLevelChildren([&result, &files](TestTreeItem *child) {
|
||||||
const TestTreeItem *child = rootNode->childItem(row);
|
|
||||||
const QString &file = child->filePath();
|
const QString &file = child->filePath();
|
||||||
if (!file.isEmpty() && files.contains(file)) {
|
if (!file.isEmpty() && files.contains(file)) {
|
||||||
const QString &proFile = child->proFile();
|
const QString &proFile = child->proFile();
|
||||||
if (!proFile.isEmpty())
|
if (!proFile.isEmpty())
|
||||||
result.insert(file, proFile);
|
result.insert(file, proFile);
|
||||||
}
|
}
|
||||||
for (int subRow = 0, subCount = child->childCount(); subRow < subCount; ++subRow) {
|
child->forFirstLevelChildren([&result, &files](TestTreeItem *grandChild) {
|
||||||
const TestTreeItem *grandChild = child->childItem(subRow);
|
|
||||||
const QString &file = grandChild->filePath();
|
const QString &file = grandChild->filePath();
|
||||||
if (!file.isEmpty() && files.contains(file)) {
|
if (!file.isEmpty() && files.contains(file)) {
|
||||||
const QString &proFile = grandChild->proFile();
|
const QString &proFile = grandChild->proFile();
|
||||||
if (!proFile.isEmpty())
|
if (!proFile.isEmpty())
|
||||||
result.insert(file, proFile);
|
result.insert(file, proFile);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -130,13 +130,12 @@ TestConfiguration *QuickTestTreeItem::testConfiguration() const
|
|||||||
QuickTestConfiguration *config = nullptr;
|
QuickTestConfiguration *config = nullptr;
|
||||||
switch (type()) {
|
switch (type()) {
|
||||||
case TestCase: {
|
case TestCase: {
|
||||||
|
const QString testName = name();
|
||||||
QStringList testFunctions;
|
QStringList testFunctions;
|
||||||
for (int row = 0, count = childCount(); row < count; ++row) {
|
forFirstLevelChildren([&testFunctions, &testName](TestTreeItem *child) {
|
||||||
const TestTreeItem *child = childItem(row);
|
if (child->type() == TestTreeItem::TestFunctionOrSet)
|
||||||
if (child->type() == TestTreeItem::TestSpecialFunction)
|
testFunctions << testName + "::" + child->name();
|
||||||
continue;
|
});
|
||||||
testFunctions << name() + "::" + child->name();
|
|
||||||
}
|
|
||||||
config = new QuickTestConfiguration;
|
config = new QuickTestConfiguration;
|
||||||
config->setTestCases(testFunctions);
|
config->setTestCases(testFunctions);
|
||||||
config->setProjectFile(proFile());
|
config->setProjectFile(proFile());
|
||||||
@@ -166,7 +165,7 @@ static void testConfigurationFromCheckState(const TestTreeItem *item,
|
|||||||
QTC_ASSERT(item, return);
|
QTC_ASSERT(item, return);
|
||||||
if (item->type() == TestTreeItem::GroupNode) {
|
if (item->type() == TestTreeItem::GroupNode) {
|
||||||
for (int row = 0, count = item->childCount(); row < count; ++row)
|
for (int row = 0, count = item->childCount(); row < count; ++row)
|
||||||
testConfigurationFromCheckState(item->childItem(row), foundProFiles);
|
testConfigurationFromCheckState(item->childAt(row), foundProFiles);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QTC_ASSERT(item->type() == TestTreeItem::TestCase, return);
|
QTC_ASSERT(item->type() == TestTreeItem::TestCase, return);
|
||||||
@@ -174,14 +173,12 @@ static void testConfigurationFromCheckState(const TestTreeItem *item,
|
|||||||
if (item->checked() == Qt::Unchecked)
|
if (item->checked() == Qt::Unchecked)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
const QString testName = item->name();
|
||||||
QStringList testFunctions;
|
QStringList testFunctions;
|
||||||
const int childCount = item->childCount();
|
item->forFirstLevelChildren([&testFunctions, &testName](TestTreeItem *child) {
|
||||||
for (int childRow = 0; childRow < childCount; ++childRow) {
|
if (child->checked() == Qt::Checked && child->type() == TestTreeItem::TestFunctionOrSet)
|
||||||
const TestTreeItem *child = item->childItem(childRow);
|
testFunctions << testName + "::" + child->name();
|
||||||
if (child->checked() != Qt::Checked || child->type() != TestTreeItem::TestFunctionOrSet)
|
});
|
||||||
continue;
|
|
||||||
testFunctions << item->name() + "::" + child->name();
|
|
||||||
}
|
|
||||||
if (foundProFiles.contains(item->proFile())) {
|
if (foundProFiles.contains(item->proFile())) {
|
||||||
tc = foundProFiles[item->proFile()];
|
tc = foundProFiles[item->proFile()];
|
||||||
QStringList oldFunctions(tc->testCases());
|
QStringList oldFunctions(tc->testCases());
|
||||||
@@ -225,29 +222,25 @@ QList<TestConfiguration *> QuickTestTreeItem::getAllTestConfigurations() const
|
|||||||
return result;
|
return result;
|
||||||
|
|
||||||
QHash<QString, Tests> testsForProfile;
|
QHash<QString, Tests> testsForProfile;
|
||||||
for (int row = 0, count = childCount(); row < count; ++row) {
|
forFirstLevelChildren([&testsForProfile](TestTreeItem *child) {
|
||||||
const TestTreeItem *child = childItem(row);
|
|
||||||
// unnamed Quick Tests must be handled separately
|
// unnamed Quick Tests must be handled separately
|
||||||
if (child->name().isEmpty()) {
|
if (child->name().isEmpty()) {
|
||||||
for (int childRow = 0, ccount = child->childCount(); childRow < ccount; ++ childRow) {
|
child->forFirstLevelChildren([&testsForProfile](TestTreeItem *grandChild) {
|
||||||
const TestTreeItem *grandChild = child->childItem(childRow);
|
|
||||||
const QString &proFile = grandChild->proFile();
|
const QString &proFile = grandChild->proFile();
|
||||||
++(testsForProfile[proFile].testCount);
|
++(testsForProfile[proFile].testCount);
|
||||||
testsForProfile[proFile].internalTargets = grandChild->internalTargets();
|
testsForProfile[proFile].internalTargets = grandChild->internalTargets();
|
||||||
}
|
});
|
||||||
continue;
|
return;
|
||||||
}
|
}
|
||||||
// named Quick Test
|
// named Quick Test
|
||||||
if (child->type() == TestCase) {
|
if (child->type() == TestCase) {
|
||||||
addTestsForItem(testsForProfile[child->proFile()], child);
|
addTestsForItem(testsForProfile[child->proFile()], child);
|
||||||
} else if (child->type() == GroupNode) {
|
} else if (child->type() == GroupNode) {
|
||||||
const int groupCount = child->childCount();
|
child->forFirstLevelChildren([&testsForProfile](TestTreeItem *grandChild) {
|
||||||
for (int groupRow = 0; groupRow < groupCount; ++groupRow) {
|
|
||||||
const TestTreeItem *grandChild = child->childItem(groupRow);
|
|
||||||
addTestsForItem(testsForProfile[grandChild->proFile()], grandChild);
|
addTestsForItem(testsForProfile[grandChild->proFile()], grandChild);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
|
||||||
// create TestConfiguration for each project file
|
// create TestConfiguration for each project file
|
||||||
for (auto it = testsForProfile.begin(), end = testsForProfile.end(); it != end; ++it) {
|
for (auto it = testsForProfile.begin(), end = testsForProfile.end(); it != end; ++it) {
|
||||||
QuickTestConfiguration *tc = new QuickTestConfiguration;
|
QuickTestConfiguration *tc = new QuickTestConfiguration;
|
||||||
@@ -269,15 +262,11 @@ QList<TestConfiguration *> QuickTestTreeItem::getSelectedTestConfigurations() co
|
|||||||
|
|
||||||
QHash<QString, QuickTestConfiguration *> foundProFiles;
|
QHash<QString, QuickTestConfiguration *> foundProFiles;
|
||||||
|
|
||||||
for (int row = 0, count = childCount(); row < count; ++row) {
|
forFirstLevelChildren([&foundProFiles](TestTreeItem *child) {
|
||||||
const TestTreeItem *child = childItem(row);
|
// unnamed Quick Tests cannot get selected explicitly - only handle named Quick Tests
|
||||||
// unnamed Quick Tests cannot get selected explicitly
|
if (!child->name().isEmpty())
|
||||||
if (child->name().isEmpty())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// named Quick Tests
|
|
||||||
testConfigurationFromCheckState(child, foundProFiles);
|
testConfigurationFromCheckState(child, foundProFiles);
|
||||||
}
|
});
|
||||||
|
|
||||||
for (auto it = foundProFiles.begin(), end = foundProFiles.end(); it != end; ++it) {
|
for (auto it = foundProFiles.begin(), end = foundProFiles.end(); it != end; ++it) {
|
||||||
QuickTestConfiguration *config = it.value();
|
QuickTestConfiguration *config = it.value();
|
||||||
@@ -300,14 +289,10 @@ TestTreeItem *QuickTestTreeItem::find(const TestParseResult *result)
|
|||||||
return unnamedQuickTests();
|
return unnamedQuickTests();
|
||||||
if (TestFrameworkManager::instance()->groupingEnabled(result->frameworkId)) {
|
if (TestFrameworkManager::instance()->groupingEnabled(result->frameworkId)) {
|
||||||
const QString path = QFileInfo(result->fileName).absolutePath();
|
const QString path = QFileInfo(result->fileName).absolutePath();
|
||||||
for (int row = 0; row < childCount(); ++row) {
|
TestTreeItem *group = findFirstLevelChild([path](TestTreeItem *group) {
|
||||||
TestTreeItem *group = childItem(row);
|
return group->filePath() == path;
|
||||||
if (group->filePath() != path)
|
});
|
||||||
continue;
|
return group ? group->findChildByFile(result->fileName) : nullptr;
|
||||||
if (auto groupChild = group->findChildByFile(result->fileName))
|
|
||||||
return groupChild;
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
return findChildByFile(result->fileName);
|
return findChildByFile(result->fileName);
|
||||||
case GroupNode:
|
case GroupNode:
|
||||||
@@ -416,12 +401,7 @@ TestTreeItem *QuickTestTreeItem::unnamedQuickTests() const
|
|||||||
if (type() != Root)
|
if (type() != Root)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
for (int row = 0, count = childCount(); row < count; ++row) {
|
return findFirstLevelChild([](TestTreeItem *child) { return child->name().isEmpty(); });
|
||||||
TestTreeItem *child = childItem(row);
|
|
||||||
if (child->name().isEmpty())
|
|
||||||
return child;
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -191,17 +191,16 @@ void TestTreeItem::markForRemovalRecursively(bool mark)
|
|||||||
{
|
{
|
||||||
markForRemoval(mark);
|
markForRemoval(mark);
|
||||||
for (int row = 0, count = childCount(); row < count; ++row)
|
for (int row = 0, count = childCount(); row < count; ++row)
|
||||||
childItem(row)->markForRemovalRecursively(mark);
|
childAt(row)->markForRemovalRecursively(mark);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestTreeItem::markForRemovalRecursively(const QString &filePath)
|
void TestTreeItem::markForRemovalRecursively(const QString &filePath)
|
||||||
{
|
{
|
||||||
bool mark = m_filePath == filePath;
|
bool mark = m_filePath == filePath;
|
||||||
for (int row = 0, count = childCount(); row < count; ++row) {
|
forFirstLevelChildren([&mark, &filePath](TestTreeItem *child) {
|
||||||
TestTreeItem *child = childItem(row);
|
|
||||||
child->markForRemovalRecursively(filePath);
|
child->markForRemovalRecursively(filePath);
|
||||||
mark &= child->markedForRemoval();
|
mark &= child->markedForRemoval();
|
||||||
}
|
});
|
||||||
markForRemoval(mark);
|
markForRemoval(mark);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,35 +209,28 @@ TestTreeItem *TestTreeItem::parentItem() const
|
|||||||
return static_cast<TestTreeItem *>(parent());
|
return static_cast<TestTreeItem *>(parent());
|
||||||
}
|
}
|
||||||
|
|
||||||
TestTreeItem *TestTreeItem::childItem(int row) const
|
|
||||||
{
|
|
||||||
return static_cast<TestTreeItem *>(childAt(row));
|
|
||||||
}
|
|
||||||
|
|
||||||
TestTreeItem *TestTreeItem::findChildByName(const QString &name)
|
TestTreeItem *TestTreeItem::findChildByName(const QString &name)
|
||||||
{
|
{
|
||||||
return findChildBy([name](const TestTreeItem *other) -> bool {
|
return findFirstLevelChild([name](const TestTreeItem *other) { return other->name() == name; });
|
||||||
return other->name() == name;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TestTreeItem *TestTreeItem::findChildByFile(const QString &filePath)
|
TestTreeItem *TestTreeItem::findChildByFile(const QString &filePath)
|
||||||
{
|
{
|
||||||
return findChildBy([filePath](const TestTreeItem *other) -> bool {
|
return findFirstLevelChild([filePath](const TestTreeItem *other) {
|
||||||
return other->filePath() == filePath;
|
return other->filePath() == filePath;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
TestTreeItem *TestTreeItem::findChildByFileAndType(const QString &filePath, Type tType)
|
TestTreeItem *TestTreeItem::findChildByFileAndType(const QString &filePath, Type tType)
|
||||||
{
|
{
|
||||||
return findChildBy([filePath, tType](const TestTreeItem *other) {
|
return findFirstLevelChild([filePath, tType](const TestTreeItem *other) {
|
||||||
return other->type() == tType && other->filePath() == filePath;
|
return other->type() == tType && other->filePath() == filePath;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
TestTreeItem *TestTreeItem::findChildByNameAndFile(const QString &name, const QString &filePath)
|
TestTreeItem *TestTreeItem::findChildByNameAndFile(const QString &name, const QString &filePath)
|
||||||
{
|
{
|
||||||
return findChildBy([name, filePath](const TestTreeItem *other) -> bool {
|
return findFirstLevelChild([name, filePath](const TestTreeItem *other) {
|
||||||
return other->filePath() == filePath && other->name() == name;
|
return other->filePath() == filePath && other->name() == name;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -353,16 +345,6 @@ inline bool TestTreeItem::modifyName(const QString &name)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
TestTreeItem *TestTreeItem::findChildBy(CompareFunction compare) const
|
|
||||||
{
|
|
||||||
for (int row = 0, count = childCount(); row < count; ++row) {
|
|
||||||
TestTreeItem *child = childItem(row);
|
|
||||||
if (compare(child))
|
|
||||||
return child;
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* try to find build system target that depends on the given file - if the file is no header
|
* try to find build system target that depends on the given file - if the file is no header
|
||||||
* try to find the corresponding header and use this instead to find the respective target
|
* try to find the corresponding header and use this instead to find the respective target
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ namespace Internal {
|
|||||||
class TestParseResult;
|
class TestParseResult;
|
||||||
class TestConfiguration;
|
class TestConfiguration;
|
||||||
enum class TestRunMode;
|
enum class TestRunMode;
|
||||||
class TestTreeItem : public Utils::TreeItem
|
class TestTreeItem : public Utils::TypedTreeItem<TestTreeItem>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@@ -100,7 +100,6 @@ public:
|
|||||||
bool markedForRemoval() const { return m_status == MarkedForRemoval; }
|
bool markedForRemoval() const { return m_status == MarkedForRemoval; }
|
||||||
bool newlyAdded() const { return m_status == NewlyAdded; }
|
bool newlyAdded() const { return m_status == NewlyAdded; }
|
||||||
TestTreeItem *parentItem() const;
|
TestTreeItem *parentItem() const;
|
||||||
TestTreeItem *childItem(int row) const;
|
|
||||||
|
|
||||||
TestTreeItem *findChildByName(const QString &name);
|
TestTreeItem *findChildByName(const QString &name);
|
||||||
TestTreeItem *findChildByFile(const QString &filePath);
|
TestTreeItem *findChildByFile(const QString &filePath);
|
||||||
@@ -127,7 +126,6 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
void copyBasicDataFrom(const TestTreeItem *other);
|
void copyBasicDataFrom(const TestTreeItem *other);
|
||||||
typedef std::function<bool(const TestTreeItem *)> CompareFunction;
|
typedef std::function<bool(const TestTreeItem *)> CompareFunction;
|
||||||
TestTreeItem *findChildBy(CompareFunction compare) const;
|
|
||||||
static QSet<QString> dependingInternalTargets(CppTools::CppModelManager *cppMM,
|
static QSet<QString> dependingInternalTargets(CppTools::CppModelManager *cppMM,
|
||||||
const QString &file);
|
const QString &file);
|
||||||
|
|
||||||
|
|||||||
@@ -162,29 +162,22 @@ QList<TestTreeItem *> TestTreeModel::testItemsByName(TestTreeItem *root, const Q
|
|||||||
{
|
{
|
||||||
QList<TestTreeItem *> result;
|
QList<TestTreeItem *> result;
|
||||||
|
|
||||||
for (int row = 0, count = root->childCount(); row < count; ++row){
|
root->forFirstLevelChildren([&testName, &result, this](TestTreeItem *node) {
|
||||||
TestTreeItem *node = root->childItem(row);
|
|
||||||
|
|
||||||
if (node->type() == TestTreeItem::TestCase) {
|
if (node->type() == TestTreeItem::TestCase) {
|
||||||
if (node->name() == testName) {
|
if (node->name() == testName) {
|
||||||
result << node;
|
result << node;
|
||||||
continue; // prioritize Tests over TestCases
|
return; // prioritize Tests over TestCases
|
||||||
}
|
}
|
||||||
|
TestTreeItem *testCase = node->findFirstLevelChild([&testName](TestTreeItem *it) {
|
||||||
TestTreeItem *testCase = node->findChildBy([testName](const TestTreeItem *it) {
|
|
||||||
QTC_ASSERT(it, return false);
|
QTC_ASSERT(it, return false);
|
||||||
return it->type() == TestTreeItem::TestFunctionOrSet && it->name() == testName;
|
return it->type() == TestTreeItem::TestFunctionOrSet && it->name() == testName;
|
||||||
}); // collect only actual tests, not special functions like init, cleanup etc,
|
}); // collect only actual tests, not special functions like init, cleanup etc.
|
||||||
|
if (testCase)
|
||||||
if (!testCase)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
result << testCase;
|
result << testCase;
|
||||||
} else {
|
} else {
|
||||||
result << testItemsByName(node, testName);
|
result << testItemsByName(node, testName);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,12 +222,12 @@ void TestTreeModel::rebuild(const QList<Core::Id> &frameworkIds)
|
|||||||
TestTreeItem *frameworkRoot = frameworkManager->rootNodeForTestFramework(id);
|
TestTreeItem *frameworkRoot = frameworkManager->rootNodeForTestFramework(id);
|
||||||
const bool groupingEnabled = TestFrameworkManager::instance()->groupingEnabled(id);
|
const bool groupingEnabled = TestFrameworkManager::instance()->groupingEnabled(id);
|
||||||
for (int row = frameworkRoot->childCount() - 1; row >= 0; --row) {
|
for (int row = frameworkRoot->childCount() - 1; row >= 0; --row) {
|
||||||
auto testItem = frameworkRoot->childItem(row);
|
auto testItem = frameworkRoot->childAt(row);
|
||||||
if (testItem->type() == TestTreeItem::GroupNode) {
|
if (testItem->type() == TestTreeItem::GroupNode) {
|
||||||
// process children of group node and delete it afterwards if necessary
|
// process children of group node and delete it afterwards if necessary
|
||||||
for (int childRow = testItem->childCount() - 1; childRow >= 0; --childRow) {
|
for (int childRow = testItem->childCount() - 1; childRow >= 0; --childRow) {
|
||||||
// FIXME should this be done recursively until we have a non-GroupNode?
|
// FIXME should this be done recursively until we have a non-GroupNode?
|
||||||
TestTreeItem *childTestItem = testItem->childItem(childRow);
|
TestTreeItem *childTestItem = testItem->childAt(childRow);
|
||||||
takeItem(childTestItem);
|
takeItem(childTestItem);
|
||||||
filterAndInsert(childTestItem, frameworkRoot, groupingEnabled);
|
filterAndInsert(childTestItem, frameworkRoot, groupingEnabled);
|
||||||
}
|
}
|
||||||
@@ -272,7 +265,7 @@ void TestTreeModel::markForRemoval(const QString &filePath)
|
|||||||
for (Utils::TreeItem *frameworkRoot : *rootItem()) {
|
for (Utils::TreeItem *frameworkRoot : *rootItem()) {
|
||||||
TestTreeItem *root = static_cast<TestTreeItem *>(frameworkRoot);
|
TestTreeItem *root = static_cast<TestTreeItem *>(frameworkRoot);
|
||||||
for (int childRow = root->childCount() - 1; childRow >= 0; --childRow) {
|
for (int childRow = root->childCount() - 1; childRow >= 0; --childRow) {
|
||||||
TestTreeItem *child = root->childItem(childRow);
|
TestTreeItem *child = root->childAt(childRow);
|
||||||
child->markForRemovalRecursively(filePath);
|
child->markForRemovalRecursively(filePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -300,7 +293,7 @@ bool TestTreeModel::sweepChildren(TestTreeItem *item)
|
|||||||
{
|
{
|
||||||
bool hasChanged = false;
|
bool hasChanged = false;
|
||||||
for (int row = item->childCount() - 1; row >= 0; --row) {
|
for (int row = item->childCount() - 1; row >= 0; --row) {
|
||||||
TestTreeItem *child = item->childItem(row);
|
TestTreeItem *child = item->childAt(row);
|
||||||
|
|
||||||
if (child->type() != TestTreeItem::Root && child->markedForRemoval()) {
|
if (child->type() != TestTreeItem::Root && child->markedForRemoval()) {
|
||||||
destroyItem(child);
|
destroyItem(child);
|
||||||
@@ -324,7 +317,7 @@ static TestTreeItem *fullCopyOf(TestTreeItem *other)
|
|||||||
QTC_ASSERT(other, return nullptr);
|
QTC_ASSERT(other, return nullptr);
|
||||||
TestTreeItem *result = other->copyWithoutChildren();
|
TestTreeItem *result = other->copyWithoutChildren();
|
||||||
for (int row = 0, count = other->childCount(); row < count; ++row)
|
for (int row = 0, count = other->childCount(); row < count; ++row)
|
||||||
result->appendChild(fullCopyOf(other->childItem(row)));
|
result->appendChild(fullCopyOf(other->childAt(row)));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -346,7 +339,7 @@ void TestTreeModel::insertItemInParent(TestTreeItem *item, TestTreeItem *root, b
|
|||||||
{
|
{
|
||||||
TestTreeItem *parentNode = root;
|
TestTreeItem *parentNode = root;
|
||||||
if (groupingEnabled) {
|
if (groupingEnabled) {
|
||||||
parentNode = root->findChildBy([item] (const TestTreeItem *it) {
|
parentNode = root->findFirstLevelChild([item] (const TestTreeItem *it) {
|
||||||
return it->isGroupNodeFor(item);
|
return it->isGroupNodeFor(item);
|
||||||
});
|
});
|
||||||
if (!parentNode) {
|
if (!parentNode) {
|
||||||
@@ -361,7 +354,7 @@ void TestTreeModel::insertItemInParent(TestTreeItem *item, TestTreeItem *root, b
|
|||||||
if (auto otherItem = parentNode->findChild(item)) {
|
if (auto otherItem = parentNode->findChild(item)) {
|
||||||
// only handle item's children and add them to the already present one
|
// only handle item's children and add them to the already present one
|
||||||
for (int row = 0, count = item->childCount(); row < count; ++row) {
|
for (int row = 0, count = item->childCount(); row < count; ++row) {
|
||||||
TestTreeItem *child = fullCopyOf(item->childItem(row));
|
TestTreeItem *child = fullCopyOf(item->childAt(row));
|
||||||
applyParentCheckState(otherItem, child);
|
applyParentCheckState(otherItem, child);
|
||||||
otherItem->appendChild(child);
|
otherItem->appendChild(child);
|
||||||
}
|
}
|
||||||
@@ -388,7 +381,7 @@ void TestTreeModel::revalidateCheckState(TestTreeItem *item)
|
|||||||
bool foundUnchecked = false;
|
bool foundUnchecked = false;
|
||||||
bool foundPartiallyChecked = false;
|
bool foundPartiallyChecked = false;
|
||||||
for (int row = 0, count = item->childCount(); row < count; ++row) {
|
for (int row = 0, count = item->childCount(); row < count; ++row) {
|
||||||
TestTreeItem *child = item->childItem(row);
|
TestTreeItem *child = item->childAt(row);
|
||||||
switch (child->type()) {
|
switch (child->type()) {
|
||||||
case TestTreeItem::TestDataFunction:
|
case TestTreeItem::TestDataFunction:
|
||||||
case TestTreeItem::TestSpecialFunction:
|
case TestTreeItem::TestSpecialFunction:
|
||||||
@@ -507,7 +500,7 @@ int TestTreeModel::autoTestsCount() const
|
|||||||
bool TestTreeModel::hasUnnamedQuickTests(const TestTreeItem *rootNode) const
|
bool TestTreeModel::hasUnnamedQuickTests(const TestTreeItem *rootNode) const
|
||||||
{
|
{
|
||||||
for (int row = 0, count = rootNode->childCount(); row < count; ++row) {
|
for (int row = 0, count = rootNode->childCount(); row < count; ++row) {
|
||||||
if (rootNode->childItem(row)->name().isEmpty())
|
if (rootNode->childAt(row)->name().isEmpty())
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -519,12 +512,7 @@ TestTreeItem *TestTreeModel::unnamedQuickTests() const
|
|||||||
if (!rootNode)
|
if (!rootNode)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
for (int row = 0, count = rootNode->childCount(); row < count; ++row) {
|
return rootNode->findFirstLevelChild([](TestTreeItem *it) { return it->name().isEmpty(); });
|
||||||
TestTreeItem *child = rootNode->childItem(row);
|
|
||||||
if (child->name().isEmpty())
|
|
||||||
return child;
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int TestTreeModel::namedQuickTestsCount() const
|
int TestTreeModel::namedQuickTestsCount() const
|
||||||
@@ -549,11 +537,11 @@ int TestTreeModel::dataTagsCount() const
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int dataTagCount = 0;
|
int dataTagCount = 0;
|
||||||
for (Utils::TreeItem *item : *rootNode) {
|
rootNode->forFirstLevelChildren([&dataTagCount](TestTreeItem *classItem) {
|
||||||
TestTreeItem *classItem = static_cast<TestTreeItem *>(item);
|
classItem->forFirstLevelChildren([&dataTagCount](TestTreeItem *functionItem) {
|
||||||
for (Utils::TreeItem *functionItem : *classItem)
|
|
||||||
dataTagCount += functionItem->childCount();
|
dataTagCount += functionItem->childCount();
|
||||||
}
|
});
|
||||||
|
});
|
||||||
return dataTagCount;
|
return dataTagCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -568,10 +556,9 @@ QMultiMap<QString, int> TestTreeModel::gtestNamesAndSets() const
|
|||||||
QMultiMap<QString, int> result;
|
QMultiMap<QString, int> result;
|
||||||
|
|
||||||
if (TestTreeItem *rootNode = gtestRootNode()) {
|
if (TestTreeItem *rootNode = gtestRootNode()) {
|
||||||
for (int row = 0, count = rootNode->childCount(); row < count; ++row) {
|
rootNode->forFirstLevelChildren([&result](TestTreeItem *child) {
|
||||||
const TestTreeItem *current = rootNode->childItem(row);
|
result.insert(child->name(), child->childCount());
|
||||||
result.insert(current->name(), current->childCount());
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user