fixed bz#1671999, backported from upstream

added test for XML output with an empty TOC
This commit is contained in:
Than Ngo 2019-02-05 15:52:59 +01:00
parent 7448e7ae78
commit 73e6d66a71
3 changed files with 76 additions and 1 deletions

View File

@ -0,0 +1,27 @@
commit cfe381e3ee55b8291faeea55fe3b67bb9e545d60
Author: Vladimír Vondruš <mosra@centrum.cz>
Date: Sat Dec 29 21:52:39 2018 +0100
Properly handle empty TOC in XML output.
Caused the test (079) to fail with a SIGSEGV, but larger projects exit
with a success return code and the generated XML is either truncated or
empty. Weird.
diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp
index bacf4d41..033e611f 100644
--- a/src/xmlgen.cpp
+++ b/src/xmlgen.cpp
@@ -1818,10 +1818,10 @@ static void generateXMLForPage(PageDef *pd,FTextStream &ti,bool isExample)
}
}
writeInnerPages(pd->getSubPages(),t);
- if (pd->localToc().isXmlEnabled())
+ SectionDict *sectionDict = pd->getSectionDict();
+ if (pd->localToc().isXmlEnabled() && sectionDict)
{
t << " <tableofcontents>" << endl;
- SectionDict *sectionDict = pd->getSectionDict();
SDict<SectionInfo>::Iterator li(*sectionDict);
SectionInfo *si;
int level=1,l;

View File

@ -0,0 +1,42 @@
commit e26a5b8eed8a012e6a400f1ed6baf27980668b53
Author: Vladimír Vondruš <mosra@centrum.cz>
Date: Sat Dec 29 21:30:51 2018 +0100
testing: add a test for XML output with an empty TOC.
Fails, in particular causes Doxygen to produce an empty (or truncated)
XML file but returning with a success error code.
diff --git a/testing/079/empty.xml b/testing/079/empty.xml
new file mode 100644
index 00000000..3e1d6915
--- /dev/null
+++ b/testing/079/empty.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="">
+ <compounddef id="empty" kind="page">
+ <compoundname>empty</compoundname>
+ <title>An empty page</title>
+ <briefdescription>
+ </briefdescription>
+ <detaileddescription>
+<para>With an empty TOC. </para>
+ </detaileddescription>
+ </compounddef>
+</doxygen>
diff --git a/testing/079_tableofcontents.dox b/testing/079_tableofcontents.dox
new file mode 100644
index 00000000..499771d7
--- /dev/null
+++ b/testing/079_tableofcontents.dox
@@ -0,0 +1,9 @@
+// objective: test TOC generation for an empty page
+// check: empty.xml
+/**
+@page empty An empty page
+
+@tableofcontents
+
+With an empty TOC.
+*/

View File

@ -8,7 +8,7 @@ Summary: A documentation system for C/C++
Name: doxygen
Epoch: 1
Version: 1.8.15
Release: 2%{?dist}
Release: 3%{?dist}
# No version is specified.
License: GPL+
@ -19,6 +19,8 @@ Source1: doxywizard.png
Source2: doxywizard.desktop
# upstream patches
Patch0: doxygen-1.8.15-handle_empty_TOC_in_XML_output.patch
Patch1: doxygen-1.8.15-test_for_XML_output_with_an_empty_TOC.patch
BuildRequires: gcc-c++ gcc
BuildRequires: perl-interpreter
@ -182,6 +184,10 @@ make tests -C %{_target_platform}
%endif
%changelog
* Tue Feb 05 2019 Than Ngo <than@redhat.com> - 1:1.8.15-3
- fixed bz#1671999, backported from upstream
- added test for XML output with an empty TOC
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1:1.8.15-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild