diff options
author | Topi Reinio <topi.reinio@qt.io> | 2020-03-04 17:31:17 +0100 |
---|---|---|
committer | Topi Reinio <topi.reinio@qt.io> | 2020-03-05 15:55:19 +0100 |
commit | dc8598ab1e441d9b49a3aac1e3812bf93f8a3211 (patch) | |
tree | f87b882fcd3d3e4e8214a24e356c34fbd25dae84 /tests | |
parent | 60be58eb314349862e09d3fc106bfa23feda170f (diff) |
qdoc: Fix issues in HelpProjectWriter
The code that generates Qt Help Project (.qhp) xml files was suffering
from multiple issues - mostly related to changes in Node inheritance
that were not reflected in HelpProjectWriter implementation.
- We no longer have subtypes for page nodes. Therefore, selectors like
'doc:example' were broken. Simplify the selector code but continue
supporting the old notation.
- Examples and basic QML/JS types were incorrectly dropped from the TOC.
- Node::Union and Node::Struct were called 'Class' in the .qhp. Use the
Generator::typeString() to fetch the correct type name for all types.
- Require .qhp subprojects to have at least a title to avoid empty
subsections in the TOC.
Add a test that covers the entire .qhp generation with different types
of subprojects defined.
Fixes: QTBUG-82671
Fixes: QTBUG-82674
Change-Id: I8fe4a8ad5fc6d58f86e0e9128e98c0b8c4ba4a6a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'tests')
3 files changed, 159 insertions, 3 deletions
diff --git a/tests/auto/qdoc/generatedoutput/expected_output/test.qhp b/tests/auto/qdoc/generatedoutput/expected_output/test.qhp new file mode 100644 index 000000000..4816ef1d5 --- /dev/null +++ b/tests/auto/qdoc/generatedoutput/expected_output/test.qhp @@ -0,0 +1,137 @@ +<?xml version="1.0" encoding="UTF-8"?> +<QtHelpProject version="1.0"> + <namespace>org.qt-project.test.001</namespace> + <virtualFolder>test</virtualFolder> + <metaData name="version" value="0.0.1"/> + <filterSection> + <toc> + <section ref="uicomponents-qmlmodule.html" title="UI Components"> + <section ref="uicomponents-qmlmodule.html" title="Test"> + <section ref="qdoc-test-qmlmodule.html" title=""/> + <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"/> + </section> + <section ref="testcpp-module.html" title="Classes"> + <section ref="testqdoc.html" title="TestQDoc"/> + <section ref="testqdoc-test.html" title="TestQDoc::Test Class Reference"> + <section ref="testqdoc-test-members.html" title="List of all members"/> + <section ref="testqdoc-test-obsolete.html" title="Obsolete members"/> + </section> + <section ref="testqdoc-testderived.html" title="TestQDoc::TestDerived Class Reference"> + <section ref="testqdoc-testderived-members.html" title="List of all members"/> + </section> + </section> + <section ref="uicomponents-qmlmodule.html" title="QML Types"> + <section ref="qml-qdoc-test-abstractparent.html" title="AbstractParent Type Reference"> + <section ref="qml-qdoc-test-abstractparent-members.html" title="List of all members"/> + </section> + <section ref="qml-qdoc-test-child.html" title="Child Type Reference"> + <section ref="qml-qdoc-test-child-members.html" title="List of all members"/> + </section> + <section ref="qml-qdoc-test-doctest.html" title="DocTest Type Reference"> + <section ref="qml-qdoc-test-doctest-members.html" title="List of all members"/> + </section> + <section ref="qml-qdoc-test-type.html" title="Type Type Reference"> + <section ref="qml-qdoc-test-type-members.html" title="List of all members"/> + </section> + <section ref="qml-uicomponents-progressbar.html" title="ProgressBar Type Reference"> + <section ref="qml-uicomponents-progressbar-members.html" title="List of all members"/> + </section> + <section ref="qml-uicomponents-switch.html" title="Switch Type Reference"> + <section ref="qml-uicomponents-switch-members.html" title="List of all members"/> + </section> + <section ref="qml-uicomponents-tabwidget.html" title="TabWidget Type Reference"> + <section ref="qml-uicomponents-tabwidget-members.html" title="List of all members"/> + </section> + <section ref="qml-int.html" title="int Type Reference"/> + </section> + </section> + </toc> + <keywords> + <keyword name="AbstractParent" id="QML.AbstractParent" ref="qml-qdoc-test-abstractparent.html"/> + <keyword name="Child" id="QML.Child" ref="qml-qdoc-test-child.html"/> + <keyword name="DocTest" id="QML.DocTest" ref="qml-qdoc-test-doctest.html"/> + <keyword name="ProgressBar" id="QML.ProgressBar" ref="qml-uicomponents-progressbar.html"/> + <keyword name="QDOCTEST_MACRO" id="QDOCTEST_MACRO" ref="testqdoc.html#QDOCTEST_MACRO"/> + <keyword name="QDOCTEST_MACRO2" id="QDOCTEST_MACRO2" ref="testqdoc-test.html#QDOCTEST_MACRO2"/> + <keyword name="QDoc Test C++ Classes" id="QDoc Test C++ Classes" ref="testcpp-module.html"/> + <keyword name="Switch" id="QML.Switch" ref="qml-uicomponents-switch.html"/> + <keyword name="TabWidget" id="QML.TabWidget" ref="qml-uicomponents-tabwidget.html"/> + <keyword name="Test" id="TestQDoc::Test" ref="testqdoc-test.html"/> + <keyword name="TestDerived" id="TestQDoc::TestDerived" ref="testqdoc-testderived.html"/> + <keyword name="TestQDoc" id="TestQDoc" ref="testqdoc.html"/> + <keyword name="Type" id="QML.Type" ref="qml-qdoc-test-type.html"/> + <keyword name="UI Components" id="UI Components" ref="uicomponents-qmlmodule.html"/> + <keyword name="abs" id="int::abs" ref="qml-int.html#abs-method"/> + <keyword name="active" id="DocTest::active" ref="qml-qdoc-test-doctest.html#active-prop"/> + <keyword name="anotherObsoleteMember" id="Test::anotherObsoleteMember" ref="testqdoc-test-obsolete.html#anotherObsoleteMember"/> + <keyword name="children" id="AbstractParent::children" ref="qml-qdoc-test-abstractparent.html#children-prop"/> + <keyword name="color" id="ProgressBar::color" ref="qml-uicomponents-progressbar.html#color-prop"/> + <keyword name="completed" id="Type::completed" ref="qml-qdoc-test-type.html#completed-signal"/> + <keyword name="configured" id="Type::configured" ref="qml-qdoc-test-type.html#configured-signal"/> + <keyword name="copy" id="Type::copy" ref="qml-qdoc-test-type.html#copy-method"/> + <keyword name="current" id="TabWidget::current" ref="qml-uicomponents-tabwidget.html#current-prop"/> + <keyword name="deprecatedMember" id="Test::deprecatedMember" ref="testqdoc-test-obsolete.html#deprecatedMember"/> + <keyword name="disable" id="Type::disable" ref="qml-qdoc-test-type.html#disable-method"/> + <keyword name="enable" id="Type::enable" ref="qml-qdoc-test-type.html#enable-method"/> + <keyword name="fail" id="DocTest::fail" ref="qml-qdoc-test-doctest.html#fail-method"/> + <keyword name="fifth" id="Type::fifth" ref="qml-qdoc-test-type.html#fifth-prop"/> + <keyword name="fourth" id="Type::fourth" ref="qml-qdoc-test-type.html#fourth-prop"/> + <keyword name="group.first" id="Type::group.first" ref="qml-qdoc-test-type.html#group.first-prop"/> + <keyword name="group.second" id="Type::group.second" ref="qml-qdoc-test-type.html#group.second-prop"/> + <keyword name="group.third" id="Type::group.third" ref="qml-qdoc-test-type.html#group.third-prop"/> + <keyword name="id" id="Type::id" ref="qml-qdoc-test-type.html#id-prop"/> + <keyword name="inlineFunction" id="Test::inlineFunction" ref="testqdoc-test.html#inlineFunction"/> + <keyword name="int" id="QML.int" ref="qml-int.html"/> + <keyword name="maximum" id="ProgressBar::maximum" ref="qml-uicomponents-progressbar.html#maximum-prop"/> + <keyword name="minimum" id="ProgressBar::minimum" ref="qml-uicomponents-progressbar.html#minimum-prop"/> + <keyword name="name" id="DocTest::name" ref="qml-qdoc-test-doctest.html#name-prop"/> + <keyword name="name" id="Type::name" ref="qml-qdoc-test-type.html#name-prop"/> + <keyword name="obsoleteMember" id="Test::obsoleteMember" ref="testqdoc-test-obsolete.html#obsoleteMember"/> + <keyword name="on" id="Switch::on" ref="qml-uicomponents-switch.html#on-prop"/> + <keyword name="overload" id="Test::overload" ref="testqdoc-test.html#overload"/> + <keyword name="rear" id="AbstractParent::rear" ref="qml-qdoc-test-abstractparent.html#rear-method"/> + <keyword name="sampleReadOnlyProperty" id="TabWidget::sampleReadOnlyProperty" ref="qml-uicomponents-tabwidget.html#sampleReadOnlyProperty-prop"/> + <keyword name="secondColor" id="ProgressBar::secondColor" ref="qml-uicomponents-progressbar.html#secondColor-prop"/> + <keyword name="someFunction" id="Test::someFunction" ref="testqdoc-test.html#someFunction"/> + <keyword name="someFunctionDefaultArg" id="Test::someFunctionDefaultArg" ref="testqdoc-test.html#someFunctionDefaultArg"/> + <keyword name="toggle" id="Switch::toggle" ref="qml-uicomponents-switch.html#toggle-method"/> + <keyword name="type" id="Type::type" ref="qml-qdoc-test-type.html#type-attached-prop"/> + <keyword name="value" id="ProgressBar::value" ref="qml-uicomponents-progressbar.html#value-prop"/> + <keyword name="virtualFun" id="Test::virtualFun" ref="testqdoc-test.html#virtualFun"/> + <keyword name="virtualFun" id="TestDerived::virtualFun" ref="testqdoc-testderived.html#virtualFun"/> + </keywords> + <files> + <file>qdoc-test-qmlmodule.html</file> + <file>qml-int.html</file> + <file>qml-qdoc-test-abstractparent-members.html</file> + <file>qml-qdoc-test-abstractparent.html</file> + <file>qml-qdoc-test-child-members.html</file> + <file>qml-qdoc-test-child.html</file> + <file>qml-qdoc-test-doctest-members.html</file> + <file>qml-qdoc-test-doctest.html</file> + <file>qml-qdoc-test-type-members.html</file> + <file>qml-qdoc-test-type.html</file> + <file>qml-uicomponents-progressbar-members.html</file> + <file>qml-uicomponents-progressbar.html</file> + <file>qml-uicomponents-switch-members.html</file> + <file>qml-uicomponents-switch.html</file> + <file>qml-uicomponents-tabwidget-members.html</file> + <file>qml-uicomponents-tabwidget.html</file> + <file>test-componentset-componentset-pro.html</file> + <file>test-componentset-example.html</file> + <file>test-componentset-progressbar-qml.html</file> + <file>test-componentset-switch-qml.html</file> + <file>test-componentset-tabwidget-qml.html</file> + <file>testcpp-module.html</file> + <file>testqdoc-test-members.html</file> + <file>testqdoc-test-obsolete.html</file> + <file>testqdoc-test.html</file> + <file>testqdoc-testderived-members.html</file> + <file>testqdoc-testderived.html</file> + <file>testqdoc.html</file> + <file>uicomponents-qmlmodule.html</file> + </files> + </filterSection> +</QtHelpProject> diff --git a/tests/auto/qdoc/generatedoutput/testdata/configs/examples-qhp.qdocconf b/tests/auto/qdoc/generatedoutput/testdata/configs/examples-qhp.qdocconf index b4598476e..a1ed619a3 100644 --- a/tests/auto/qdoc/generatedoutput/testdata/configs/examples-qhp.qdocconf +++ b/tests/auto/qdoc/generatedoutput/testdata/configs/examples-qhp.qdocconf @@ -1,5 +1,6 @@ # QML test includes a documented example include(testqml.qdocconf) +version = 0.0.1 examplesinstallpath = test @@ -12,6 +13,22 @@ qhp.Test.virtualFolder = test qhp.Test.indexTitle = UI Components qhp.Test.indexRoot = +qhp.Test.subprojects = test classes qmltypes undefined +qhp.Test.subprojects.test.title = Test +qhp.Test.subprojects.test.indexTitle = UI Components +qhp.Test.subprojects.test.selectors = doc:page fake:example module qmlmodule +qhp.Test.subprojects.test.sortPages = true + +qhp.Test.subprojects.classes.title = Classes +qhp.Test.subprojects.classes.indexTitle = QDoc Test C++ Classes +qhp.Test.subprojects.classes.selectors = class namespace doc:headerfile boop:whatever +qhp.Test.subprojects.classes.sortPages = true + +qhp.Test.subprojects.qmltypes.title = QML Types +qhp.Test.subprojects.qmltypes.indexTitle = UI Components +qhp.Test.subprojects.qmltypes.selectors = qmlmodule:UIComponents,QDoc.Test +qhp.Test.subprojects.qmltypes.sortPages = true + # Add some meta-data to the example manifestmeta.filters = test diff --git a/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp b/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp index b3509dfff..20becc713 100644 --- a/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp +++ b/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp @@ -56,7 +56,7 @@ private slots: void docBookFromQml(); // Output format independent tests - void examplesManifestXml(); + void examplesManifestXmlAndQhp(); void ignoresinceVariable(); void templateParameters(); void scopedEnum(); @@ -286,9 +286,11 @@ void tst_generatedOutput::docBookFromQml() "docbook/qml-int.xml"); } -void tst_generatedOutput::examplesManifestXml() +void tst_generatedOutput::examplesManifestXmlAndQhp() { - testAndCompare("testdata/configs/examples-qhp.qdocconf", "examples-manifest.xml"); + testAndCompare("testdata/configs/examples-qhp.qdocconf", + "examples-manifest.xml " + "test.qhp"); } void tst_generatedOutput::ignoresinceVariable() |