From 2174b1a34a0754376b77528161bf2328855cb0e7 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Wed, 4 Sep 2019 14:14:01 +0200 Subject: Add an initial test case for C++ documentation generated by QDoc This will be expanded later on. The minimal C++ project tests QDoc's HTML output for a module page, namespace and class reference, and some class members. Change-Id: Ifabc394116b675152d3ac95dc96a46e6e9c768ec Reviewed-by: Paul Wicking --- tests/auto/qdoc/generatedoutput/TestCPP | 1 + .../expected_output/testcpp-module.html | 42 +++++++++++++ .../expected_output/testqdoc-test-members.html | 19 ++++++ .../expected_output/testqdoc-test.html | 54 ++++++++++++++++ .../generatedoutput/expected_output/testqdoc.html | 61 ++++++++++++++++++ tests/auto/qdoc/generatedoutput/testcpp.cpp | 73 ++++++++++++++++++++++ tests/auto/qdoc/generatedoutput/testcpp.h | 39 ++++++++++++ tests/auto/qdoc/generatedoutput/testcpp.qdocconf | 7 +++ .../qdoc/generatedoutput/tst_generatedoutput.cpp | 10 +++ 9 files changed, 306 insertions(+) create mode 100644 tests/auto/qdoc/generatedoutput/TestCPP create mode 100644 tests/auto/qdoc/generatedoutput/expected_output/testcpp-module.html create mode 100644 tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test-members.html create mode 100644 tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test.html create mode 100644 tests/auto/qdoc/generatedoutput/expected_output/testqdoc.html create mode 100644 tests/auto/qdoc/generatedoutput/testcpp.cpp create mode 100644 tests/auto/qdoc/generatedoutput/testcpp.h create mode 100644 tests/auto/qdoc/generatedoutput/testcpp.qdocconf diff --git a/tests/auto/qdoc/generatedoutput/TestCPP b/tests/auto/qdoc/generatedoutput/TestCPP new file mode 100644 index 000000000..50cce69ff --- /dev/null +++ b/tests/auto/qdoc/generatedoutput/TestCPP @@ -0,0 +1 @@ +#include "testcpp.h" diff --git a/tests/auto/qdoc/generatedoutput/expected_output/testcpp-module.html b/tests/auto/qdoc/generatedoutput/expected_output/testcpp-module.html new file mode 100644 index 000000000..92103d867 --- /dev/null +++ b/tests/auto/qdoc/generatedoutput/expected_output/testcpp-module.html @@ -0,0 +1,42 @@ + + + + + + + QDoc Test C++ Classes | TestCPP + + + +

QDoc Test C++ Classes

+ + +

A test module page. More...

+ + +

Namespaces

+
+ +

TestQDoc

A namespace

+ +

Classes

+
+ +

TestQDoc::Test

A class in a namespace

+ + +
+

Detailed Description

