summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTopi Reinio <topi.reinio@qt.io>2021-02-19 16:43:51 +0100
committerTopi Reiniƶ <topi.reinio@qt.io>2021-02-22 13:52:02 +0000
commit026edd4bcefd6f0cffa72c2385407c28042b4b36 (patch)
tree869b55007f1d0263a1de27c502bb8d7c03b1bb78 /tests
parentfa0140c874f05d582bc98771d212b64910dd06fa (diff)
qdoc: Fix regression in handling of global functions
Commit 550c3031 improved the handling of \relates command, but introduced a regression; When relating a primary function (a first in the linked list of overloads) to another aggregate, the primary's nextOverload pointer was cleared. Subsequent \fn commands trying to document other overloads then failed. The correct way is to move the head of the linked list forward. However, if there are no overloads, we do not want to delete the list entirely, as the function (typically, a global one) must be searchable from the original (global) scope. Pick-to: 6.0 6.1 Fixes: QTBUG-91244 Change-Id: If80fa93ac5231d0676c0809f1acfa97733f9f9e8 Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qdoc/generatedoutput/expected_output/globals.html48
-rw-r--r--tests/auto/qdoc/generatedoutput/testdata/configs/testglobals.qdocconf6
-rw-r--r--tests/auto/qdoc/generatedoutput/testdata/globalfunc/TestGlobals1
-rw-r--r--tests/auto/qdoc/generatedoutput/testdata/globalfunc/global.h31
-rw-r--r--tests/auto/qdoc/generatedoutput/testdata/globalfunc/global.qdoc48
-rw-r--r--tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp6
6 files changed, 140 insertions, 0 deletions
diff --git a/tests/auto/qdoc/generatedoutput/expected_output/globals.html b/tests/auto/qdoc/generatedoutput/expected_output/globals.html
new file mode 100644
index 000000000..90f927232
--- /dev/null
+++ b/tests/auto/qdoc/generatedoutput/expected_output/globals.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+<!-- global.qdoc -->
+ <title>Globals Class | TestGlobals</title>
+</head>
+<body>
+<li>Globals</li>
+<div class="sidebar">
+<div class="toc">
+<h3><a name="toc">Contents</a></h3>
+<ul>
+<li class="level1"><a href="#related-non-members">Related Non-Members</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">Globals Class</h1>
+<div class="table"><table class="alignedsummary">
+<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include &lt;Globals&gt;</span>
+</td></tr></table></div><ul>
+</ul>
+<a name="related-non-members"></a>
+<h2 id="related-non-members">Related Non-Members</h2>
+<div class="table"><table class="alignedsummary">
+<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="globals.html#foo">foo</a></b>(int <i>a</i>)</td></tr>
+<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="globals.html#foo-1">foo</a></b>(int <i>a</i>, bool <i>b</i>)</td></tr>
+</table></div>
+<a name="details"></a>
+<!-- $$$Globals-description -->
+<div class="descr">
+<h2 id="details">Detailed Description</h2>
+</div>
+<!-- @@@Globals -->
+<div class="relnonmem">
+<h2>Related Non-Members</h2>
+<!-- $$$foo[overload1]$$$fooint -->
+<h3 class="fn" id="foo"><a name="foo"></a><span class="type">int</span> <span class="name">foo</span>(<span class="type">int</span> <i>a</i>)</h3>
+<p>Params: <i>a</i></p>
+<!-- @@@foo -->
+<!-- $$$foo$$$foointbool -->
+<h3 class="fn" id="foo-1"><a name="foo-1"></a><span class="type">int</span> <span class="name">foo</span>(<span class="type">int</span> <i>a</i>, <span class="type">bool</span> <i>b</i>)</h3>
+<p>Params: <i>b</i>, <i>b</i></p>
+<!-- @@@foo -->
+</div>
+</body>
+</html>
diff --git a/tests/auto/qdoc/generatedoutput/testdata/configs/testglobals.qdocconf b/tests/auto/qdoc/generatedoutput/testdata/configs/testglobals.qdocconf
new file mode 100644
index 000000000..c69ffe239
--- /dev/null
+++ b/tests/auto/qdoc/generatedoutput/testdata/configs/testglobals.qdocconf
@@ -0,0 +1,6 @@
+include(config.qdocconf)
+project = TestGlobals
+includepaths += -I../globalfunc
+
+headers = ../globalfunc/global.h
+sources = ../globalfunc/global.qdoc
diff --git a/tests/auto/qdoc/generatedoutput/testdata/globalfunc/TestGlobals b/tests/auto/qdoc/generatedoutput/testdata/globalfunc/TestGlobals
new file mode 100644
index 000000000..dc4f98a6e
--- /dev/null
+++ b/tests/auto/qdoc/generatedoutput/testdata/globalfunc/TestGlobals
@@ -0,0 +1 @@
+#include "global.h"
diff --git a/tests/auto/qdoc/generatedoutput/testdata/globalfunc/global.h b/tests/auto/qdoc/generatedoutput/testdata/globalfunc/global.h
new file mode 100644
index 000000000..16d3a89cd
--- /dev/null
+++ b/tests/auto/qdoc/generatedoutput/testdata/globalfunc/global.h
@@ -0,0 +1,31 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 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$
+**
+****************************************************************************/
+
+class Globals {};
+inline int foo(int a) { return a; }
+inline int foo(int a, bool b) { return b ? a : -a; }
diff --git a/tests/auto/qdoc/generatedoutput/testdata/globalfunc/global.qdoc b/tests/auto/qdoc/generatedoutput/testdata/globalfunc/global.qdoc
new file mode 100644
index 000000000..a68a55abd
--- /dev/null
+++ b/tests/auto/qdoc/generatedoutput/testdata/globalfunc/global.qdoc
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 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$
+**
+****************************************************************************/
+
+/*!
+ \module TestGlobals
+*/
+
+/*!
+ \class Globals
+ \inmodule TestGlobals
+*/
+
+/*!
+ \fn int foo(int a)
+ \relates Globals
+ Params: \a a
+*/
+
+/*!
+ \fn int foo(int a, bool b)
+ \relates Globals
+ Params: \a b, \a b
+*/
diff --git a/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp b/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp
index 05bfeaa3a..515b816d4 100644
--- a/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp
+++ b/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp
@@ -78,6 +78,7 @@ private slots:
void usingDirective();
void properties();
void testTagFile();
+ void testGlobalFunctions();
private:
QScopedPointer<QTemporaryDir> m_outputDir;
@@ -512,6 +513,11 @@ void tst_generatedOutput::testTagFile()
testAndCompare("testdata/configs/tagfiles.qdocconf", "testtagfile.tags");
}
+void tst_generatedOutput::testGlobalFunctions()
+{
+ testAndCompare("testdata/configs/testglobals.qdocconf", "globals.html");
+}
+
int main(int argc, char *argv[])
{
tst_generatedOutput tc;