summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cpptoolstestcase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/cpptools/cpptoolstestcase.cpp')
-rw-r--r--src/plugins/cpptools/cpptoolstestcase.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/plugins/cpptools/cpptoolstestcase.cpp b/src/plugins/cpptools/cpptoolstestcase.cpp
index 80de9dfc1d..e75df702d8 100644
--- a/src/plugins/cpptools/cpptoolstestcase.cpp
+++ b/src/plugins/cpptools/cpptoolstestcase.cpp
@@ -36,6 +36,14 @@
#include <QtTest>
+static bool closeEditorsWithoutGarbageCollectorInvocation(const QList<Core::IEditor *> &editors)
+{
+ CppTools::CppModelManagerInterface::instance()->enableGarbageCollector(false);
+ const bool closeEditorsSucceeded = Core::EditorManager::closeEditors(editors, false);
+ CppTools::CppModelManagerInterface::instance()->enableGarbageCollector(true);
+ return closeEditorsSucceeded;
+}
+
static bool snapshotContains(const CPlusPlus::Snapshot &snapshot, const QStringList &filePaths)
{
foreach (const QString &filePath, filePaths) {
@@ -80,7 +88,7 @@ TestCase::TestCase(bool runGarbageCollector)
TestCase::~TestCase()
{
- QVERIFY(Core::EditorManager::closeEditors(m_editorsToClose, false));
+ QVERIFY(closeEditorsWithoutGarbageCollectorInvocation(m_editorsToClose));
QCoreApplication::processEvents();
if (m_runGarbageCollector)
@@ -130,6 +138,11 @@ void TestCase::closeEditorAtEndOfTestCase(Core::IEditor *editor)
m_editorsToClose.append(editor);
}
+bool TestCase::closeEditorWithoutGarbageCollectorInvocation(Core::IEditor *editor)
+{
+ return closeEditorsWithoutGarbageCollectorInvocation(QList<Core::IEditor *>() << editor);
+}
+
CPlusPlus::Document::Ptr TestCase::waitForFileInGlobalSnapshot(const QString &filePath)
{
return waitForFilesInGlobalSnapshot(QStringList(filePath)).first();