forked from qt-creator/qt-creator
CppEditor: Fix completion tests
Amends 2c91d4b472
.
Change-Id: I6c4e8bc359acd2cd413fe86c1217ccce5321fa1e
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -63,10 +63,6 @@ public:
|
||||
m_editor = EditorManager::openEditor(filePath);
|
||||
QVERIFY(m_editor);
|
||||
|
||||
TextEditor::BaseTextEditor *cppEditor = qobject_cast<TextEditor::BaseTextEditor *>(m_editor);
|
||||
QVERIFY(cppEditor);
|
||||
QTRY_VERIFY(cppEditor->textDocument()->syntaxHighlighterRunner()->syntaxInfoUpdated());
|
||||
|
||||
closeEditorAtEndOfTestCase(m_editor);
|
||||
m_editorWidget = TextEditorWidget::fromEditor(m_editor);
|
||||
QVERIFY(m_editorWidget);
|
||||
@@ -145,6 +141,19 @@ public:
|
||||
m_position += text.length();
|
||||
}
|
||||
|
||||
bool waitForSyntaxHighlighting()
|
||||
{
|
||||
TextEditor::BaseTextEditor *cppEditor = qobject_cast<TextEditor::BaseTextEditor *>(m_editor);
|
||||
if (!cppEditor)
|
||||
return false;
|
||||
if (cppEditor->textDocument()->syntaxHighlighterRunner()->syntaxInfoUpdated())
|
||||
return true;
|
||||
return ::CppEditor::Tests::waitForSignalOrTimeout(
|
||||
cppEditor->textDocument()->syntaxHighlighterRunner(),
|
||||
&BaseSyntaxHighlighterRunner::highlightingFinished,
|
||||
5000);
|
||||
}
|
||||
|
||||
private:
|
||||
QByteArray m_source;
|
||||
int m_position = -1;
|
||||
@@ -410,6 +419,7 @@ void CompletionTest::testDoxygenTagCompletion()
|
||||
|
||||
CompletionTestCase test(code, prefix);
|
||||
QVERIFY(test.succeededSoFar());
|
||||
QVERIFY(test.waitForSyntaxHighlighting());
|
||||
const QStringList completions = test.getCompletions();
|
||||
QVERIFY(isDoxygenTagCompletion(completions));
|
||||
}
|
||||
|
Reference in New Issue
Block a user