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>
This commit is contained in:
Christian Stenger
2023-04-17 13:02:51 +02:00
parent 610c0fee87
commit c3715883ee

View File

@@ -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;
}