diff options
author | Eike Ziller <eike.ziller@qt.io> | 2024-02-29 12:44:58 +0100 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2024-02-29 12:44:58 +0100 |
commit | 6c2df76737b49019d51eda0fd757f0721d3e7d82 (patch) | |
tree | b3d5fbebcc28f57c7f57c041a634590e6b152582 /src/plugins/cppeditor | |
parent | 5af531cd39067366cea627e3db1a0b83d7172873 (diff) | |
parent | 49ab0c41097cb9165274cc4daad651133547794e (diff) |
Merge remote-tracking branch 'origin/13.0'
Conflicts:
src/plugins/android/androidsettingswidget.cpp
Change-Id: Ifcb16aa16c7bc2792de25d0ee7a22cf0e39a05f8
Diffstat (limited to 'src/plugins/cppeditor')
-rw-r--r-- | src/plugins/cppeditor/cpphighlighter.cpp | 21 | ||||
-rw-r--r-- | src/plugins/cppeditor/cpptoolstestcase.cpp | 14 | ||||
-rw-r--r-- | src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp | 11 |
3 files changed, 23 insertions, 23 deletions
diff --git a/src/plugins/cppeditor/cpphighlighter.cpp b/src/plugins/cppeditor/cpphighlighter.cpp index 591881c6c5..becebd1188 100644 --- a/src/plugins/cppeditor/cpphighlighter.cpp +++ b/src/plugins/cppeditor/cpphighlighter.cpp @@ -242,27 +242,6 @@ void CppHighlighter::highlightBlock(const QString &text) TextDocumentLayout::setFoldingIndent(currentBlock(), foldingIndent); - // optimization: if only the brace depth changes, we adjust subsequent blocks - // to have QSyntaxHighlighter stop the rehighlighting - int currentState = currentBlockState(); - if (currentState != -1) { - int oldState = currentState & 0xff; - int oldBraceDepth = currentState >> 8; - if (oldState == tokenize.state() && oldBraceDepth != braceDepth) { - TextDocumentLayout::FoldValidator foldValidor; - foldValidor.setup(qobject_cast<TextDocumentLayout *>(document()->documentLayout())); - int delta = braceDepth - oldBraceDepth; - QTextBlock block = currentBlock().next(); - while (block.isValid() && block.userState() != -1) { - TextDocumentLayout::changeBraceDepth(block, delta); - TextDocumentLayout::changeFoldingIndent(block, delta); - foldValidor.process(block); - block = block.next(); - } - foldValidor.finalize(); - } - } - setCurrentBlockState((braceDepth << 8) | tokenize.state()); TextDocumentLayout::setExpectedRawStringSuffix(currentBlock(), tokenize.expectedRawStringSuffix()); diff --git a/src/plugins/cppeditor/cpptoolstestcase.cpp b/src/plugins/cppeditor/cpptoolstestcase.cpp index 37b5d855d0..a55895affc 100644 --- a/src/plugins/cppeditor/cpptoolstestcase.cpp +++ b/src/plugins/cppeditor/cpptoolstestcase.cpp @@ -20,10 +20,11 @@ #include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectmanager.h> -#include <texteditor/texteditor.h> #include <texteditor/codeassist/iassistproposal.h> #include <texteditor/codeassist/iassistproposalmodel.h> #include <texteditor/storagesettings.h> +#include <texteditor/syntaxhighlighterrunner.h> +#include <texteditor/texteditor.h> #include <utils/environment.h> #include <utils/fileutils.h> @@ -221,6 +222,17 @@ bool TestCase::openCppEditor(const FilePath &filePath, TextEditor::BaseTextEdito s.m_addFinalNewLine = false; e->textDocument()->setStorageSettings(s); } + + if (!QTest::qWaitFor( + [e] { + return e->editorWidget() + ->textDocument() + ->syntaxHighlighterRunner() + ->syntaxInfoUpdated(); + }, + 5000)) + return false; + if (editorWidget) { if (CppEditorWidget *w = dynamic_cast<CppEditorWidget *>(e->editorWidget())) { *editorWidget = w; diff --git a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp index d18e8dc391..9bef50b0b8 100644 --- a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp +++ b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp @@ -396,6 +396,12 @@ F2TestCase::F2TestCase(CppEditorAction action, BaseTextEditor *currentTextEditor = dynamic_cast<BaseTextEditor*>(currentEditor); QVERIFY(currentTextEditor); + if (useClangd) { + QEXPECT_FAIL("matchFunctionSignatureFuzzy1Forward", "clangd returns decl loc", Abort); + QEXPECT_FAIL("matchFunctionSignatureFuzzy2Forward", "clangd returns decl loc", Abort); + QEXPECT_FAIL("matchFunctionSignatureFuzzy1Backward", "clangd returns def loc", Abort); + QEXPECT_FAIL("matchFunctionSignatureFuzzy2Backward", "clangd returns def loc", Abort); + } QCOMPARE(currentTextEditor->document()->filePath(), targetTestFile->filePath()); int expectedLine, expectedColumn; if (useClangd && expectedVirtualFunctionProposal.size() == 1) { @@ -494,8 +500,11 @@ void FollowSymbolTest::initTestCase() return; // Find suitable kit. + // Qt is not actually required for the tests, but we need it for consistency with + // configureAsExampleProject(). + // FIXME: Make configureAsExampleProject() work with non-Qt kits. F2TestCase::m_testKit = Utils::findOr(KitManager::kits(), nullptr, [](const Kit *k) { - return k->isValid(); + return k->isValid() && !k->hasWarning() && k->value("QtSupport.QtInformation").isValid(); }); if (!F2TestCase::m_testKit) QSKIP("This test requires at least one kit to be present"); |