forked from qt-creator/qt-creator
CppEditor: Fix "testInsertAndFormatDefsFromDecls" test
Amends 240748c106.
Change-Id: I13a4eb28737636dbb5f5f5c1c7ab771a4518a701
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -7,9 +7,6 @@
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <cppeditor/cppcodestylepreferences.h>
|
||||
#include <cppeditor/cpptoolssettings.h>
|
||||
|
||||
#include <projectexplorer/editorconfiguration.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectmanager.h>
|
||||
@@ -565,14 +562,6 @@ Utils::ChangeSet ClangFormatBaseIndenter::replacements(QByteArray buffer,
|
||||
Utils::EditOperations ClangFormatBaseIndenter::format(const TextEditor::RangesInLines &rangesInLines,
|
||||
FormattingMode mode)
|
||||
{
|
||||
bool doFormatting = mode == FormattingMode::Forced || formatCodeInsteadOfIndent();
|
||||
#ifdef WITH_TESTS
|
||||
doFormatting = doFormatting || CppEditor::CppToolsSettings::cppCodeStyle()
|
||||
->codeStyleSettings().forceFormatting;
|
||||
#endif
|
||||
if (!doFormatting)
|
||||
return {};
|
||||
|
||||
QTC_ASSERT(!m_fileName.isEmpty(), return {});
|
||||
if (rangesInLines.empty())
|
||||
return {};
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <cppeditor/cppcodestylepreferences.h>
|
||||
#include <cppeditor/cppcodestylepreferencesfactory.h>
|
||||
#include <cppeditor/cpptoolssettings.h>
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <extensionsystem/pluginspec.h>
|
||||
@@ -61,6 +63,10 @@ ClangFormatIndenter::ClangFormatIndenter(QTextDocument *doc)
|
||||
|
||||
bool ClangFormatIndenter::formatCodeInsteadOfIndent() const
|
||||
{
|
||||
#ifdef WITH_TESTS
|
||||
if (CppEditor::CppToolsSettings::cppCodeStyle()->codeStyleSettings().forceFormatting)
|
||||
return true;
|
||||
#endif
|
||||
return getCurrentIndentationOrFormattingSettings(m_fileName)
|
||||
== ClangFormatSettings::Mode::Formatting;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user