CppEditor: Add test case for quickfix formatting

Also fixes an off-by-one error in the formatting code that was uncovered
by the test.

Change-Id: I013194e21cf37f318bb806bb60ea659b91b99fbf
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Christian Kandeler
2023-06-28 12:47:38 +02:00
parent 379e7f906e
commit bcd49bafdd
5 changed files with 78 additions and 7 deletions

View File

@@ -26,8 +26,8 @@ public:
/// Exactly one QuickFixTestDocument must contain the cursor position marker '@'
/// or "@{start}" and "@{end}"
BaseQuickFixTestCase(const QList<TestDocumentPtr> &testDocuments,
const ProjectExplorer::HeaderPaths &headerPaths
= ProjectExplorer::HeaderPaths());
const ProjectExplorer::HeaderPaths &headerPaths,
const QByteArray &clangFormatSettings = {});
~BaseQuickFixTestCase();
@@ -54,7 +54,8 @@ public:
const ProjectExplorer::HeaderPaths &headerPaths
= ProjectExplorer::HeaderPaths(),
int operationIndex = 0,
const QByteArray &expectedFailMessage = QByteArray());
const QByteArray &expectedFailMessage = {},
const QByteArray &clangFormatSettings = {});
static void run(const QList<TestDocumentPtr> &testDocuments,
CppQuickFixFactory *factory,
@@ -139,6 +140,7 @@ private slots:
void testInsertDefFromDeclAliasTemplateAsReturnType();
void testInsertDefsFromDecls_data();
void testInsertDefsFromDecls();
void testInsertAndFormatDefsFromDecls();
void testInsertDeclFromDef();
void testInsertDeclFromDefTemplateFuncTypename();