summaryrefslogtreecommitdiff
path: root/writerperfect/qa/unit
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-08-29 17:56:28 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-08-30 10:02:32 +0200
commitdfdc113bbd852e8f4b4863db457e2938aaad0c64 (patch)
treeb6b0b5304a7fe1a345b69951448f46d9fec013fc /writerperfect/qa/unit
parent0be2ac10cb4baf14e8ba9f30a10c5b5ad3a7197d (diff)
EPUB export: support char props on text outside a span
The librevenge model is simpler: text is always in a span, and paragraph (automatic) styles don't contain char props, either. So handle this complexity on our side. Change-Id: I017222539d8981d2bbbc632258662444bf3a79c8 Reviewed-on: https://gerrit.libreoffice.org/41705 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'writerperfect/qa/unit')
-rw-r--r--writerperfect/qa/unit/EPUBExportTest.cxx12
-rw-r--r--writerperfect/qa/unit/data/writer/epubexport/para-autostyle-char-props.fodt21
2 files changed, 33 insertions, 0 deletions
diff --git a/writerperfect/qa/unit/EPUBExportTest.cxx b/writerperfect/qa/unit/EPUBExportTest.cxx
index 857f6ec85df3..fef1cf19770c 100644
--- a/writerperfect/qa/unit/EPUBExportTest.cxx
+++ b/writerperfect/qa/unit/EPUBExportTest.cxx
@@ -52,6 +52,7 @@ public:
void testEPUB2();
void testPageBreakSplit();
void testSpanAutostyle();
+ void testParaAutostyleCharProps();
CPPUNIT_TEST_SUITE(EPUBExportTest);
CPPUNIT_TEST(testOutlineLevel);
@@ -59,6 +60,7 @@ public:
CPPUNIT_TEST(testEPUB2);
CPPUNIT_TEST(testPageBreakSplit);
CPPUNIT_TEST(testSpanAutostyle);
+ CPPUNIT_TEST(testParaAutostyleCharProps);
CPPUNIT_TEST_SUITE_END();
};
@@ -190,6 +192,16 @@ void EPUBExportTest::testSpanAutostyle()
assertXPath(mpXmlDoc, "//xhtml:p/xhtml:span[3]", "class", "span2");
}
+void EPUBExportTest::testParaAutostyleCharProps()
+{
+ createDoc("para-autostyle-char-props.fodt", {});
+
+ mpXmlDoc = parseExport("OEBPS/sections/section0001.xhtml");
+ // This failed, para-level char props were not exported.
+ assertXPath(mpXmlDoc, "//xhtml:p[1]/xhtml:span", "class", "span0");
+ assertXPath(mpXmlDoc, "//xhtml:p[2]/xhtml:span", "class", "span1");
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(EPUBExportTest);
}
diff --git a/writerperfect/qa/unit/data/writer/epubexport/para-autostyle-char-props.fodt b/writerperfect/qa/unit/data/writer/epubexport/para-autostyle-char-props.fodt
new file mode 100644
index 000000000000..ceb556940b8f
--- /dev/null
+++ b/writerperfect/qa/unit/data/writer/epubexport/para-autostyle-char-props.fodt
@@ -0,0 +1,21 @@
+<?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:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text">
+ <office:font-face-decls>
+ <style:font-face style:name="Liberation Serif" svg:font-family="&apos;Liberation Serif&apos;" style:font-family-generic="roman" style:font-pitch="variable"/>
+ <style:font-face style:name="Liberation Sans" svg:font-family="&apos;Liberation Sans&apos;" style:font-family-generic="swiss" style:font-pitch="variable"/>
+ </office:font-face-decls>
+ <office:automatic-styles>
+ <style:style style:name="P1" style:family="paragraph">
+ <style:text-properties style:font-name="Liberation Serif"/>
+ </style:style>
+ <style:style style:name="P2" style:family="paragraph">
+ <style:text-properties style:font-name="Liberation Sans"/>
+ </style:style>
+ </office:automatic-styles>
+ <office:body>
+ <office:text>
+ <text:p text:style-name="P1">This is serif.</text:p>
+ <text:p text:style-name="P2">This is sans.</text:p>
+ </office:text>
+ </office:body>
+</office:document>