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 @@
#include "cppmodelmanager.h"
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/plugintestutils.h>
#include <coreplugin/testdatadir.h>
#include <extensionsystem/pluginmanager.h>
#include <locator/locatorfiltertest.h>
......@@ -125,8 +126,7 @@ private:
virtual void doAfterLocatorRun()
{
EditorManager::closeEditor(m_editor, /*askAboutModifiedEditors=*/ false);
QCoreApplication::processEvents();
Core::Tests::closeAndDeleteEditor(m_editor);
QVERIFY(EditorManager::documentModel()->openedDocuments().isEmpty());
m_modelManager->GC();
QVERIFY(m_modelManager->snapshot().isEmpty());
......
......@@ -33,6 +33,7 @@
#include "modelmanagertesthelper.h"
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/plugintestutils.h>
#include <coreplugin/testdatadir.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/session.h>
......@@ -725,7 +726,7 @@ void CppToolsPlugin::test_modelmanager_gc_if_last_cppeditor_closed()
QVERIFY(mm->snapshot().contains(file));
// Close file/editor
Core::EditorManager::closeEditor(editor, /*askAboutModifiedEditors=*/ false);
Core::Tests::closeAndDeleteEditor(editor);
helper.waitForFinishedGc();
// Check: File is removed from the snapshpt
......@@ -762,7 +763,7 @@ void CppToolsPlugin::test_modelmanager_dont_gc_opened_files()
QVERIFY(mm->snapshot().contains(file));
// Close editor
Core::EditorManager::closeEditors(QList<Core::IEditor*>() << editor);
Core::Tests::closeAndDeleteEditor(editor);
helper.waitForFinishedGc();
QVERIFY(mm->snapshot().isEmpty());
}
......@@ -34,6 +34,7 @@
#else
#include "formeditorw.h"
#include <coreplugin/plugintestutils.h>
#include <coreplugin/testdatadir.h>
#include <coreplugin/editormanager/editormanager.h>
#include <cpptools/cppmodelmanager.h>
......@@ -134,7 +135,10 @@ public:
private:
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());
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