CppEditor/CppTools: Fix plugin tests.

Starting with commit 243a625 EditorManager::closeEditors() does not
delete the editors anymore, but calls deleteLater(). When the call
returns, all kind of checks fail since the editor widget destructor was
not yet called.

Fixed by providing and calling Core::Tests::closeAndDeleteEditors(),
which explicitly sends QEvent::DeferredDelete to the widget.

Change-Id: I3287abbe74ccf7d7a18b997a847701c8be17cb55
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
Nikolai Kosjar
2013-09-27 15:58:50 +02:00
parent a12a9f491c
commit d9602ca550
8 changed files with 124 additions and 8 deletions

View File

@@ -34,6 +34,7 @@
#include "cppquickfixassistant.h"
#include "cppquickfixes.h"
#include <coreplugin/plugintestutils.h>
#include <cpptools/cppcodestylepreferences.h>
#include <cpptools/cppmodelmanager.h>
#include <cpptools/cpppreprocessor.h>
@@ -237,6 +238,7 @@ void TestCase::init(const QStringList &includePaths)
// Rehighlight
testFile->editorWidget->semanticRehighlight(true);
// Wait for the semantic info from the future
while (testFile->editorWidget->semanticInfo().doc.isNull())
QCoreApplication::processEvents();
@@ -262,8 +264,7 @@ TestCase::~TestCase()
if (testFile->editor)
editorsToClose << testFile->editor;
}
EditorManager::instance()->closeEditors(editorsToClose, false);
QCoreApplication::processEvents(); // process any pending events
Core::Tests::closeAndDeleteEditors(editorsToClose);
// Remove the test files from the code-model
CppModelManagerInterface *mmi = CppModelManagerInterface::instance();