diff options
Diffstat (limited to 'tests/auto/qdoc')
11 files changed, 113 insertions, 217 deletions
diff --git a/tests/auto/qdoc/generatedoutput/expected_output/testcpp-module.html b/tests/auto/qdoc/generatedoutput/expected_output/testcpp-module.html index 92103d867..fc05a8d14 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/testcpp-module.html +++ b/tests/auto/qdoc/generatedoutput/expected_output/testcpp-module.html @@ -31,6 +31,7 @@ <h2 id="classes">Classes</h2> <div class="table"><table class="annotated"> <tr class="odd topAlign"><td class="tblName"><p><a href="testqdoc-test.html">TestQDoc::Test</a></p></td><td class="tblDescr"><p>A class in a namespace</p></td></tr> +<tr class="even topAlign"><td class="tblName"><p><a href="testqdoc-testderived.html">TestQDoc::TestDerived</a></p></td><td class="tblDescr"><p>A derived class in a namespace</p></td></tr> </table></div> <!-- $$$TestCPP-description --> <a name="details"></a> diff --git a/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test-members.html b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test-members.html index 2c0b9b24f..a52123a32 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test-members.html +++ b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test-members.html @@ -15,6 +15,7 @@ <li class="fn"><span class="name"><b><a href="testqdoc-test.html#inlineFunction">inlineFunction</a></b></span>()</li> <li class="fn"><span class="name"><b><a href="testqdoc-test.html#someFunction">someFunction</a></b></span>(int ) : int</li> <li class="fn"><span class="name"><b><a href="testqdoc-test.html#someFunctionDefaultArg">someFunctionDefaultArg</a></b></span>(int , bool )</li> +<li class="fn"><span class="name"><b><a href="testqdoc-test.html#virtualFun">virtualFun</a></b></span>()</li> </ul> </body> </html> diff --git a/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test.html b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test.html index bf7ba3307..32fb9efa0 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test.html +++ b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-test.html @@ -25,7 +25,8 @@ <!-- @@@Test --> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <Test></span> -</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += testcpp</td></tr></table></div><ul> +</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += testcpp</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherited By:</td><td class="memItemRight bottomAlign"> <p><a href="testqdoc-testderived.html">TestQDoc::TestDerived</a></p> +</td></tr></table></div><ul> <li><a href="testqdoc-test-members.html">List of all members, including inherited members</a></li> <li><a href="testqdoc-test-obsolete.html">Obsolete members</a></li> </ul> @@ -35,6 +36,7 @@ <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="testqdoc-test.html#inlineFunction">inlineFunction</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="testqdoc-test.html#someFunction">someFunction</a></b>(int <i>v</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="testqdoc-test.html#someFunctionDefaultArg">someFunctionDefaultArg</a></b>(int <i>i</i>, bool <i>b</i> = false)</td></tr> +<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="testqdoc-test.html#virtualFun">virtualFun</a></b>()</td></tr> </table></div> <a name="macros"></a> <h2 id="macros">Macros</h2> @@ -61,6 +63,10 @@ <h3 class="fn" id="someFunctionDefaultArg"><a name="someFunctionDefaultArg"></a><span class="type">void</span> Test::<span class="name">someFunctionDefaultArg</span>(<span class="type">int</span> <i>i</i>, <span class="type">bool</span> <i>b</i> = false)</h3> <p>Function that takes a parameter <i>i</i> and <i>b</i>.</p> <!-- @@@someFunctionDefaultArg --> +<!-- $$$virtualFun[overload1]$$$virtualFun --> +<h3 class="fn" id="virtualFun"><a name="virtualFun"></a><code>[virtual] </code><span class="type">void</span> Test::<span class="name">virtualFun</span>()</h3> +<p>Function that must be reimplemented.</p> +<!-- @@@virtualFun --> </div> <div class="macros"> <h2>Macro Documentation</h2> diff --git a/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-testderived-members.html b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-testderived-members.html new file mode 100644 index 000000000..f5adf249c --- /dev/null +++ b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-testderived-members.html @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html> +<html lang="en"> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<!-- testcpp.cpp --> + <title>List of All Members for TestDerived | TestCPP</title> +</head> +<body> +<li>TestDerived</li> +<div class="sidebar"><div class="sidebar-content" id="sidebar-content"></div></div> +<h1 class="title">List of All Members for TestDerived</h1> +<p>This is the complete list of members for <a href="testqdoc-testderived.html">TestQDoc::TestDerived</a>, including inherited members.</p> +<ul> +<li class="fn"><span class="name"><b><a href="testqdoc-test.html#QDOCTEST_MACRO2">QDOCTEST_MACRO2</a></b></span>()</li> +<li class="fn"><span class="name"><b><a href="testqdoc-test.html#inlineFunction">inlineFunction</a></b></span>()</li> +<li class="fn"><span class="name"><b><a href="testqdoc-test.html#someFunction">someFunction</a></b></span>(int ) : int</li> +<li class="fn"><span class="name"><b><a href="testqdoc-test.html#someFunctionDefaultArg">someFunctionDefaultArg</a></b></span>(int , bool )</li> +<li class="fn"><span class="name"><b><a href="testqdoc-testderived.html#virtualFun">virtualFun</a></b></span>()</li> +</ul> +</body> +</html> diff --git a/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-testderived.html b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-testderived.html new file mode 100644 index 000000000..a5478fc66 --- /dev/null +++ b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc-testderived.html @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html> +<html lang="en"> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<!-- testcpp.cpp --> + <title>TestDerived Class | TestCPP</title> +</head> +<body> +<li>TestDerived</li> +<div class="sidebar"> +<div class="toc"> +<h3><a name="toc">Contents</a></h3> +<ul> +<li class="level1"><a href="#reimplemented-public-functions">Reimplemented Public Functions</a></li> +<li class="level1"><a href="#details">Detailed Description</a></li> +</ul> +</div> +<div class="sidebar-content" id="sidebar-content"></div></div> +<h1 class="title">TestDerived Class</h1> +<span class="small-subtitle">(<a href="testqdoc-testderived.html">TestQDoc::TestDerived</a>)<br/></span> +<!-- $$$TestDerived-brief --> +<p>A derived class in a namespace. <a href="#details">More...</a></p> +<!-- @@@TestDerived --> +<div class="table"><table class="alignedsummary"> +<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <TestDerived></span> +</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += testcpp</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="testqdoc-test.html">TestQDoc::Test</a></td></tr></table></div><ul> +<li><a href="testqdoc-testderived-members.html">List of all members, including inherited members</a></li> +</ul> +<a name="reimplemented-public-functions"></a> +<h2 id="reimplemented-public-functions">Reimplemented Public Functions</h2> +<div class="table"><table class="alignedsummary"> +<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="testqdoc-testderived.html#virtualFun">virtualFun</a></b>() override</td></tr> +</table></div> +<a name="details"></a> +<!-- $$$TestDerived-description --> +<div class="descr"> +<h2 id="details">Detailed Description</h2> +</div> +<!-- @@@TestDerived --> +<div class="func"> +<h2>Member Function Documentation</h2> +<!-- $$$virtualFun[overload1]$$$virtualFun --> +<h3 class="fn" id="virtualFun"><a name="virtualFun"></a><code>[override virtual] </code><span class="type">void</span> TestDerived::<span class="name">virtualFun</span>()</h3> +<p>Reimplements: <a href="testqdoc-test.html#virtualFun">Test::virtualFun</a>().</p> +<!-- @@@virtualFun --> +</div> +</body> +</html> diff --git a/tests/auto/qdoc/generatedoutput/expected_output/testqdoc.html b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc.html index baa0d9a65..94ef710fc 100644 --- a/tests/auto/qdoc/generatedoutput/expected_output/testqdoc.html +++ b/tests/auto/qdoc/generatedoutput/expected_output/testqdoc.html @@ -30,6 +30,7 @@ <h2 id="classes">Classes</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> class </td><td class="memItemRight bottomAlign"><b><a href="testqdoc-test.html">Test</a></b></td></tr> +<tr><td class="memItemLeft rightAlign topAlign"> class </td><td class="memItemRight bottomAlign"><b><a href="testqdoc-testderived.html">TestDerived</a></b></td></tr> </table></div> <a name="macros"></a> <h2 id="macros">Macros</h2> @@ -50,6 +51,9 @@ <h3> class <a href="testqdoc-test.html">Test</a></h3><!-- $$$Test-brief --> <p>A class in a namespace. <a href="testqdoc-test.html#details">More...</a></p> <!-- @@@Test --> +<h3> class <a href="testqdoc-testderived.html">TestDerived</a></h3><!-- $$$TestDerived-brief --> +<p>A derived class in a namespace. <a href="testqdoc-testderived.html#details">More...</a></p> +<!-- @@@TestDerived --> </div> <div class="macros"> <h2>Macro Documentation</h2> diff --git a/tests/auto/qdoc/generatedoutput/testcpp.cpp b/tests/auto/qdoc/generatedoutput/testcpp.cpp index 3ed4dc0bd..3277d496d 100644 --- a/tests/auto/qdoc/generatedoutput/testcpp.cpp +++ b/tests/auto/qdoc/generatedoutput/testcpp.cpp @@ -53,6 +53,12 @@ namespace TestQDoc { */ /*! + \class TestQDoc::TestDerived + \inmodule TestCPP + \brief A derived class in a namespace. +*/ + +/*! \macro QDOCTEST_MACRO \relates TestQDoc */ @@ -117,4 +123,20 @@ int Test::someFunction(int v) \brief An inline function, documented using the \CMDFN QDoc command. */ +/*! + Function that must be reimplemented. +*/ +void Test::virtualFun() +{ + return; +} + +/*! + \reimp +*/ +void TestDerived::virtualFun() +{ + return; +} + } // namespace TestQDoc diff --git a/tests/auto/qdoc/generatedoutput/testcpp.h b/tests/auto/qdoc/generatedoutput/testcpp.h index f39b6d284..733f9e751 100644 --- a/tests/auto/qdoc/generatedoutput/testcpp.h +++ b/tests/auto/qdoc/generatedoutput/testcpp.h @@ -39,6 +39,12 @@ public: void anotherObsoleteMember(); void deprecatedMember(); inline void inlineFunction() {}; + virtual void virtualFun(); +}; + +class TestDerived : public Test { +public: + void virtualFun() override; }; } // namespace TestQDoc diff --git a/tests/auto/qdoc/qdoc.pro b/tests/auto/qdoc/qdoc.pro index bb63be1f9..64a89cb14 100644 --- a/tests/auto/qdoc/qdoc.pro +++ b/tests/auto/qdoc/qdoc.pro @@ -2,5 +2,4 @@ TEMPLATE = subdirs SUBDIRS = \ generatedoutput \ - qdoccommandlineparser \ - qdocglobals + qdoccommandlineparser diff --git a/tests/auto/qdoc/qdocglobals/qdocglobals.pro b/tests/auto/qdoc/qdocglobals/qdocglobals.pro deleted file mode 100644 index fa7ddb8e0..000000000 --- a/tests/auto/qdoc/qdocglobals/qdocglobals.pro +++ /dev/null @@ -1,9 +0,0 @@ -CONFIG += testcase -QT = core testlib -TARGET = tst_qdocglobals -INCLUDEPATH += $$PWD/../../../../src/qdoc - -HEADERS += $$PWD/../../../../src/qdoc/qdocglobals.h - -SOURCES += $$PWD/../../../../src/qdoc/qdocglobals.cpp \ - tst_qdocglobals.cpp diff --git a/tests/auto/qdoc/qdocglobals/tst_qdocglobals.cpp b/tests/auto/qdoc/qdocglobals/tst_qdocglobals.cpp deleted file mode 100644 index fca46911f..000000000 --- a/tests/auto/qdoc/qdocglobals/tst_qdocglobals.cpp +++ /dev/null @@ -1,205 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 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 "qdocglobals.h" - -#include <QtCore/qhash.h> -#include <QtCore/qstringlist.h> -#include <QtTest/QtTest> - -class testQDocGlobals : public QObject -{ - Q_OBJECT - -private slots: - void testClassMembersInitializeToFalseOrEmpty(); - void testEnableHighlighting(); - void testSetShowInternal(); - void testSetSingleExec(); - void testSetWriteQaPages(); - void testRedirectDocumentationToDevNull(); - void testSetNoLinkErrors(); - void testSetAutoLinkErrors(); - void testSetObsoleteLinks(); - - void testAddDefine(); - void testAddIncludePath(); - void testDependModules(); - void testAppendToIndexDirs(); - void testSetCurrentDir(); - void testPreviousCurrentDir(); -}; - -void testQDocGlobals::testClassMembersInitializeToFalseOrEmpty() -{ - QDocGlobals qdocTestGlobals; - QCOMPARE(qdocTestGlobals.highlighting(), false); - QCOMPARE(qdocTestGlobals.showInternal(), false); - QCOMPARE(qdocTestGlobals.singleExec(), false); - QCOMPARE(qdocTestGlobals.writeQaPages(), false); - QCOMPARE(qdocTestGlobals.redirectDocumentationToDevNull(), false); - QCOMPARE(qdocTestGlobals.noLinkErrors(), false); - QCOMPARE(qdocTestGlobals.autolinkErrors(), false); - QCOMPARE(qdocTestGlobals.obsoleteLinks(), false); - - QVERIFY(qdocTestGlobals.defines().isEmpty()); - QVERIFY(qdocTestGlobals.includesPaths().isEmpty()); - QVERIFY(qdocTestGlobals.dependModules().isEmpty()); - QVERIFY(qdocTestGlobals.indexDirs().isEmpty()); - QVERIFY(qdocTestGlobals.currentDir().isEmpty()); - QVERIFY(qdocTestGlobals.previousCurrentDir().isEmpty()); -} - -void testQDocGlobals::testEnableHighlighting() -{ - QDocGlobals qdocTestGlobals; - qdocTestGlobals.enableHighlighting(true); - QVERIFY(qdocTestGlobals.highlighting()); -} - -void testQDocGlobals::testSetShowInternal() -{ - QDocGlobals qdocTestGlobals; - qdocTestGlobals.setShowInternal(true); - QVERIFY(qdocTestGlobals.showInternal()); -} - -void testQDocGlobals::testSetSingleExec() -{ - QDocGlobals qdocTestGlobals; - qdocTestGlobals.setSingleExec(true); - QVERIFY(qdocTestGlobals.singleExec()); -} - -void testQDocGlobals::testSetWriteQaPages() -{ - QDocGlobals qdocTestGlobals; - qdocTestGlobals.setWriteQaPages(true); - QVERIFY(qdocTestGlobals.writeQaPages()); -} - -void testQDocGlobals::testRedirectDocumentationToDevNull() -{ - QDocGlobals qdocTestGlobals; - qdocTestGlobals.setRedirectDocumentationToDevNull(true); - QVERIFY(qdocTestGlobals.redirectDocumentationToDevNull()); -} - -void testQDocGlobals::testSetNoLinkErrors() -{ - QDocGlobals qdocTestGlobals; - qdocTestGlobals.setNoLinkErrors(true); - QVERIFY(qdocTestGlobals.noLinkErrors()); -} - -void testQDocGlobals::testSetAutoLinkErrors() -{ - QDocGlobals qdocTestGlobals; - qdocTestGlobals.setAutolinkErrors(true); - QVERIFY(qdocTestGlobals.autolinkErrors()); -} - -void testQDocGlobals::testSetObsoleteLinks() -{ - QDocGlobals qdocTestGlobals; - qdocTestGlobals.setObsoleteLinks(true); - QVERIFY(qdocTestGlobals.obsoleteLinks()); -} - -void testQDocGlobals::testAddDefine() -{ - QDocGlobals qdocTestGlobals; - QStringList defineTestList1 = { QStringLiteral("qtforpython") }; - QStringList defineTestList2 = { QStringLiteral("example") }; - QStringList expected; - expected << defineTestList1 << defineTestList2; - - qdocTestGlobals.addDefine(defineTestList1); - QCOMPARE(qdocTestGlobals.defines().size(), 1); - qdocTestGlobals.addDefine(defineTestList2); - QCOMPARE(qdocTestGlobals.defines().size(), 2); - QCOMPARE(qdocTestGlobals.defines(), expected); -} - -void testQDocGlobals::testAddIncludePath() -{ - QDocGlobals qdocTestGlobals; - QString testFlag = "-I"; - QString testPath0 = "/qt5/qtdoc/doc/."; - QString testPath1 = "/qt5/qtbase/mkspecs/linux-g++"; - QStringList expected = { "-I/qt5/qtdoc/doc/.", - "-I/qt5/qtbase/mkspecs/linux-g++" }; - - qdocTestGlobals.addIncludePath(testFlag, testPath0); - qdocTestGlobals.addIncludePath(testFlag, testPath1); - QStringList result = qdocTestGlobals.includesPaths(); - QCOMPARE(result, expected); -} - -void testQDocGlobals::testDependModules() -{ - QDocGlobals qdocTestGlobals; - QStringList expected = { "qdoc", "qmake", "qtcore", "qthelp", "qtqml" }; - - qdocTestGlobals.dependModules() = expected; - QCOMPARE(qdocTestGlobals.dependModules().size(), 5); - QCOMPARE(qdocTestGlobals.dependModules(), expected); -} - -void testQDocGlobals::testAppendToIndexDirs() -{ - QDocGlobals qdocTestGlobals; - QString testPath = "/qt5/qtbase/doc"; - QStringList expected; - expected << testPath; - - qdocTestGlobals.appendToIndexDirs(testPath); - QCOMPARE(qdocTestGlobals.indexDirs(), expected); -} - -void testQDocGlobals::testSetCurrentDir() -{ - QDocGlobals qdocTestGlobals; - QString expected = "/qt5/qtdoc/doc/config"; - - qdocTestGlobals.setCurrentDir(expected); - QCOMPARE(qdocTestGlobals.currentDir(), expected); -} - -void testQDocGlobals::testPreviousCurrentDir() -{ - QDocGlobals qdocTestGlobals; - QString expected = "/qt5/qtdoc/doc"; - - qdocTestGlobals.setCurrentDir(expected); - QCOMPARE(qdocTestGlobals.currentDir(), expected); -} - -QTEST_APPLESS_MAIN(testQDocGlobals) - -#include "tst_qdocglobals.moc" |