[Libreoffice-commits] core.git: sw/qa sw/source
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Wed Mar 24 19:05:54 UTC 2021
sw/qa/extras/htmlexport/htmlexport.cxx | 33 +++++++++++++++++++++++++++++++++
sw/source/filter/html/htmltabw.cxx | 6 ++++++
2 files changed, 39 insertions(+)
New commits:
commit ab6a7a9addfc059d8f1fbeaa6c6012666629d420
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Wed Mar 24 16:38:18 2021 +0100
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed Mar 24 20:05:13 2021 +0100
sw reqif-xhtml export: fix unexpected height for <td>
The ReqIF validator complains about this, similar to the already
disabled width.
Change-Id: I05137a9dcc7e94bffe92269e98d310724a144b24
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113061
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
Tested-by: Jenkins
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx
index 295acb34f04c..52eb25978a10 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -740,6 +740,39 @@ DECLARE_HTMLEXPORT_TEST(testReqIfTable2, "reqif-table2.odt")
CPPUNIT_ASSERT(aStream.indexOf("<reqif-xhtml:td>") != -1);
}
+CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIfTableHeight)
+{
+ // Given a document with a table in it, with an explicit row height:
+ loadURL("private:factory/swriter", nullptr);
+ uno::Sequence<beans::PropertyValue> aTableProperties = {
+ comphelper::makePropertyValue("Rows", static_cast<sal_Int32>(1)),
+ comphelper::makePropertyValue("Columns", static_cast<sal_Int32>(1)),
+ };
+ dispatchCommand(mxComponent, ".uno:InsertTable", aTableProperties);
+ uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(),
+ uno::UNO_QUERY);
+ uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xRow(xTable->getRows()->getByIndex(0), uno::UNO_QUERY);
+ xRow->setPropertyValue("Height", uno::makeAny(static_cast<sal_Int32>(1000)));
+
+ // When exporting to reqif-xhtml:
+ uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
+ uno::Sequence<beans::PropertyValue> aStoreProperties = {
+ comphelper::makePropertyValue("FilterName", OUString("HTML (StarWriter)")),
+ comphelper::makePropertyValue("FilterOptions", OUString("xhtmlns=reqif-xhtml")),
+ };
+ xStorable->storeToURL(maTempFile.GetURL(), aStoreProperties);
+
+ // Then make sure that the explicit cell height is omitted from the output:
+ SvMemoryStream aStream;
+ HtmlExportTest::wrapFragment(maTempFile, aStream);
+ xmlDocUniquePtr pDoc = parseXmlStream(&aStream);
+ // Without the accompanying fix in place, this test would have failed, explicit height was
+ // written, which is not valid reqif-xhtml.
+ assertXPathNoAttribute(pDoc, "//reqif-xhtml:td", "height");
+}
+
DECLARE_HTMLEXPORT_TEST(testXHTMLUseCSS, "xhtml-css.odt")
{
SvStream* pStream = maTempFile.GetStream(StreamMode::READ);
diff --git a/sw/source/filter/html/htmltabw.cxx b/sw/source/filter/html/htmltabw.cxx
index 4c83319747b7..8c1ace39bc2e 100644
--- a/sw/source/filter/html/htmltabw.cxx
+++ b/sw/source/filter/html/htmltabw.cxx
@@ -380,6 +380,12 @@ void SwHTMLWrtTable::OutTableCell( SwHTMLWriter& rWrt,
sOut.append("\"");
}
+ if (rWrt.mbReqIF)
+ {
+ // ReqIF implies strict XHTML: no height for <td>.
+ nHeight = 0;
+ }
+
if( nHeight )
{
sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_height)
More information about the Libreoffice-commits
mailing list