Commit 447c4ed3 authored by Nikolai Kosjar's avatar Nikolai Kosjar

CppEditor/CppTools: Fix plugin tests in master.

Change-Id: Ia641c70f8c72cf762cf571cdd505385d28492b7c
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@digia.com>
parent a0b2d108
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "cppmodelmanager.h" #include "cppmodelmanager.h"
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/plugintestutils.h>
#include <coreplugin/testdatadir.h> #include <coreplugin/testdatadir.h>
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <locator/locatorfiltertest.h> #include <locator/locatorfiltertest.h>
...@@ -125,8 +126,7 @@ private: ...@@ -125,8 +126,7 @@ private:
virtual void doAfterLocatorRun() virtual void doAfterLocatorRun()
{ {
EditorManager::closeEditor(m_editor, /*askAboutModifiedEditors=*/ false); Core::Tests::closeAndDeleteEditor(m_editor);
QCoreApplication::processEvents();
QVERIFY(EditorManager::documentModel()->openedDocuments().isEmpty()); QVERIFY(EditorManager::documentModel()->openedDocuments().isEmpty());
m_modelManager->GC(); m_modelManager->GC();
QVERIFY(m_modelManager->snapshot().isEmpty()); QVERIFY(m_modelManager->snapshot().isEmpty());
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "modelmanagertesthelper.h" #include "modelmanagertesthelper.h"
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/plugintestutils.h>
#include <coreplugin/testdatadir.h> #include <coreplugin/testdatadir.h>
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
#include <projectexplorer/session.h> #include <projectexplorer/session.h>
...@@ -725,7 +726,7 @@ void CppToolsPlugin::test_modelmanager_gc_if_last_cppeditor_closed() ...@@ -725,7 +726,7 @@ void CppToolsPlugin::test_modelmanager_gc_if_last_cppeditor_closed()
QVERIFY(mm->snapshot().contains(file)); QVERIFY(mm->snapshot().contains(file));
// Close file/editor // Close file/editor
Core::EditorManager::closeEditor(editor, /*askAboutModifiedEditors=*/ false); Core::Tests::closeAndDeleteEditor(editor);
helper.waitForFinishedGc(); helper.waitForFinishedGc();
// Check: File is removed from the snapshpt // Check: File is removed from the snapshpt
...@@ -762,7 +763,7 @@ void CppToolsPlugin::test_modelmanager_dont_gc_opened_files() ...@@ -762,7 +763,7 @@ void CppToolsPlugin::test_modelmanager_dont_gc_opened_files()
QVERIFY(mm->snapshot().contains(file)); QVERIFY(mm->snapshot().contains(file));
// Close editor // Close editor
Core::EditorManager::closeEditors(QList<Core::IEditor*>() << editor); Core::Tests::closeAndDeleteEditor(editor);
helper.waitForFinishedGc(); helper.waitForFinishedGc();
QVERIFY(mm->snapshot().isEmpty()); QVERIFY(mm->snapshot().isEmpty());
} }
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#else #else
#include "formeditorw.h" #include "formeditorw.h"
#include <coreplugin/plugintestutils.h>
#include <coreplugin/testdatadir.h> #include <coreplugin/testdatadir.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <cpptools/cppmodelmanager.h> #include <cpptools/cppmodelmanager.h>
...@@ -134,7 +135,10 @@ public: ...@@ -134,7 +135,10 @@ public:
private: private:
void cleanup() void cleanup()
{ {
EditorManager::closeAllEditors(/*askAboutModifiedEditors =*/ false); DocumentModel *documentModel = EditorManager::documentModel();
const QList<IDocument *> documents = documentModel->openedDocuments();
const QList<IEditor *> editors = documentModel->editorsForDocuments(documents);
Core::Tests::closeAndDeleteEditors(editors);
QVERIFY(EditorManager::documentModel()->openedDocuments().isEmpty()); QVERIFY(EditorManager::documentModel()->openedDocuments().isEmpty());
m_modelManager->GC(); m_modelManager->GC();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment