diff options
Diffstat (limited to 'writerperfect/qa/unit')
-rw-r--r-- | writerperfect/qa/unit/EPUBExportTest.cxx | 15 | ||||
-rw-r--r-- | writerperfect/qa/unit/data/writer/epubexport/escape.fodt | 16 |
2 files changed, 31 insertions, 0 deletions
diff --git a/writerperfect/qa/unit/EPUBExportTest.cxx b/writerperfect/qa/unit/EPUBExportTest.cxx index 0d869737fc8e..10fd5eb5a94a 100644 --- a/writerperfect/qa/unit/EPUBExportTest.cxx +++ b/writerperfect/qa/unit/EPUBExportTest.cxx @@ -63,6 +63,7 @@ public: void testNamedStyleInheritance(); void testNestedSpan(); void testLineBreak(); + void testEscape(); CPPUNIT_TEST_SUITE(EPUBExportTest); CPPUNIT_TEST(testOutlineLevel); @@ -77,6 +78,7 @@ public: CPPUNIT_TEST(testNamedStyleInheritance); CPPUNIT_TEST(testNestedSpan); CPPUNIT_TEST(testLineBreak); + CPPUNIT_TEST(testEscape); CPPUNIT_TEST_SUITE_END(); }; @@ -330,6 +332,19 @@ void EPUBExportTest::testLineBreak() assertXPath(mpXmlDoc, "//xhtml:p[2]/xhtml:br", 1); } +void EPUBExportTest::testEscape() +{ + createDoc("escape.fodt", {}); + + mpXmlDoc = parseExport("OEBPS/sections/section0001.xhtml"); + // This was lost. + assertXPathContent(mpXmlDoc, "//xhtml:p[1]/xhtml:span[1]", OUString::fromUtf8("\xc2\xa0")); + // Make sure escaping happens only once. + assertXPathContent(mpXmlDoc, "//xhtml:p[1]/xhtml:span[2]", "a&b"); + // This was also lost. + assertXPathContent(mpXmlDoc, "//xhtml:p[1]/xhtml:span[3]", "\t"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(EPUBExportTest); } diff --git a/writerperfect/qa/unit/data/writer/epubexport/escape.fodt b/writerperfect/qa/unit/data/writer/epubexport/escape.fodt new file mode 100644 index 000000000000..8d23fb36ef1d --- /dev/null +++ b/writerperfect/qa/unit/data/writer/epubexport/escape.fodt @@ -0,0 +1,16 @@ +<?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" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:officeooo="http://openoffice.org/2009/office" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:automatic-styles> + <style:style style:name="T1" style:family="text"> + <style:text-properties officeooo:rsid="0006b966"/> + </style:style> + <style:style style:name="T2" style:family="text"> + <style:text-properties fo:font-weight="bold" officeooo:rsid="0006b966" style:font-weight-asian="bold" style:font-weight-complex="bold"/> + </style:style> + </office:automatic-styles> + <office:body> + <office:text> + <text:p><text:s/><text:span text:style-name="T1">a&b</text:span><text:span text:style-name="T2"><text:tab/></text:span></text:p> + </office:text> + </office:body> +</office:document> |