aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/autotest/quick/quicktesttreeitem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/autotest/quick/quicktesttreeitem.cpp')
-rw-r--r--src/plugins/autotest/quick/quicktesttreeitem.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/plugins/autotest/quick/quicktesttreeitem.cpp b/src/plugins/autotest/quick/quicktesttreeitem.cpp
index b26e3b8599e..e174255ae08 100644
--- a/src/plugins/autotest/quick/quicktesttreeitem.cpp
+++ b/src/plugins/autotest/quick/quicktesttreeitem.cpp
@@ -27,6 +27,7 @@
#include "quicktestconfiguration.h"
#include "quicktestparser.h"
+#include <cpptools/cppmodelmanager.h>
#include <projectexplorer/session.h>
#include <utils/qtcassert.h>
@@ -138,6 +139,8 @@ TestConfiguration *QuickTestTreeItem::testConfiguration() const
default:
return nullptr;
}
+ if (config)
+ config->setInternalTargets(internalTargets());
return config;
}
@@ -150,6 +153,7 @@ QList<TestConfiguration *> QuickTestTreeItem::getAllTestConfigurations() const
return result;
QHash<QString, int> foundProFiles;
+ QHash<QString, QSet<QString> > proFilesWithTargets;
for (int row = 0, count = childCount(); row < count; ++row) {
const TestTreeItem *child = childItem(row);
// unnamed Quick Tests must be handled separately
@@ -158,12 +162,14 @@ QList<TestConfiguration *> QuickTestTreeItem::getAllTestConfigurations() const
const TestTreeItem *grandChild = child->childItem(childRow);
const QString &proFile = grandChild->proFile();
foundProFiles.insert(proFile, foundProFiles[proFile] + 1);
+ proFilesWithTargets.insert(proFile, grandChild->internalTargets());
}
continue;
}
// named Quick Test
const QString &proFile = child->proFile();
foundProFiles.insert(proFile, foundProFiles[proFile] + child->childCount());
+ proFilesWithTargets.insert(proFile, child->internalTargets());
}
// create TestConfiguration for each project file
QHash<QString, int>::ConstIterator it = foundProFiles.begin();
@@ -173,6 +179,7 @@ QList<TestConfiguration *> QuickTestTreeItem::getAllTestConfigurations() const
tc->setTestCaseCount(it.value());
tc->setProjectFile(it.key());
tc->setProject(project);
+ tc->setInternalTargets(proFilesWithTargets[it.key()]);
result << tc;
}
return result;
@@ -203,6 +210,7 @@ QList<TestConfiguration *> QuickTestTreeItem::getSelectedTestConfigurations() co
tc->setUnnamedOnly(true);
tc->setProjectFile(proFile);
tc->setProject(project);
+ tc->setInternalTargets(grandChild->internalTargets());
foundProFiles.insert(proFile, tc);
}
}
@@ -246,6 +254,7 @@ QList<TestConfiguration *> QuickTestTreeItem::getSelectedTestConfigurations() co
tc->setTestCases(testFunctions);
tc->setProjectFile(child->proFile());
tc->setProject(project);
+ tc->setInternalTargets(child->internalTargets());
foundProFiles.insert(child->proFile(), tc);
}
break;
@@ -307,6 +316,20 @@ bool QuickTestTreeItem::lessThan(const TestTreeItem *other, TestTreeItem::SortMo
return TestTreeItem::lessThan(other, mode);
}
+QSet<QString> QuickTestTreeItem::internalTargets() const
+{
+ QSet<QString> result;
+ const auto cppMM = CppTools::CppModelManager::instance();
+ const auto projectInfo = cppMM->projectInfo(ProjectExplorer::SessionManager::startupProject());
+ for (const CppTools::ProjectPart::Ptr projectPart : projectInfo.projectParts()) {
+ if (projectPart->projectFile == proFile()) {
+ result.insert(projectPart->buildSystemTarget);
+ break;
+ }
+ }
+ return result;
+}
+
TestTreeItem *QuickTestTreeItem::unnamedQuickTests() const
{
if (type() != Root)