summaryrefslogtreecommitdiff
path: root/writerperfect/qa
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-09-05 14:48:22 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-09-05 16:23:04 +0200
commite808bbe1ce51465e6f3e9dc4fec2ecd263fe0e4b (patch)
tree6405ef788a0965c3c5503c29596d256331d1262f /writerperfect/qa
parent0e16ea1f04fb099dceeda70565dac471bfe1ee7a (diff)
EPUB export: handle paragraph properties from paragraph styles
This adds support for inheriting paragraph properties from named paragraph styles. Change-Id: I3cb787f6704329a5e0d11d3cd0266254749ac5ae Reviewed-on: https://gerrit.libreoffice.org/41938 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'writerperfect/qa')
-rw-r--r--writerperfect/qa/unit/EPUBExportTest.cxx12
-rw-r--r--writerperfect/qa/unit/data/writer/epubexport/para-namedstyle.fodt18
2 files changed, 30 insertions, 0 deletions
diff --git a/writerperfect/qa/unit/EPUBExportTest.cxx b/writerperfect/qa/unit/EPUBExportTest.cxx
index 61a6da2941f0..5163c7234074 100644
--- a/writerperfect/qa/unit/EPUBExportTest.cxx
+++ b/writerperfect/qa/unit/EPUBExportTest.cxx
@@ -54,6 +54,7 @@ public:
void testSpanAutostyle();
void testParaAutostyleCharProps();
void testMeta();
+ void testParaNamedstyle();
CPPUNIT_TEST_SUITE(EPUBExportTest);
CPPUNIT_TEST(testOutlineLevel);
@@ -63,6 +64,7 @@ public:
CPPUNIT_TEST(testSpanAutostyle);
CPPUNIT_TEST(testParaAutostyleCharProps);
CPPUNIT_TEST(testMeta);
+ CPPUNIT_TEST(testParaNamedstyle);
CPPUNIT_TEST_SUITE_END();
};
@@ -215,6 +217,16 @@ void EPUBExportTest::testMeta()
assertXPathContent(mpXmlDoc, "/opf:package/opf:metadata/dc:title", "Title");
}
+void EPUBExportTest::testParaNamedstyle()
+{
+ createDoc("para-namedstyle.fodt", {});
+
+ mpXmlDoc = parseExport("OEBPS/sections/section0001.xhtml");
+ assertXPath(mpXmlDoc, "//xhtml:p[1]", "class", "para0");
+ // This failed, paragraph properties from style were not exported.
+ assertXPath(mpXmlDoc, "//xhtml:p[2]", "class", "para1");
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(EPUBExportTest);
}
diff --git a/writerperfect/qa/unit/data/writer/epubexport/para-namedstyle.fodt b/writerperfect/qa/unit/data/writer/epubexport/para-namedstyle.fodt
new file mode 100644
index 000000000000..887a5c1b2e8c
--- /dev/null
+++ b/writerperfect/qa/unit/data/writer/epubexport/para-namedstyle.fodt
@@ -0,0 +1,18 @@
+<?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 Sans" svg:font-family="&apos;Liberation Sans&apos;" style:font-family-generic="swiss" style:font-pitch="variable"/>
+ </office:font-face-decls>
+ <office:styles>
+ <style:style style:name="Heading" style:family="paragraph" style:class="text">
+ <style:paragraph-properties fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" fo:keep-with-next="always"/>
+ <style:text-properties style:font-name="Liberation Sans" fo:font-family="&apos;Liberation Sans&apos;" style:font-family-generic="swiss" style:font-pitch="variable" fo:font-size="14pt"/>
+ </style:style>
+ </office:styles>
+ <office:body>
+ <office:text>
+ <text:h text:style-name="Heading" text:outline-level="1">Heading</text:h>
+ <text:p>Text Body</text:p>
+ </office:text>
+ </office:body>
+</office:document>