diff options
author | Nikolai Kosjar <nikolai.kosjar@theqtcompany.com> | 2014-12-09 17:09:45 +0100 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@theqtcompany.com> | 2014-12-19 10:24:55 +0100 |
commit | b94b7b3ee6cbec6df86ebb959d788b9b09933c7e (patch) | |
tree | 1c621c3ca53e4426d6d605550d9b920a39730ba0 /src/plugins/cpptools/cpptoolstestcase.cpp | |
parent | ef403a4515aa93272f6e5155b2897ddd02fb128e (diff) | |
download | qt-creator-b94b7b3ee6cbec6df86ebb959d788b9b09933c7e.tar.gz |
CppTools: Fix test_modelmanager_extraeditorsupport_uiFiles
The test was broken since the QmakeProject was changed to work
asynchronously.
FAIL! : CppTools::Internal::CppToolsPlugin::test_modelmanager_extraeditorsupport_uiFiles() Compared values are not the same
Actual (workingCopy.size()): 1
Expected (2) : 2
Change-Id: I6f7d05fb70af3def5fc371a9783b606309686e32
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
Diffstat (limited to 'src/plugins/cpptools/cpptoolstestcase.cpp')
-rw-r--r-- | src/plugins/cpptools/cpptoolstestcase.cpp | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/src/plugins/cpptools/cpptoolstestcase.cpp b/src/plugins/cpptools/cpptoolstestcase.cpp index 0102384aa8..271410bf4c 100644 --- a/src/plugins/cpptools/cpptoolstestcase.cpp +++ b/src/plugins/cpptools/cpptoolstestcase.cpp @@ -30,6 +30,8 @@ #include "cpptoolstestcase.h" +#include "cppworkingcopy.h" + #include <coreplugin/editormanager/editormanager.h> #include <projectexplorer/projectexplorer.h> #include <projectexplorer/session.h> @@ -214,18 +216,30 @@ bool TestCase::writeFile(const QString &filePath, const QByteArray &contents) return true; } -ProjectOpenerAndCloser::ProjectOpenerAndCloser() +ProjectOpenerAndCloser::ProjectOpenerAndCloser(bool waitForFinishedGcOnDestruction) + : m_waitForFinishedGcOnDestruction(waitForFinishedGcOnDestruction) + , m_gcFinished(false) { QVERIFY(!SessionManager::hasProjects()); + if (m_waitForFinishedGcOnDestruction) { + CppModelManager *mm = CppModelManager::instance(); + connect(mm, &CppModelManager::gcFinished, this, &ProjectOpenerAndCloser::onGcFinished); + } } ProjectOpenerAndCloser::~ProjectOpenerAndCloser() { foreach (Project *project, m_openProjects) ProjectExplorerPlugin::unloadProject(project); + + if (m_waitForFinishedGcOnDestruction) { + m_gcFinished = false; + while (!m_gcFinished) + QCoreApplication::processEvents(); + } } -ProjectInfo ProjectOpenerAndCloser::open(const QString &projectFile) +ProjectInfo ProjectOpenerAndCloser::open(const QString &projectFile, bool configureAsExampleProject) { QString error; Project *project = ProjectExplorerPlugin::openProject(projectFile, &error); @@ -235,12 +249,20 @@ ProjectInfo ProjectOpenerAndCloser::open(const QString &projectFile) return ProjectInfo(); m_openProjects.append(project); + if (configureAsExampleProject) + project->configureAsExampleProject(QStringList()); + if (TestCase::waitUntilCppModelManagerIsAwareOf(project)) return CppModelManager::instance()->projectInfo(project); return ProjectInfo(); } +void ProjectOpenerAndCloser::onGcFinished() +{ + m_gcFinished = true; +} + TemporaryCopiedDir::TemporaryCopiedDir(const QString &sourceDirPath) : m_temporaryDir(QDir::tempPath() + QLatin1String("/qtcreator-tests-XXXXXX")) , m_isValid(m_temporaryDir.isValid()) @@ -301,5 +323,18 @@ IAssistProposalScopedPointer::~IAssistProposalScopedPointer() delete d->model(); } +void VerifyCleanCppModelManager::verify() +{ + CppModelManager *mm = CppModelManager::instance(); + QVERIFY(mm); + QVERIFY(mm->projectInfos().isEmpty()); + QVERIFY(mm->headerPaths().isEmpty()); + QVERIFY(mm->definedMacros().isEmpty()); + QVERIFY(mm->projectFiles().isEmpty()); + QVERIFY(mm->snapshot().isEmpty()); + QCOMPARE(mm->workingCopy().size(), 1); + QVERIFY(mm->workingCopy().contains(mm->configurationFileName())); +} + } // namespace Tests } // namespace CppTools |