Debugger: Restructure cleaning up after test

If the test case would result in a failing test it does not
execute further commands.
Ensure to close possible open editors even for failed test runs.

Change-Id: Ifcdcb76de5d10f649d38b84dad8999c6fd491ade
Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
Christian Stenger
2016-05-18 07:33:52 +02:00
parent 3c63b621d9
commit 8daaa2f651

View File

@@ -163,6 +163,8 @@
#include <cpptools/cpptoolstestcase.h>
#include <cpptools/projectinfo.h>
#include <utils/executeondestruction.h>
#include <QTest>
#include <QSignalSpy>
#include <QTestEventLoop>
@@ -3675,6 +3677,9 @@ void DebuggerUnitTests::testStateMachine()
ProjectExplorerPlugin::buildProject(SessionManager::startupProject());
loop.exec();
ExecuteOnDestruction guard([] () {
EditorManager::closeAllEditors(false);
});
DebuggerRunParameters rp;
Target *t = SessionManager::startupProject()->activeTarget();
QVERIFY(t);
@@ -3691,7 +3696,6 @@ void DebuggerUnitTests::testStateMachine()
});
QTestEventLoop::instance().enterLoop(5);
EditorManager::closeAllEditors(false);
}