diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2023-05-29 14:47:20 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-05-29 16:50:54 +0200 |
commit | 949d1ee783f58504fdf7cb6b6a164384ae82533f (patch) | |
tree | 1ebf71caef8f963049df0550e3f97b56576651c7 /sw | |
parent | d7ddac208516ce2350c84c434aad933b345c9509 (diff) |
ReqIF: 'ol' elements must have no 'type' attribute
Change-Id: I62098bac9dc3751f7b939cbf94f1561b4539a294
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152368
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/htmlexport/data/listsWithNumFormat.fodt | 74 | ||||
-rw-r--r-- | sw/qa/extras/htmlexport/htmlexport.cxx | 17 | ||||
-rw-r--r-- | sw/source/filter/html/htmlnumwriter.cxx | 5 |
3 files changed, 95 insertions, 1 deletions
diff --git a/sw/qa/extras/htmlexport/data/listsWithNumFormat.fodt b/sw/qa/extras/htmlexport/data/listsWithNumFormat.fodt new file mode 100644 index 000000000000..c9a8225662a9 --- /dev/null +++ b/sw/qa/extras/htmlexport/data/listsWithNumFormat.fodt @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:automatic-styles> + <text:list-style style:name="A_upper"> + <text:list-level-style-number text:level="1" style:num-suffix="." style:num-format="A"/> + </text:list-style> + <text:list-style style:name="a_lower"> + <text:list-level-style-number text:level="1" style:num-suffix="." style:num-format="a"/> + </text:list-style> + <text:list-style style:name="I_upper"> + <text:list-level-style-number text:level="1" style:num-suffix="." style:num-format="I"/> + </text:list-style> + <text:list-style style:name="i_lower"> + <text:list-level-style-number text:level="1" style:num-suffix="." style:num-format="i"/> + </text:list-style> + </office:automatic-styles> + <office:body> + <office:text> + <text:p>List A</text:p> + <text:list text:style-name="A_upper"> + <text:list-item> + <text:p>First</text:p> + </text:list-item> + <text:list-item> + <text:p>Second</text:p> + </text:list-item> + <text:list-item> + <text:p>Third</text:p> + </text:list-item> + </text:list> + <text:p/> + <text:p>List a</text:p> + <text:list text:style-name="a_lower"> + <text:list-item> + <text:p>First</text:p> + </text:list-item> + <text:list-item> + <text:p>Second</text:p> + </text:list-item> + <text:list-item> + <text:p>Third</text:p> + </text:list-item> + </text:list> + <text:p/> + <text:p>List I</text:p> + <text:list text:style-name="I_upper"> + <text:list-item> + <text:p>First</text:p> + </text:list-item> + <text:list-item> + <text:p>Second</text:p> + </text:list-item> + <text:list-item> + <text:p>Third</text:p> + </text:list-item> + </text:list> + <text:p/> + <text:p>List i</text:p> + <text:list text:style-name="i_lower"> + <text:list-item> + <text:p>First</text:p> + </text:list-item> + <text:list-item> + <text:p>Second</text:p> + </text:list-item> + <text:list-item> + <text:p>Third</text:p> + </text:list-item> + </text:list> + <text:p/> + </office:text> + </office:body> +</office:document>
\ No newline at end of file diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index da0b8bd4c673..a0524ca3f2b5 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -2659,6 +2659,23 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_RightAlignedTable) assertXPathNoAttribute(pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:div", "align"); } +CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_ListsWithNumFormat) +{ + createSwDoc("listsWithNumFormat.fodt"); + ExportToReqif(); + + SvMemoryStream aStream; + WrapReqifFromTempFile(aStream); + xmlDocUniquePtr pDoc = parseXmlStream(&aStream); + CPPUNIT_ASSERT(pDoc); + + // No 'type' attribute must be present in 'ol' + assertXPathNoAttribute(pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ol[1]", "type"); + assertXPathNoAttribute(pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ol[2]", "type"); + assertXPathNoAttribute(pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ol[3]", "type"); + assertXPathNoAttribute(pDoc, "/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:ol[4]", "type"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/html/htmlnumwriter.cxx b/sw/source/filter/html/htmlnumwriter.cxx index 98b581700224..6f8f52cc3f7c 100644 --- a/sw/source/filter/html/htmlnumwriter.cxx +++ b/sw/source/filter/html/htmlnumwriter.cxx @@ -219,8 +219,10 @@ SwHTMLWriter& OutHTML_NumberBulletListStart( SwHTMLWriter& rWrt, // determine the type by the format char cType = 0; - switch( eType ) + if (!rWrt.mbReqIF) // No 'type' attribute in ReqIF { + switch (eType) + { case SVX_NUM_CHARS_UPPER_LETTER: case SVX_NUM_CHARS_UPPER_LETTER_N: cType = 'A'; @@ -235,6 +237,7 @@ SwHTMLWriter& OutHTML_NumberBulletListStart( SwHTMLWriter& rWrt, case SVX_NUM_ROMAN_LOWER: cType = 'i'; break; + } } if( cType ) { |