diff options
author | Paul Wicking <paul.wicking@qt.io> | 2023-08-08 12:28:28 +0200 |
---|---|---|
committer | Paul Wicking <paul.wicking@qt.io> | 2023-08-08 13:41:38 +0200 |
commit | 23fd844bf85f1742751b960fd32e8da4e16fc793 (patch) | |
tree | 01baa41f3e1f393691e3e6921c9b7096906eda36 /tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp | |
parent | e6ba3da353e3a5e70023678c765d4f81aff58c42 (diff) |
Don't let CMD_VALUE break CMD_TABLE
In QDoc, if a `\table` command follows a (list of) `\value` command(s),
the content of both commands is merged in QDoc's HTML output. This
means the table ends up broken. A workaround exists, which is to add a
`\br` command to insert an explicit line break after the `\value` entry.
This (mis-)behavior was discovered in the documentation for Qt Quick's
`Image.fillMode` enumeration (see related Jira issue in the Task-Number
footer.
The responsible class in QDoc is DocParser. In the handling of
`CMD_TABLE`, there's no call to `DocParser::leaveValueList()`, as is a
recurring pattern in four other contexts of DocParser's command
handling:
- After the while/switch in `Docparser::parse()` - presumably an attempt
at ensuring it's always called, that doesn't seem to work satisfactory.
- At the start of `DocParser::startSection`.
- In a conditional at the top of `DocParser::startPara`.
- At the start of handling `CMD_IMAGE`.
This patch adds a test case in tst_generatedOutput that reproduces the
circumstances in which the issue could present itself. QDoc is modified
by adding a call to `DocParser::leaveValueList() upon entering the code
responsible for handling `CMD_TABLE` ensures correct behavior, where
HTML for the value list is terminated properly before creating the new
table for the table command.
Task-number: QTBUG-115537
Fixes: QTBUG-115720
Pick-to: 6.6 6.5
Change-Id: I06c9c25b4ff792621d56e5eb802178cfd376f8c3
Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
Diffstat (limited to 'tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp')
-rw-r--r-- | tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp b/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp index 8b8a3d60e..2bd7dbc9f 100644 --- a/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp +++ b/tests/auto/qdoc/generatedoutput/tst_generatedoutput.cpp @@ -62,6 +62,7 @@ private slots: void proxyPage(); void nonAsciiCharacterInput(); void lineComments(); + void tableAfterValue(); private: QScopedPointer<QTemporaryDir> m_outputDir; @@ -313,6 +314,16 @@ void tst_generatedOutput::illformated_documentation() "brief-adventures.html"); } +void tst_generatedOutput::tableAfterValue() +{ + testAndCompare("testdata/tables/table-after-value.qdocconf", + "tableaftervalue/tableaftervalue-members.html " + "tableaftervalue/tableaftervalue.html " + "tableaftervalue/tableaftervalue.index " + "tableaftervalue/tableaftervalue.webxml " + "tableaftervalue/tableaftervalue.xml"); +} + void tst_generatedOutput::docBookFromQDocFile() { testAndCompare("testdata/configs/docbook_test.qdocconf", |