+
+ + + diff --git a/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test-members.html b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test-members.html new file mode 100644 index 000000000..caa002a7d --- /dev/null +++ b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test-members.html @@ -0,0 +1,19 @@ + + + + + + + List of All Members for Test | TestCPP + + +
  • Test
  • + +

    List of All Members for Test

    +

    This is the complete list of members for TestQDoc::Test, including inherited members.

    + + + diff --git a/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test.html b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test.html new file mode 100644 index 000000000..f0ef69491 --- /dev/null +++ b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test.html @@ -0,0 +1,54 @@ + + + + + + + Test Class | TestCPP + + +
  • Test
  • + +

    Test Class

    +(TestQDoc::Test)
    + +

    A class in a namespace. More...

    + +
    +
    Header: #include <Test> +
    + +

    Public Functions

    +
    + + +
    void inlineFunction()
    int someFunction(int v)
    + + +
    +

    Detailed Description

    +
    + +
    +

    Member Function Documentation

    + +

    void Test::inlineFunction()

    +

    An inline function, documented using the \fn QDoc command.

    + + +

    int Test::someFunction(int v)

    +

    Function that takes a parameter v. Also returns the value of v.

    + +
    + + diff --git a/tests/auto/qdoc/generatedoutput/expected_output/testqdoc.html b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc.html new file mode 100644 index 000000000..d46a4f5c8 --- /dev/null +++ b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc.html @@ -0,0 +1,61 @@ + + + + + + + TestQDoc Namespace | TestCPP + + + +

    TestQDoc Namespace

    + +

    A namespace. More...

    + +
    +
    Header: #include <TestQDoc> +
    + +

    Classes

    +
    + +
    class Test
    + +

    Macros

    + + + +
    +

    Detailed Description

    + +

    Usage

    +

    This namespace is for testing QDoc output.

    +
    + +
    +

    Classes

    +

    class Test

    +

    A class in a namespace. More...

    + +
    +
    +

    Macro Documentation

    + +

    TestQDoc::QDOCTEST_MACRO

    + +
    + + diff --git a/tests/auto/qdoc/generatedoutput/testcpp.cpp b/tests/auto/qdoc/generatedoutput/testcpp.cpp new file mode 100644 index 000000000..12698c9d6 --- /dev/null +++ b/tests/auto/qdoc/generatedoutput/testcpp.cpp @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "testcpp.h" + +namespace TestQDoc { + +/*! + \module TestCPP + \title QDoc Test C++ Classes + \brief A test module page. +*/ + +/*! + \namespace TestQDoc + \inmodule TestCPP + \brief A namespace. + + \section1 Usage + This namespace is for testing QDoc output. +*/ + +/*! + \class TestQDoc::Test + \inmodule TestCPP + \brief A class in a namespace. +*/ + +/*! + \macro QDOCTEST_MACRO + \relates TestQDoc +*/ + +/*! + Function that takes a parameter \a v. + Also returns the value of \a v. +*/ +int Test::someFunction(int v) +{ + return v; +} + +/*! + \fn void TestQDoc::Test::inlineFunction() + + \brief An inline function, documented using the \CMDFN QDoc command. +*/ + +} // namespace TestQDoc diff --git a/tests/auto/qdoc/generatedoutput/testcpp.h b/tests/auto/qdoc/generatedoutput/testcpp.h new file mode 100644 index 000000000..46355711c --- /dev/null +++ b/tests/auto/qdoc/generatedoutput/testcpp.h @@ -0,0 +1,39 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#pragma once +#define QDOCTEST_MACRO test + +namespace TestQDoc { + +class Test { +public: + int someFunction(int v); + inline void inlineFunction() {}; +}; + +} // namespace TestQDoc diff --git a/tests/auto/qdoc/generatedoutput/testcpp.qdocconf b/tests/auto/qdoc/generatedoutput/testcpp.qdocconf new file mode 100644 index 000000000..70c226cf2 --- /dev/null +++ b/tests/auto/qdoc/generatedoutput/testcpp.qdocconf @@ -0,0 +1,7 @@ +project = TestCPP +includepaths += -I. + +headers = testcpp.h +sources = testcpp.cpp + +macro.CMDFN = \\\\fn diff --git a/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp b/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp index 01134517a..103198d42 100644 --- a/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp +++ b/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp @@ -38,6 +38,7 @@ private slots: void init(); void htmlFromQDocFile(); + void htmlFromCpp(); void htmlFromQml(); private: @@ -138,6 +139,15 @@ void tst_generatedOutput::htmlFromQDocFile() "qdoctests-qdocfileoutput.html"); } +void tst_generatedOutput::htmlFromCpp() +{ + testAndCompare("testcpp.qdocconf", + "testcpp-module.html " + "testqdoc-test.html " + "testqdoc-test-members.html " + "testqdoc.html"); +} + void tst_generatedOutput::htmlFromQml() { testAndCompare("testqml.qdocconf", -- cgit v1.2.3