[ClangFormat] Add test checkking indentation after Q_OBJECT

Added test checking behavior when after Q_OBJECT all class structure
have correct indenting and redundent tabs doesn't appear before key words
such as  public:, private: , etc.
Made automatic addition Qt defines to StatementMacro to .clang-format files.

Fixes: QTCREATORBUG-26776
Change-Id: I3490421a9caf2831b593939597940358f7ce8f01
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Artem Sokolovskii
2022-01-11 13:18:29 +01:00
parent 8a29a78ebf
commit ab5fdd94f3
5 changed files with 43 additions and 8 deletions

View File

@@ -646,4 +646,12 @@ void ClangFormatTest::testCommentBlock()
"****************************************************************************/"}));
}
void ClangFormatTest::testClassIndentStructure()
{
insertLines({"class test {", " Q_OBJECT", " public:", "};"});
m_indenter->indent(*m_cursor, QChar::Null, TextEditor::TabSettings());
QCOMPARE(documentLines(),
(std::vector<QString>{"class test {", " Q_OBJECT", "public:", "};"}));
}
} // namespace ClangFormat::Internal