forked from qt-creator/qt-creator
CppTools: Reparse editor documents after active project change
Change-Id: I010709c866291bf59c27f4a05765e1ab0efd28af Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -49,6 +49,7 @@ protected:
|
||||
ProjectPart::Ptr manuallySetProjectPart;
|
||||
bool stickToPreviousProjectPart = false;
|
||||
const ProjectExplorer::Project *activeProject = nullptr;
|
||||
bool projectHasChanged = false;
|
||||
::ProjectPartChooser chooser;
|
||||
|
||||
QList<ProjectPart::Ptr> projectPartsForFile;
|
||||
@@ -100,6 +101,21 @@ TEST_F(ProjectPartChooser, ForMultipleFromDependenciesChooseFromActiveProject)
|
||||
ASSERT_THAT(chosen, Eq(secondProjectPart));
|
||||
}
|
||||
|
||||
TEST_F(ProjectPartChooser, ForMultipleCheckIfActiveProjectChanged)
|
||||
{
|
||||
const QList<ProjectPart::Ptr> projectParts = createProjectPartsWithDifferentProjects();
|
||||
const ProjectPart::Ptr firstProjectPart = projectParts.at(0);
|
||||
const ProjectPart::Ptr secondProjectPart = projectParts.at(1);
|
||||
projectPartsForFile += projectParts;
|
||||
currentProjectPart = firstProjectPart;
|
||||
activeProject = secondProjectPart->project;
|
||||
projectHasChanged = true;
|
||||
|
||||
const ProjectPart::Ptr chosen = choose();
|
||||
|
||||
ASSERT_THAT(chosen, Eq(secondProjectPart));
|
||||
}
|
||||
|
||||
TEST_F(ProjectPartChooser, IfProjectIsGoneStickToPrevious) // Built-in Code Model
|
||||
{
|
||||
stickToPreviousProjectPart = true;
|
||||
@@ -167,7 +183,8 @@ const ProjectPart::Ptr ProjectPartChooser::choose() const
|
||||
currentProjectPart,
|
||||
manuallySetProjectPart,
|
||||
stickToPreviousProjectPart,
|
||||
activeProject);
|
||||
activeProject,
|
||||
projectHasChanged);
|
||||
}
|
||||
|
||||
QList<ProjectPart::Ptr> ProjectPartChooser::createProjectPartsWithDifferentProjects()
|
||||
|
||||
Reference in New Issue
Block a user