CppEditor: Fix tests

Amends 35fcd96b85.

Change-Id: I0fe016f0d801922d847858de374e1a95f7a2bb0c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2021-08-19 17:55:54 +02:00
parent e0e8fda580
commit e5eee745ea

View File

@@ -35,6 +35,7 @@
#include <cpptools/cppsemanticinfo.h>
#include <cpptools/cpptoolsreuse.h>
#include <cplusplus/CppDocument.h>
#include <texteditor/storagesettings.h>
#include <QDir>
@@ -96,8 +97,12 @@ void TestCase::setUseClangd()
bool TestCase::openCppEditor(const QString &fileName, CppEditor **editor, CppEditorWidget **editorWidget)
{
if (CppEditor *e = dynamic_cast<CppEditor *>(Core::EditorManager::openEditor(fileName))) {
if (editor)
if (editor) {
*editor = e;
TextEditor::StorageSettings s = e->textDocument()->storageSettings();
s.m_addFinalNewLine = false;
e->textDocument()->setStorageSettings(s);
}
if (editorWidget) {
if (CppEditorWidget *w = dynamic_cast<CppEditorWidget *>(e->editorWidget())) {
*editorWidget = w;