aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@qt.io>2023-04-17 13:02:51 +0200
committerChristian Stenger <christian.stenger@qt.io>2023-04-18 11:33:28 +0000
commitc3715883ee6223d8bc4d7ca10b0783d629e68577 (patch)
tree9cac701c011ed320ab1dabbedd1dc6a3e9355fca
parent610c0fee8787c3c3908630e5142036ffe13553a8 (diff)
AutoTest: Improve handling of Qt Quick Tests
Qml files must not get declared inside the project files which makes it hard to correctly determine the correct project part they might belong to. The recommended and correct way of using Quick Tests is to have QUICK_TEST_SOURCE_DIR defined which is used internally anyhow to find the respective qml files. Make use of this fact also when determining the correct project part. Fixes: QTCREATORBUG-28716 Change-Id: I45371242ce931ee83b7bfbdd07a0848c7fd86abb Reviewed-by: David Schulz <david.schulz@qt.io>
-rw-r--r--src/plugins/autotest/quick/quicktesttreeitem.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/plugins/autotest/quick/quicktesttreeitem.cpp b/src/plugins/autotest/quick/quicktesttreeitem.cpp
index 49358f49eb..f721ce3bc0 100644
--- a/src/plugins/autotest/quick/quicktesttreeitem.cpp
+++ b/src/plugins/autotest/quick/quicktesttreeitem.cpp
@@ -375,8 +375,14 @@ QSet<QString> internalTargets(const FilePath &proFile)
for (const CppEditor::ProjectPart::ConstPtr &projectPart : projectInfo->projectParts()) {
if (projectPart->buildTargetType != ProjectExplorer::BuildTargetType::Executable)
continue;
- if (projectPart->projectFile == proFile.toString())
+ if (projectPart->projectFile != proFile.toString())
+ continue;
+ if (Utils::anyOf(projectPart->projectMacros, [](const ProjectExplorer::Macro &macro){
+ return macro.type == ProjectExplorer::MacroType::Define &&
+ macro.key == "QUICK_TEST_SOURCE_DIR";
+ })) {
result.insert(projectPart->buildSystemTarget);
+ }
}
return result;
}