summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppmodelmanager_test.cpp
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@digia.com>2014-06-25 17:23:19 +0200
committerErik Verbruggen <erik.verbruggen@digia.com>2014-07-04 13:51:36 +0200
commit3d33886e53722ae7e2f33741085fe01c1a1178f8 (patch)
tree132429c7f2acac09a906cc549dcbd93fe8c90e70 /src/plugins/cpptools/cppmodelmanager_test.cpp
parent76152088e93258cdd025f49902270a7c53757633 (diff)
downloadqt-creator-3d33886e53722ae7e2f33741085fe01c1a1178f8.tar.gz
C++: fix include/framework path handling.
Instead of having two lists of paths, now only one list is used where both include paths and framework paths can be mixed. This reflects the way the compiler is invoked, and retains the (correct) search order. Task-number: QTCREATORBUG-11599 Change-Id: I373953e3e305df5b7a0d10920e12d146584adf9f Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Diffstat (limited to 'src/plugins/cpptools/cppmodelmanager_test.cpp')
-rw-r--r--src/plugins/cpptools/cppmodelmanager_test.cpp55
1 files changed, 37 insertions, 18 deletions
diff --git a/src/plugins/cpptools/cppmodelmanager_test.cpp b/src/plugins/cpptools/cppmodelmanager_test.cpp
index 4aef1c892b..3ca3e3d49d 100644
--- a/src/plugins/cpptools/cppmodelmanager_test.cpp
+++ b/src/plugins/cpptools/cppmodelmanager_test.cpp
@@ -220,23 +220,24 @@ void CppToolsPlugin::test_modelmanager_paths_are_clean()
ProjectInfo pi = mm->projectInfo(project);
QCOMPARE(pi.project().data(), project);
+ typedef ProjectPart::HeaderPath HeaderPath;
+
ProjectPart::Ptr part(new ProjectPart);
part->cxxVersion = ProjectPart::CXX98;
part->qtVersion = ProjectPart::Qt5;
part->projectDefines = QByteArray("#define OH_BEHAVE -1\n");
- part->includePaths = QStringList() << testDataDir.includeDir(false);
- part->frameworkPaths = QStringList() << testDataDir.frameworksDir(false);
+ part->headerPaths = QList<HeaderPath>()
+ << HeaderPath(testDataDir.includeDir(false), HeaderPath::IncludePath)
+ << HeaderPath(testDataDir.frameworksDir(false), HeaderPath::FrameworkPath);
pi.appendProjectPart(part);
mm->updateProjectInfo(pi);
- QStringList includePaths = mm->includePaths();
- QCOMPARE(includePaths.size(), 1);
- QVERIFY(includePaths.contains(testDataDir.includeDir()));
-
- QStringList frameworkPaths = mm->frameworkPaths();
- QCOMPARE(frameworkPaths.size(), 1);
- QVERIFY(frameworkPaths.contains(testDataDir.frameworksDir()));
+ QList<HeaderPath> headerPaths = mm->headerPaths();
+ QCOMPARE(headerPaths.size(), 2);
+ QVERIFY(headerPaths.contains(HeaderPath(testDataDir.includeDir(), HeaderPath::IncludePath)));
+ QVERIFY(headerPaths.contains(HeaderPath(testDataDir.frameworksDir(),
+ HeaderPath::FrameworkPath)));
}
/// Check: Frameworks headers are resolved.
@@ -254,12 +255,15 @@ void CppToolsPlugin::test_modelmanager_framework_headers()
ProjectInfo pi = mm->projectInfo(project);
QCOMPARE(pi.project().data(), project);
+ typedef ProjectPart::HeaderPath HeaderPath;
+
ProjectPart::Ptr part(new ProjectPart);
part->cxxVersion = ProjectPart::CXX98;
part->qtVersion = ProjectPart::Qt5;
part->projectDefines = QByteArray("#define OH_BEHAVE -1\n");
- part->includePaths << testDataDir.includeDir();
- part->frameworkPaths << testDataDir.frameworksDir();
+ part->headerPaths = QList<HeaderPath>()
+ << HeaderPath(testDataDir.includeDir(false), HeaderPath::IncludePath)
+ << HeaderPath(testDataDir.frameworksDir(false), HeaderPath::FrameworkPath);
const QString &source = testDataDir.fileFromSourcesDir(
_("test_modelmanager_framework_headers.cpp"));
part->files << ProjectFile(source, ProjectFile::CXXSource);
@@ -303,11 +307,14 @@ void CppToolsPlugin::test_modelmanager_refresh_also_includes_of_project_files()
ProjectInfo pi = mm->projectInfo(project);
QCOMPARE(pi.project().data(), project);
+ typedef ProjectPart::HeaderPath HeaderPath;
+
ProjectPart::Ptr part(new ProjectPart);
part->cxxVersion = ProjectPart::CXX98;
part->qtVersion = ProjectPart::Qt5;
part->projectDefines = QByteArray("#define OH_BEHAVE -1\n");
- part->includePaths = QStringList() << testDataDir.includeDir(false);
+ part->headerPaths = QList<HeaderPath>()
+ << HeaderPath(testDataDir.includeDir(false), HeaderPath::IncludePath);
part->files.append(ProjectFile(testCpp, ProjectFile::CXXSource));
pi.appendProjectPart(part);
@@ -806,6 +813,8 @@ void CppToolsPlugin::test_modelmanager_defines_per_project()
Project *project = helper.createProject(_("test_modelmanager_defines_per_project"));
+ typedef ProjectPart::HeaderPath HeaderPath;
+
ProjectPart::Ptr part1(new ProjectPart);
part1->projectFile = QLatin1String("project1.projectfile");
part1->files.append(ProjectFile(main1File, ProjectFile::CXXSource));
@@ -813,7 +822,8 @@ void CppToolsPlugin::test_modelmanager_defines_per_project()
part1->cxxVersion = ProjectPart::CXX11;
part1->qtVersion = ProjectPart::NoQt;
part1->projectDefines = QByteArray("#define SUB1\n");
- part1->includePaths = QStringList() << testDataDirectory.includeDir(false);
+ part1->headerPaths = QList<HeaderPath>()
+ << HeaderPath(testDataDirectory.includeDir(false), HeaderPath::IncludePath);
ProjectPart::Ptr part2(new ProjectPart);
part2->projectFile = QLatin1String("project1.projectfile");
@@ -822,7 +832,8 @@ void CppToolsPlugin::test_modelmanager_defines_per_project()
part2->cxxVersion = ProjectPart::CXX11;
part2->qtVersion = ProjectPart::NoQt;
part2->projectDefines = QByteArray("#define SUB2\n");
- part2->includePaths = QStringList() << testDataDirectory.includeDir(false);
+ part2->headerPaths = QList<HeaderPath>()
+ << HeaderPath(testDataDirectory.includeDir(false), HeaderPath::IncludePath);
ProjectInfo pi = mm->projectInfo(project);
pi.appendProjectPart(part1);
@@ -877,6 +888,8 @@ void CppToolsPlugin::test_modelmanager_defines_per_project_pch()
Project *project = helper.createProject(_("test_modelmanager_defines_per_project_pch"));
+ typedef ProjectPart::HeaderPath HeaderPath;
+
ProjectPart::Ptr part1(new ProjectPart);
part1->projectFile = QLatin1String("project1.projectfile");
part1->files.append(ProjectFile(main1File, ProjectFile::CXXSource));
@@ -884,7 +897,8 @@ void CppToolsPlugin::test_modelmanager_defines_per_project_pch()
part1->cxxVersion = ProjectPart::CXX11;
part1->qtVersion = ProjectPart::NoQt;
part1->precompiledHeaders.append(pch1File);
- part1->includePaths = QStringList() << testDataDirectory.includeDir(false);
+ part1->headerPaths = QList<HeaderPath>()
+ << HeaderPath(testDataDirectory.includeDir(false), HeaderPath::IncludePath);
ProjectPart::Ptr part2(new ProjectPart);
part2->projectFile = QLatin1String("project2.projectfile");
@@ -893,7 +907,8 @@ void CppToolsPlugin::test_modelmanager_defines_per_project_pch()
part2->cxxVersion = ProjectPart::CXX11;
part2->qtVersion = ProjectPart::NoQt;
part2->precompiledHeaders.append(pch2File);
- part2->includePaths = QStringList() << testDataDirectory.includeDir(false);
+ part2->headerPaths = QList<HeaderPath>()
+ << HeaderPath(testDataDirectory.includeDir(false), HeaderPath::IncludePath);
ProjectInfo pi = mm->projectInfo(project);
pi.appendProjectPart(part1);
@@ -949,19 +964,23 @@ void CppToolsPlugin::test_modelmanager_defines_per_editor()
Project *project = helper.createProject(_("test_modelmanager_defines_per_editor"));
+ typedef ProjectPart::HeaderPath HeaderPath;
+
ProjectPart::Ptr part1(new ProjectPart);
part1->files.append(ProjectFile(main1File, ProjectFile::CXXSource));
part1->files.append(ProjectFile(header, ProjectFile::CXXHeader));
part1->cxxVersion = ProjectPart::CXX11;
part1->qtVersion = ProjectPart::NoQt;
- part1->includePaths = QStringList() << testDataDirectory.includeDir(false);
+ part1->headerPaths = QList<HeaderPath>()
+ << HeaderPath(testDataDirectory.includeDir(false), HeaderPath::IncludePath);
ProjectPart::Ptr part2(new ProjectPart);
part2->files.append(ProjectFile(main2File, ProjectFile::CXXSource));
part2->files.append(ProjectFile(header, ProjectFile::CXXHeader));
part2->cxxVersion = ProjectPart::CXX11;
part2->qtVersion = ProjectPart::NoQt;
- part2->includePaths = QStringList() << testDataDirectory.includeDir(false);
+ part2->headerPaths = QList<HeaderPath>()
+ << HeaderPath(testDataDirectory.includeDir(false), HeaderPath::IncludePath);
ProjectInfo pi = mm->projectInfo(project);
pi.appendProjectPart(part1);