diff options
author | Knut Petter Svendsen <knutpett@pvv.org> | 2013-02-21 05:45:44 +0100 |
---|---|---|
committer | David Schulz <david.schulz@digia.com> | 2013-02-21 13:34:25 +0100 |
commit | c937226db1c3c2d98e4a73d7dacde8e35d8cbc1c (patch) | |
tree | ab5f30bb19d4e17c1854615c4bba35a07aa1a925 /src/plugins/cppeditor/cppdoxygen_test.cpp | |
parent | 8d2f40609263396e7809c608c52fd2c8713db668 (diff) |
C++: Improved automatic Doxygen comment blocks with CppStyle
Added support for CppStyle for Doxygen block generation when
hitting enter after a /// or //! comment. Previously only
QtStyle and JavaStyle was supported.
Change-Id: Ib010e55ba602127a6842ba02034fbe85994ee2bd
Reviewed-by: David Schulz <david.schulz@digia.com>
Diffstat (limited to 'src/plugins/cppeditor/cppdoxygen_test.cpp')
-rw-r--r-- | src/plugins/cppeditor/cppdoxygen_test.cpp | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/src/plugins/cppeditor/cppdoxygen_test.cpp b/src/plugins/cppeditor/cppdoxygen_test.cpp index d72c9fde98..a46109cfb3 100644 --- a/src/plugins/cppeditor/cppdoxygen_test.cpp +++ b/src/plugins/cppeditor/cppdoxygen_test.cpp @@ -40,7 +40,9 @@ #include <QKeyEvent> #include <QString> #include <QTextDocument> +#ifdef WITH_TESTS #include <QtTest> +#endif /*! @@ -221,3 +223,124 @@ void CppPlugin::test_doxygen_comments_java_style_continuation() TestCase data(given); data.run(expected); } + +void CppPlugin::test_doxygen_comments_cpp_styleA() +{ + const QByteArray given = + "bool preventFolding;\n" + "///|\n" + "int a;\n" + ; + + const QByteArray expected = + "bool preventFolding;\n" + "///\n" + "/// \\brief a\n" + "///\n" + "int a;\n" + ; + TestCase data(given); + data.run(expected); +} + +void CppPlugin::test_doxygen_comments_cpp_styleB() +{ + const QByteArray given = + "bool preventFolding;\n" + "//!|\n" + "int a;\n" + ; + + const QByteArray expected = + "bool preventFolding;\n" + "//!\n" + "//! \\brief a\n" + "//!\n" + "int a;\n" + ; + TestCase data(given); + data.run(expected); +} + +void CppPlugin::test_doxygen_comments_cpp_styleA_continuation() +{ + const QByteArray given = + "bool preventFolding;\n" + "///\n" + "/// \\brief a|\n" + "///\n" + "int a;\n" + ; + const QByteArray expected = + "bool preventFolding;\n" + "///\n" + "/// \\brief a\n" + "///\n" + "///\n" + "int a;\n" + ; + + TestCase data(given); + data.run(expected); +} + +/// test cpp style doxygen comment when inside a indented scope +void CppPlugin::test_doxygen_comments_cpp_styleA_indented() +{ + const QByteArray given = + " bool preventFolding;\n" + " ///|\n" + " int a;\n" + ; + + const QByteArray expected = + " bool preventFolding;\n" + " ///\n" + " /// \\brief a\n" + " ///\n" + " int a;\n" + ; + TestCase data(given); + data.run(expected); +} + +/// test cpp style doxygen comment continuation when inside a indented scope +void CppPlugin::test_doxygen_comments_cpp_styleA_indented_continuation() +{ + const QByteArray given = + " bool preventFolding;\n" + " ///\n" + " /// \\brief a|\n" + " ///\n" + " int a;\n" + ; + const QByteArray expected = + " bool preventFolding;\n" + " ///\n" + " /// \\brief a\n" + " ///\n" + " ///\n" + " int a;\n" + ; + + TestCase data(given); + data.run(expected); +} + +void CppPlugin::test_doxygen_comments_cpp_styleA_corner_case() +{ + const QByteArray given = + "bool preventFolding;\n" + "///\n" + "void d(); ///|\n" + ; + const QByteArray expected = + "bool preventFolding;\n" + "///\n" + "void d(); ///\n" + "\n" + ; + + TestCase data(given); + data.run(expected); +} |