aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cpptools/cppmodelmanager_test.cpp
diff options
context:
space:
mode:
authorMarco Bubke <marco.bubke@qt.io>2018-09-03 16:10:43 +0200
committerMarco Bubke <marco.bubke@qt.io>2018-09-10 09:31:32 +0000
commit3abaf647d0c632a4dfcb00d9ad2d1ffe66e014d9 (patch)
tree5efed90dedcb7b960cfa4d6ceb9b1aeb3e1a662b /src/plugins/cpptools/cppmodelmanager_test.cpp
parent59e734d9dae00ce2f9a00e8d197f81e7ee450b03 (diff)
Add system include path to HeaderPath and merge ProjectPartHeaderPath
System include paths are appended after other includes by the compiler. So we should set them as system includes and not as normal includes. Otherwise we change the include order. Headers in system include paths are not cluttering the screen with unwanted warning and by the way improve performance too. ProjectPartHeaderPath was a dopperganger of HeaderPath, so we merged them. Change-Id: I7c394b4098b697de79761499ffcd5913cc02d652 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'src/plugins/cpptools/cppmodelmanager_test.cpp')
-rw-r--r--src/plugins/cpptools/cppmodelmanager_test.cpp41
1 files changed, 14 insertions, 27 deletions
diff --git a/src/plugins/cpptools/cppmodelmanager_test.cpp b/src/plugins/cpptools/cppmodelmanager_test.cpp
index c50c12402cc..e9035b27bc5 100644
--- a/src/plugins/cpptools/cppmodelmanager_test.cpp
+++ b/src/plugins/cpptools/cppmodelmanager_test.cpp
@@ -183,22 +183,19 @@ void CppToolsPlugin::test_modelmanager_paths_are_clean()
Project *project = helper.createProject(_("test_modelmanager_paths_are_clean"));
ProjectInfo pi = ProjectInfo(project);
- typedef ProjectPartHeaderPath HeaderPath;
-
ProjectPart::Ptr part(new ProjectPart);
part->qtVersion = ProjectPart::Qt5;
part->projectMacros = {ProjectExplorer::Macro("OH_BEHAVE", "-1")};
- part->headerPaths = {HeaderPath(testDataDir.includeDir(false), HeaderPath::IncludePath),
- HeaderPath(testDataDir.frameworksDir(false), HeaderPath::FrameworkPath)};
+ part->headerPaths = {{testDataDir.includeDir(false), IncludePathType::User},
+ {testDataDir.frameworksDir(false), IncludePathType::Framework}};
pi.appendProjectPart(part);
mm->updateProjectInfo(pi);
- ProjectPartHeaderPaths headerPaths = mm->headerPaths();
+ ProjectExplorer::HeaderPaths headerPaths = mm->headerPaths();
QCOMPARE(headerPaths.size(), 2);
- QVERIFY(headerPaths.contains(HeaderPath(testDataDir.includeDir(), HeaderPath::IncludePath)));
- QVERIFY(headerPaths.contains(HeaderPath(testDataDir.frameworksDir(),
- HeaderPath::FrameworkPath)));
+ QVERIFY(headerPaths.contains({testDataDir.includeDir(), IncludePathType::User}));
+ QVERIFY(headerPaths.contains({testDataDir.frameworksDir(), IncludePathType::Framework}));
}
/// Check: Frameworks headers are resolved.
@@ -215,13 +212,11 @@ void CppToolsPlugin::test_modelmanager_framework_headers()
Project *project = helper.createProject(_("test_modelmanager_framework_headers"));
ProjectInfo pi = ProjectInfo(project);
- typedef ProjectPartHeaderPath HeaderPath;
-
ProjectPart::Ptr part(new ProjectPart);
part->qtVersion = ProjectPart::Qt5;
part->projectMacros = {{"OH_BEHAVE", "-1"}};
- part->headerPaths = {HeaderPath(testDataDir.includeDir(false), HeaderPath::IncludePath),
- HeaderPath(testDataDir.frameworksDir(false), HeaderPath::FrameworkPath)};
+ part->headerPaths = {{testDataDir.includeDir(false), IncludePathType::User},
+ {testDataDir.frameworksDir(false), IncludePathType::Framework}};
const QString &source = testDataDir.fileFromSourcesDir(
_("test_modelmanager_framework_headers.cpp"));
part->files << ProjectFile(source, ProjectFile::CXXSource);
@@ -264,12 +259,10 @@ void CppToolsPlugin::test_modelmanager_refresh_also_includes_of_project_files()
_("test_modelmanager_refresh_also_includes_of_project_files"));
ProjectInfo pi = ProjectInfo(project);
- typedef ProjectPartHeaderPath HeaderPath;
-
ProjectPart::Ptr part(new ProjectPart);
part->qtVersion = ProjectPart::Qt5;
part->projectMacros = {{"OH_BEHAVE", "-1"}};
- part->headerPaths = {HeaderPath(testDataDir.includeDir(false), HeaderPath::IncludePath)};
+ part->headerPaths = {{testDataDir.includeDir(false), IncludePathType::User}};
part->files.append(ProjectFile(testCpp, ProjectFile::CXXSource));
pi.appendProjectPart(part);
@@ -755,15 +748,13 @@ void CppToolsPlugin::test_modelmanager_defines_per_project()
Project *project = helper.createProject(_("test_modelmanager_defines_per_project"));
- typedef ProjectPartHeaderPath HeaderPath;
-
ProjectPart::Ptr part1(new ProjectPart);
part1->projectFile = QLatin1String("project1.projectfile");
part1->files.append(ProjectFile(main1File, ProjectFile::CXXSource));
part1->files.append(ProjectFile(header, ProjectFile::CXXHeader));
part1->qtVersion = ProjectPart::NoQt;
part1->projectMacros = {{"SUB1"}};
- part1->headerPaths = {HeaderPath(testDataDirectory.includeDir(false), HeaderPath::IncludePath)};
+ part1->headerPaths = {{testDataDirectory.includeDir(false), IncludePathType::User}};
ProjectPart::Ptr part2(new ProjectPart);
part2->projectFile = QLatin1String("project1.projectfile");
@@ -771,7 +762,7 @@ void CppToolsPlugin::test_modelmanager_defines_per_project()
part2->files.append(ProjectFile(header, ProjectFile::CXXHeader));
part2->qtVersion = ProjectPart::NoQt;
part2->projectMacros = {{"SUB2"}};
- part2->headerPaths = {HeaderPath(testDataDirectory.includeDir(false), HeaderPath::IncludePath)};
+ part2->headerPaths = {{testDataDirectory.includeDir(false), IncludePathType::User}};
ProjectInfo pi = ProjectInfo(project);
pi.appendProjectPart(part1);
@@ -821,15 +812,13 @@ void CppToolsPlugin::test_modelmanager_precompiled_headers()
Project *project = helper.createProject(_("test_modelmanager_defines_per_project_pch"));
- typedef ProjectPartHeaderPath HeaderPath;
-
ProjectPart::Ptr part1(new ProjectPart);
part1->projectFile = QLatin1String("project1.projectfile");
part1->files.append(ProjectFile(main1File, ProjectFile::CXXSource));
part1->files.append(ProjectFile(header, ProjectFile::CXXHeader));
part1->qtVersion = ProjectPart::NoQt;
part1->precompiledHeaders.append(pch1File);
- part1->headerPaths = {HeaderPath(testDataDirectory.includeDir(false), HeaderPath::IncludePath)};
+ part1->headerPaths = {{testDataDirectory.includeDir(false), IncludePathType::User}};
part1->updateLanguageFeatures();
ProjectPart::Ptr part2(new ProjectPart);
@@ -838,7 +827,7 @@ void CppToolsPlugin::test_modelmanager_precompiled_headers()
part2->files.append(ProjectFile(header, ProjectFile::CXXHeader));
part2->qtVersion = ProjectPart::NoQt;
part2->precompiledHeaders.append(pch2File);
- part2->headerPaths = {HeaderPath(testDataDirectory.includeDir(false), HeaderPath::IncludePath)};
+ part2->headerPaths = {{testDataDirectory.includeDir(false), IncludePathType::User}};
part2->updateLanguageFeatures();
ProjectInfo pi = ProjectInfo(project);
@@ -906,19 +895,17 @@ void CppToolsPlugin::test_modelmanager_defines_per_editor()
Project *project = helper.createProject(_("test_modelmanager_defines_per_editor"));
- typedef ProjectPartHeaderPath HeaderPath;
-
ProjectPart::Ptr part1(new ProjectPart);
part1->files.append(ProjectFile(main1File, ProjectFile::CXXSource));
part1->files.append(ProjectFile(header, ProjectFile::CXXHeader));
part1->qtVersion = ProjectPart::NoQt;
- part1->headerPaths = {HeaderPath(testDataDirectory.includeDir(false), HeaderPath::IncludePath)};
+ part1->headerPaths = {{testDataDirectory.includeDir(false), IncludePathType::User}};
ProjectPart::Ptr part2(new ProjectPart);
part2->files.append(ProjectFile(main2File, ProjectFile::CXXSource));
part2->files.append(ProjectFile(header, ProjectFile::CXXHeader));
part2->qtVersion = ProjectPart::NoQt;
- part2->headerPaths = {HeaderPath(testDataDirectory.includeDir(false), HeaderPath::IncludePath)};
+ part2->headerPaths = {{testDataDirectory.includeDir(false), IncludePathType::User}};
ProjectInfo pi = ProjectInfo(project);
pi.appendProjectPart(part1);