summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorSvante Schubert <svante.schubert@gmail.com>2023-05-17 17:44:39 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2023-06-09 15:12:40 +0200
commit2d9f739ccfead38cdaa13780f7bb5172553dbd77 (patch)
treec646ea7a0b8aa4269d5fd218ae448bed22e524de /sc
parent0b1a8cc4a59fadd83bdcf13ba88bb8f68d02e106 (diff)
tdf#155244 filter: XHTML export: Making ODF style IDs unique for ...
... HTML/CSS by adding a prefix (the @style:family with '-' as glue character) to their style name. Disabled debug output for style:family-name in XSL add text:a to text family ... and add a unit test. Change-Id: Ie846f5ea2a872872f38036aff59d29c8f530ed32 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152749 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'sc')
-rw-r--r--sc/CppunitTest_sc_html_export_test.mk5
-rw-r--r--sc/qa/extras/htmlexporttest.cxx18
-rw-r--r--sc/qa/extras/testdocuments/default-styles.odsbin0 -> 8881 bytes
3 files changed, 23 insertions, 0 deletions
diff --git a/sc/CppunitTest_sc_html_export_test.mk b/sc/CppunitTest_sc_html_export_test.mk
index f9da77710a29..bc64eb5b7803 100644
--- a/sc/CppunitTest_sc_html_export_test.mk
+++ b/sc/CppunitTest_sc_html_export_test.mk
@@ -67,6 +67,11 @@ $(eval $(call gb_CppunitTest_use_api,sc_html_export_test,\
oovbaapi \
))
+$(eval $(call gb_CppunitTest_use_packages,sc_html_export_test, \
+ filter_xhtml \
+ filter_xslt \
+))
+
$(eval $(call gb_CppunitTest_use_ure,sc_html_export_test))
$(eval $(call gb_CppunitTest_use_vcl,sc_html_export_test))
diff --git a/sc/qa/extras/htmlexporttest.cxx b/sc/qa/extras/htmlexporttest.cxx
index f65e027ae62e..6e28d791fbb3 100644
--- a/sc/qa/extras/htmlexporttest.cxx
+++ b/sc/qa/extras/htmlexporttest.cxx
@@ -50,8 +50,26 @@ public:
assertXPath(pDoc, "/html/body/table/tr/td/img", 0);
}
+ void testTdf155244()
+ {
+ loadFromURL(u"default-styles.ods");
+ save("XHTML Calc File");
+
+ xmlDocUniquePtr pXmlDoc = parseXml(maTempFile);
+ CPPUNIT_ASSERT(pXmlDoc);
+
+ assertXPath(pXmlDoc, "/xhtml:html", 1);
+ // the problem was that there were 2 CSS styles named "Default"
+ assertXPath(pXmlDoc, "/xhtml:html/xhtml:body/xhtml:table/xhtml:tr/xhtml:td", "class", "cell-Default");
+ OUString const styles = getXPathContent(pXmlDoc, "/xhtml:html/xhtml:head/xhtml:style");
+ CPPUNIT_ASSERT(styles.indexOf(".graphic-Default{ background-color:#729fcf;") != -1);
+ CPPUNIT_ASSERT(styles.indexOf(".cell-Default{ font-size:10pt; font-family:'Liberation Sans'; }") != -1);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), styles.indexOf(".Default"));
+ }
+
CPPUNIT_TEST_SUITE(ScHTMLExportTest);
CPPUNIT_TEST(testHtmlSkipImage);
+ CPPUNIT_TEST(testTdf155244);
CPPUNIT_TEST_SUITE_END();
};
diff --git a/sc/qa/extras/testdocuments/default-styles.ods b/sc/qa/extras/testdocuments/default-styles.ods
new file mode 100644
index 000000000000..d2167ed2023b
--- /dev/null
+++ b/sc/qa/extras/testdocuments/default-styles.ods
Binary files differ