summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qdoc/cppcodeparser.cpp3
-rw-r--r--tests/auto/qdoc/generatedoutput/expected_output/demos-manifest.xml9
-rw-r--r--tests/auto/qdoc/generatedoutput/expected_output/test.qhp2
-rw-r--r--tests/auto/qdoc/generatedoutput/testdata/configs/examples-qhp.qdocconf2
-rw-r--r--tests/auto/qdoc/generatedoutput/testdata/examples/demos/demo/demo.pro2
-rw-r--r--tests/auto/qdoc/generatedoutput/testdata/examples/demos/demo/doc/src/demo.qdoc32
-rw-r--r--tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp1
7 files changed, 49 insertions, 2 deletions
diff --git a/src/qdoc/cppcodeparser.cpp b/src/qdoc/cppcodeparser.cpp
index 065032024..5248c990d 100644
--- a/src/qdoc/cppcodeparser.cpp
+++ b/src/qdoc/cppcodeparser.cpp
@@ -813,8 +813,7 @@ void CppCodeParser::setExampleFileLists(ExampleNode *en)
QLatin1String("*.qrc *.pro *.qmlproject *.pyproject CMakeLists.txt qmldir"));
}
- exampleDir.cdUp();
- int pathLen = exampleDir.path().size() + 1;
+ const int pathLen = exampleDir.path().size() - en->name().size();
for (auto &file : exampleFiles)
file = file.mid(pathLen);
for (auto &file : imageFiles)
diff --git a/tests/auto/qdoc/generatedoutput/expected_output/demos-manifest.xml b/tests/auto/qdoc/generatedoutput/expected_output/demos-manifest.xml
new file mode 100644
index 000000000..d83906f44
--- /dev/null
+++ b/tests/auto/qdoc/generatedoutput/expected_output/demos-manifest.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<instructionals module="Test">
+ <demos>
+ <demo name="Demo" docUrl="qthelp://org.qt-project.test.001/test/test-demos-demo-example.html" projectPath="test/demos/demo/demo.pro" isTest="true">
+ <description><![CDATA[No description available]]></description>
+ <tags>demo,test</tags>
+ </demo>
+ </demos>
+</instructionals>
diff --git a/tests/auto/qdoc/generatedoutput/expected_output/test.qhp b/tests/auto/qdoc/generatedoutput/expected_output/test.qhp
index 459892df1..387e018ae 100644
--- a/tests/auto/qdoc/generatedoutput/expected_output/test.qhp
+++ b/tests/auto/qdoc/generatedoutput/expected_output/test.qhp
@@ -9,6 +9,7 @@
<section ref="uicomponents-qmlmodule.html" title="Test">
<section ref="qdoc-test-qmlmodule.html" title=""/>
<section ref="test-cmaketest-example.html" title="CMake Example Project"/>
+ <section ref="test-demos-demo-example.html" title="Demo"/>
<section ref="testcpp-module.html" title="QDoc Test C++ Classes"/>
<section ref="test-componentset-example.html" title="QML Documentation Example"/>
<section ref="uicomponents-qmlmodule.html" title="UI Components"/>
@@ -128,6 +129,7 @@
<file>test-componentset-progressbar-qml.html</file>
<file>test-componentset-switch-qml.html</file>
<file>test-componentset-tabwidget-qml.html</file>
+ <file>test-demos-demo-example.html</file>
<file>testcpp-module.html</file>
<file>testqdoc-test-members.html</file>
<file>testqdoc-test-obsolete.html</file>
diff --git a/tests/auto/qdoc/generatedoutput/testdata/configs/examples-qhp.qdocconf b/tests/auto/qdoc/generatedoutput/testdata/configs/examples-qhp.qdocconf
index a1ed619a3..11695289e 100644
--- a/tests/auto/qdoc/generatedoutput/testdata/configs/examples-qhp.qdocconf
+++ b/tests/auto/qdoc/generatedoutput/testdata/configs/examples-qhp.qdocconf
@@ -4,6 +4,8 @@ version = 0.0.1
examplesinstallpath = test
+exampledirs += ../examples
+
# Configure .qhp generation
qhp.projects = Test
diff --git a/tests/auto/qdoc/generatedoutput/testdata/examples/demos/demo/demo.pro b/tests/auto/qdoc/generatedoutput/testdata/examples/demos/demo/demo.pro
new file mode 100644
index 000000000..dbe8ff3c0
--- /dev/null
+++ b/tests/auto/qdoc/generatedoutput/testdata/examples/demos/demo/demo.pro
@@ -0,0 +1,2 @@
+TEMPLATE = aux
+message("Nothing to see here.")
diff --git a/tests/auto/qdoc/generatedoutput/testdata/examples/demos/demo/doc/src/demo.qdoc b/tests/auto/qdoc/generatedoutput/testdata/examples/demos/demo/doc/src/demo.qdoc
new file mode 100644
index 000000000..08b609126
--- /dev/null
+++ b/tests/auto/qdoc/generatedoutput/testdata/examples/demos/demo/doc/src/demo.qdoc
@@ -0,0 +1,32 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+/*!
+ \example demos/demo
+ \title Demo
+*/
diff --git a/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp b/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp
index 7bf8b3210..40fcdfcac 100644
--- a/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp
+++ b/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp
@@ -295,6 +295,7 @@ void tst_generatedOutput::examplesManifestXmlAndQhp()
{
testAndCompare("testdata/configs/examples-qhp.qdocconf",
"examples-manifest.xml "
+ "demos-manifest.xml "
"test.qhp");
}