diff options
author | Topi Reinio <topi.reinio@qt.io> | 2020-01-23 23:42:18 +0100 |
---|---|---|
committer | Topi Reinio <topi.reinio@qt.io> | 2020-01-24 12:18:36 +0100 |
commit | 11e62fb056a715075b034a63e248d980bc88b29d (patch) | |
tree | e04385e278b93b8a44e6d3bb8a7a43dc7f87d91a /tests | |
parent | c0431f14b665a2d56ed7a064ba15e39f29905d77 (diff) |
qdoc: Ensure that \dontdocument works as expected
Class nodes marked with \dontdocument are not supposed to be seen
in the generated documentation. They already did not generate an
output page, but they still appeared as base classes in 'Inherits'
information as well as class listings, resulting in broken links.
Remove these nodes from all relevant lists. Handle Node::DontDocument
status in the .index files, and add a test to cover \dontdocument
usage.
Fixes: QTBUG-81468
Change-Id: I933817ff0ebf372cfa493a5ea824b682e0b1b160
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'tests')
8 files changed, 196 insertions, 0 deletions
diff --git a/tests/auto/qdoc/generatedoutput/dontdocument/TestCPP b/tests/auto/qdoc/generatedoutput/dontdocument/TestCPP new file mode 100644 index 000000000..7291e6d8f --- /dev/null +++ b/tests/auto/qdoc/generatedoutput/dontdocument/TestCPP @@ -0,0 +1,2 @@ +#include "../TestCPP" +#include "dont.h" diff --git a/tests/auto/qdoc/generatedoutput/dontdocument/dont.cpp b/tests/auto/qdoc/generatedoutput/dontdocument/dont.cpp new file mode 100644 index 000000000..33e208459 --- /dev/null +++ b/tests/auto/qdoc/generatedoutput/dontdocument/dont.cpp @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2020 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 "dont.h" + +/*! + \class UnseenClass + \inmodule TestCPP + \brief A public but undocumented class. +*/ +UnseenClass::UnseenClass() +{ +} + +/*! + \class SeenClass + \inmodule TestCPP + \brief A public but undocumented class. +*/ +SeenClass::SeenClass() +{ +} diff --git a/tests/auto/qdoc/generatedoutput/dontdocument/dont.h b/tests/auto/qdoc/generatedoutput/dontdocument/dont.h new file mode 100644 index 000000000..5ef436b5c --- /dev/null +++ b/tests/auto/qdoc/generatedoutput/dontdocument/dont.h @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2020 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 + +class UnseenClass +{ +public: + UnseenClass(); +}; + +class SeenClass : public UnseenClass +{ +public: + SeenClass(); +}; diff --git a/tests/auto/qdoc/generatedoutput/dontdocument/dontdocument.qdocconf b/tests/auto/qdoc/generatedoutput/dontdocument/dontdocument.qdocconf new file mode 100644 index 000000000..1c141784b --- /dev/null +++ b/tests/auto/qdoc/generatedoutput/dontdocument/dontdocument.qdocconf @@ -0,0 +1,7 @@ +include(../testcpp.qdocconf) + +headers += dont.h +sources += dont.cpp test.qdoc + +HTML.nosubdirs = true +HTML.outputsubdir = dontdocument diff --git a/tests/auto/qdoc/generatedoutput/dontdocument/test.qdoc b/tests/auto/qdoc/generatedoutput/dontdocument/test.qdoc new file mode 100644 index 000000000..3f6e0be30 --- /dev/null +++ b/tests/auto/qdoc/generatedoutput/dontdocument/test.qdoc @@ -0,0 +1,36 @@ +/**************************************************************************** +** +** Copyright (C) 2020 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$ +** +****************************************************************************/ + +/*! + \dontdocument (UnseenClass) +*/ + +/*! \page classes.html + \title Classes + \generatelist annotatedclasses +*/ diff --git a/tests/auto/qdoc/generatedoutput/expected_output/dontdocument/classes.html b/tests/auto/qdoc/generatedoutput/expected_output/dontdocument/classes.html new file mode 100644 index 000000000..f5bae610a --- /dev/null +++ b/tests/auto/qdoc/generatedoutput/expected_output/dontdocument/classes.html @@ -0,0 +1,22 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<!-- test.qdoc --> + <title>Classes | TestCPP</title> +</head> +<body> +<div class="sidebar"><div class="sidebar-content" id="sidebar-content"></div></div> +<h1 class="title">Classes</h1> +<span class="subtitle"></span> +<!-- $$$classes.html-description --> +<div class="descr"> <a name="details"></a> +<div class="table"><table class="annotated"> +<tr class="odd topAlign"><td class="tblName"><p><a href="seenclass.html">SeenClass</a></p></td><td class="tblDescr"><p>A public but undocumented class</p></td></tr> +<tr class="even 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="odd 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> +</div> +<!-- @@@classes.html --> +</body> +</html> diff --git a/tests/auto/qdoc/generatedoutput/expected_output/dontdocument/seenclass.html b/tests/auto/qdoc/generatedoutput/expected_output/dontdocument/seenclass.html new file mode 100644 index 000000000..119841e44 --- /dev/null +++ b/tests/auto/qdoc/generatedoutput/expected_output/dontdocument/seenclass.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<!-- dont.cpp --> + <title>SeenClass Class | TestCPP</title> +</head> +<body> +<li>SeenClass</li> +<div class="sidebar"> +<div class="toc"> +<h3><a name="toc">Contents</a></h3> +<ul> +<li class="level1"><a href="#details">Detailed Description</a></li> +</ul> +</div> +<div class="sidebar-content" id="sidebar-content"></div></div> +<h1 class="title">SeenClass Class</h1> +<!-- $$$SeenClass-brief --> +<p>A public but undocumented class. <a href="#details">More...</a></p> +<!-- @@@SeenClass --> +<div class="table"><table class="alignedsummary"> +<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <SeenClass></span> +</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += testcpp</td></tr></table></div><ul> +</ul> +<a name="details"></a> +<!-- $$$SeenClass-description --> +<div class="descr"> +<h2 id="details">Detailed Description</h2> +</div> +<!-- @@@SeenClass --> +</body> +</html> diff --git a/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp b/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp index 932441b4e..7d87470f6 100644 --- a/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp +++ b/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp @@ -59,6 +59,7 @@ private slots: void ignoresinceVariable(); void templateParameters(); void scopedEnum(); + void dontDocument(); private: QScopedPointer<QTemporaryDir> m_outputDir; @@ -290,6 +291,13 @@ void tst_generatedOutput::scopedEnum() testAndCompare("scopedenum.qdocconf", "scopedenum/testqdoc-test.html"); } +void tst_generatedOutput::dontDocument() +{ + testAndCompare("dontdocument/dontdocument.qdocconf", "dontdocument/classes.html " + "dontdocument/seenclass.html"); +} + + QTEST_APPLESS_MAIN(tst_generatedOutput) #include "tst_generatedoutput.moc" |