CppTools: Prioritize project parts with selectedForBuilding=true

...when selecting one for the editor document.

This flag is only set by the QmakeProject.

Change-Id: I648886e12148bd1ebeccca52d9faaf4b528597c9
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Nikolai Kosjar
2016-12-16 15:30:08 +01:00
committed by David Schulz
parent 0718f536a7
commit 9861a58400
2 changed files with 38 additions and 7 deletions

View File

@@ -89,6 +89,20 @@ TEST_F(ProjectPartChooser, ForMultipleChooseFromActiveProject)
ASSERT_THAT(chosen, Eq(secondProjectPart));
}
TEST_F(ProjectPartChooser, ForMultiplePreferSelectedForBuilding)
{
const ProjectPart::Ptr firstProjectPart{new ProjectPart};
const ProjectPart::Ptr secondProjectPart{new ProjectPart};
firstProjectPart->selectedForBuilding = false;
secondProjectPart->selectedForBuilding = true;
projectPartsForFile += firstProjectPart;
projectPartsForFile += secondProjectPart;
const ProjectPart::Ptr chosen = choose();
ASSERT_THAT(chosen, Eq(secondProjectPart));
}
TEST_F(ProjectPartChooser, ForMultipleFromDependenciesChooseFromActiveProject)
{
const QList<ProjectPart::Ptr> projectParts = createProjectPartsWithDifferentProjects();