From 447c4ed37f8904ca733d6e6253ad19bb0388f209 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar <nikolai.kosjar@digia.com> Date: Mon, 30 Sep 2013 12:24:58 +0200 Subject: [PATCH] CppEditor/CppTools: Fix plugin tests in master. Change-Id: Ia641c70f8c72cf762cf571cdd505385d28492b7c Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com> --- src/plugins/cpptools/cpplocatorfilter_test.cpp | 4 ++-- src/plugins/cpptools/cppmodelmanager_test.cpp | 5 +++-- src/plugins/designer/gotoslot_test.cpp | 6 +++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/plugins/cpptools/cpplocatorfilter_test.cpp b/src/plugins/cpptools/cpplocatorfilter_test.cpp index cd8768192b3..a72b2eef25f 100644 --- a/src/plugins/cpptools/cpplocatorfilter_test.cpp +++ b/src/plugins/cpptools/cpplocatorfilter_test.cpp @@ -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()); diff --git a/src/plugins/cpptools/cppmodelmanager_test.cpp b/src/plugins/cpptools/cppmodelmanager_test.cpp index 8f4f5883909..7482cd32224 100644 --- a/src/plugins/cpptools/cppmodelmanager_test.cpp +++ b/src/plugins/cpptools/cppmodelmanager_test.cpp @@ -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()); } diff --git a/src/plugins/designer/gotoslot_test.cpp b/src/plugins/designer/gotoslot_test.cpp index ef9ed568280..91856a98526 100644 --- a/src/plugins/designer/gotoslot_test.cpp +++ b/src/plugins/designer/gotoslot_test.cpp @@ -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(); -- GitLab