diff --git a/src/plugins/cpptools/cpptoolstestcase.cpp b/src/plugins/cpptools/cpptoolstestcase.cpp index 5aebd874284..fa6bed8b511 100644 --- a/src/plugins/cpptools/cpptoolstestcase.cpp +++ b/src/plugins/cpptools/cpptoolstestcase.cpp @@ -363,16 +363,18 @@ VerifyCleanCppModelManager::~VerifyCleanCppModelManager() { #define RETURN_FALSE_IF_NOT(check) if (!(check)) return false; -bool VerifyCleanCppModelManager::isClean() +bool VerifyCleanCppModelManager::isClean(bool testOnlyForCleanedProjects) { CppModelManager *mm = CppModelManager::instance(); RETURN_FALSE_IF_NOT(mm->projectInfos().isEmpty()); RETURN_FALSE_IF_NOT(mm->headerPaths().isEmpty()); RETURN_FALSE_IF_NOT(mm->definedMacros().isEmpty()); RETURN_FALSE_IF_NOT(mm->projectFiles().isEmpty()); - RETURN_FALSE_IF_NOT(mm->snapshot().isEmpty()); - RETURN_FALSE_IF_NOT(mm->workingCopy().size() == 1); - RETURN_FALSE_IF_NOT(mm->workingCopy().contains(mm->configurationFileName())); + if (!testOnlyForCleanedProjects) { + RETURN_FALSE_IF_NOT(mm->snapshot().isEmpty()); + RETURN_FALSE_IF_NOT(mm->workingCopy().size() == 1); + RETURN_FALSE_IF_NOT(mm->workingCopy().contains(mm->configurationFileName())); + } return true; } diff --git a/src/plugins/cpptools/cpptoolstestcase.h b/src/plugins/cpptools/cpptoolstestcase.h index f7a7343edeb..5a95952365d 100644 --- a/src/plugins/cpptools/cpptoolstestcase.h +++ b/src/plugins/cpptools/cpptoolstestcase.h @@ -161,7 +161,7 @@ class CPPTOOLS_EXPORT VerifyCleanCppModelManager public: VerifyCleanCppModelManager(); ~VerifyCleanCppModelManager(); - static bool isClean(); + static bool isClean(bool testCleanedProjects = true); }; class FileWriterAndRemover diff --git a/src/plugins/cpptools/modelmanagertesthelper.cpp b/src/plugins/cpptools/modelmanagertesthelper.cpp index 84050476805..462d628e52d 100644 --- a/src/plugins/cpptools/modelmanagertesthelper.cpp +++ b/src/plugins/cpptools/modelmanagertesthelper.cpp @@ -54,8 +54,10 @@ TestProject::~TestProject() { } -ModelManagerTestHelper::ModelManagerTestHelper(QObject *parent) : - QObject(parent) +ModelManagerTestHelper::ModelManagerTestHelper(QObject *parent, + bool testOnlyForCleanedProjects) + : QObject(parent) + , m_testOnlyForCleanedProjects(testOnlyForCleanedProjects) { CppModelManager *mm = CppModelManager::instance(); @@ -69,13 +71,13 @@ ModelManagerTestHelper::ModelManagerTestHelper(QObject *parent) : this, &ModelManagerTestHelper::gcFinished); cleanup(); - QVERIFY(Tests::VerifyCleanCppModelManager::isClean()); + QVERIFY(Tests::VerifyCleanCppModelManager::isClean(m_testOnlyForCleanedProjects)); } ModelManagerTestHelper::~ModelManagerTestHelper() { cleanup(); - QVERIFY(Tests::VerifyCleanCppModelManager::isClean()); + QVERIFY(Tests::VerifyCleanCppModelManager::isClean(m_testOnlyForCleanedProjects)); } void ModelManagerTestHelper::cleanup() diff --git a/src/plugins/cpptools/modelmanagertesthelper.h b/src/plugins/cpptools/modelmanagertesthelper.h index a184a0777e0..d914cd75bc5 100644 --- a/src/plugins/cpptools/modelmanagertesthelper.h +++ b/src/plugins/cpptools/modelmanagertesthelper.h @@ -75,7 +75,8 @@ class CPPTOOLS_EXPORT ModelManagerTestHelper: public QObject public: typedef ProjectExplorer::Project Project; - explicit ModelManagerTestHelper(QObject *parent = 0); + explicit ModelManagerTestHelper(QObject *parent = 0, + bool testOnlyForCleanedProjects = true); ~ModelManagerTestHelper(); void cleanup(); @@ -99,6 +100,7 @@ public slots: private: bool m_gcFinished; bool m_refreshHappened; + bool m_testOnlyForCleanedProjects; QSet m_lastRefreshedSourceFiles; };