CppModelManager: Remove method overload used only in tests

Use (and therefore test) the method actually used in production code.

Change-Id: I4317517ef8a1779df4d46af3905790012ee98645
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Bernhard Beschow
2018-12-11 17:33:18 +01:00
parent 5916be8756
commit 9ee785a4ef
4 changed files with 11 additions and 13 deletions

View File

@@ -1029,12 +1029,6 @@ void CppModelManager::updateCppEditorDocuments(bool projectsUpdated) const
} }
} }
QFuture<void> CppModelManager::updateProjectInfo(const ProjectInfo &newProjectInfo)
{
QFutureInterface<void> dummy;
return updateProjectInfo(dummy, newProjectInfo);
}
QFuture<void> CppModelManager::updateProjectInfo(QFutureInterface<void> &futureInterface, QFuture<void> CppModelManager::updateProjectInfo(QFutureInterface<void> &futureInterface,
const ProjectInfo &newProjectInfo) const ProjectInfo &newProjectInfo)
{ {

View File

@@ -116,7 +116,6 @@ public:
QList<ProjectInfo> projectInfos() const; QList<ProjectInfo> projectInfos() const;
ProjectInfo projectInfo(ProjectExplorer::Project *project) const; ProjectInfo projectInfo(ProjectExplorer::Project *project) const;
QFuture<void> updateProjectInfo(const ProjectInfo &newProjectInfo);
QFuture<void> updateProjectInfo(QFutureInterface<void> &futureInterface, QFuture<void> updateProjectInfo(QFutureInterface<void> &futureInterface,
const ProjectInfo &newProjectInfo); const ProjectInfo &newProjectInfo);

View File

@@ -190,7 +190,8 @@ void CppToolsPlugin::test_modelmanager_paths_are_clean()
{testDataDir.frameworksDir(false), HeaderPathType::Framework}}; {testDataDir.frameworksDir(false), HeaderPathType::Framework}};
pi.appendProjectPart(part); pi.appendProjectPart(part);
mm->updateProjectInfo(pi); QFutureInterface<void> dummy;
mm->updateProjectInfo(dummy, pi);
ProjectExplorer::HeaderPaths headerPaths = mm->headerPaths(); ProjectExplorer::HeaderPaths headerPaths = mm->headerPaths();
QCOMPARE(headerPaths.size(), 2); QCOMPARE(headerPaths.size(), 2);
@@ -222,7 +223,8 @@ void CppToolsPlugin::test_modelmanager_framework_headers()
part->files << ProjectFile(source, ProjectFile::CXXSource); part->files << ProjectFile(source, ProjectFile::CXXSource);
pi.appendProjectPart(part); pi.appendProjectPart(part);
mm->updateProjectInfo(pi).waitForFinished(); QFutureInterface<void> dummy;
mm->updateProjectInfo(dummy, pi).waitForFinished();
QCoreApplication::processEvents(); QCoreApplication::processEvents();
QVERIFY(mm->snapshot().contains(source)); QVERIFY(mm->snapshot().contains(source));
@@ -321,7 +323,8 @@ void CppToolsPlugin::test_modelmanager_refresh_several_times()
part->files.append(ProjectFile(testHeader2, ProjectFile::CXXHeader)); part->files.append(ProjectFile(testHeader2, ProjectFile::CXXHeader));
part->files.append(ProjectFile(testCpp, ProjectFile::CXXSource)); part->files.append(ProjectFile(testCpp, ProjectFile::CXXSource));
pi.appendProjectPart(part); pi.appendProjectPart(part);
mm->updateProjectInfo(pi); QFutureInterface<void> dummy;
mm->updateProjectInfo(dummy, pi);
CPlusPlus::Snapshot snapshot; CPlusPlus::Snapshot snapshot;
QSet<QString> refreshedFiles; QSet<QString> refreshedFiles;
@@ -384,7 +387,8 @@ void CppToolsPlugin::test_modelmanager_refresh_test_for_changes()
// Reindexing triggers a reparsing thread // Reindexing triggers a reparsing thread
helper.resetRefreshedSourceFiles(); helper.resetRefreshedSourceFiles();
QFuture<void> firstFuture = mm->updateProjectInfo(pi); QFutureInterface<void> dummy;
QFuture<void> firstFuture = mm->updateProjectInfo(dummy, pi);
QVERIFY(firstFuture.isStarted() || firstFuture.isRunning()); QVERIFY(firstFuture.isStarted() || firstFuture.isRunning());
firstFuture.waitForFinished(); firstFuture.waitForFinished();
const QSet<QString> refreshedFiles = helper.waitForRefreshedSourceFiles(); const QSet<QString> refreshedFiles = helper.waitForRefreshedSourceFiles();
@@ -392,7 +396,7 @@ void CppToolsPlugin::test_modelmanager_refresh_test_for_changes()
QVERIFY(refreshedFiles.contains(testCpp)); QVERIFY(refreshedFiles.contains(testCpp));
// No reindexing since nothing has changed // No reindexing since nothing has changed
QFuture<void> subsequentFuture = mm->updateProjectInfo(pi); QFuture<void> subsequentFuture = mm->updateProjectInfo(dummy, pi);
QVERIFY(subsequentFuture.isCanceled() && subsequentFuture.isFinished()); QVERIFY(subsequentFuture.isCanceled() && subsequentFuture.isFinished());
} }

View File

@@ -93,7 +93,8 @@ ModelManagerTestHelper::Project *ModelManagerTestHelper::createProject(const QSt
QSet<QString> ModelManagerTestHelper::updateProjectInfo(const CppTools::ProjectInfo &projectInfo) QSet<QString> ModelManagerTestHelper::updateProjectInfo(const CppTools::ProjectInfo &projectInfo)
{ {
resetRefreshedSourceFiles(); resetRefreshedSourceFiles();
CppModelManager::instance()->updateProjectInfo(projectInfo).waitForFinished(); QFutureInterface<void> dummy;
CppModelManager::instance()->updateProjectInfo(dummy, projectInfo).waitForFinished();
QCoreApplication::processEvents(); QCoreApplication::processEvents();
return waitForRefreshedSourceFiles(); return waitForRefreshedSourceFiles();
} }