diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-11-30 08:49:10 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-11-30 15:36:10 +0100 |
commit | 98770243f7f5387aae06e83ed4de0d68e02abb02 (patch) | |
tree | 7df0c5a943bbfb34251625b0270813ab8e4e1b8a /writerperfect/qa | |
parent | 1a48cdaf91633b354fb1110c566c766a4398fba0 (diff) |
EPUB export: allow setting custom metadata explicitly
If not set, fall back to the existing auto-find. The testcase now
asserts that the priority is:
- api
- if that is not set, then xmp
- if that is not set, then doc
(And at the end libepubgen itself has some defaults as well.)
Change-Id: Ie8fc646b81c4a287690fd2eeed43f4786b7938bf
Reviewed-on: https://gerrit.libreoffice.org/45552
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'writerperfect/qa')
-rw-r--r-- | writerperfect/qa/uitest/epubexport/epubexport.py | 4 | ||||
-rw-r--r-- | writerperfect/qa/unit/EPUBExportTest.cxx | 25 | ||||
-rw-r--r-- | writerperfect/qa/unit/data/writer/epubexport/meta-xmp.fodt | 8 |
3 files changed, 33 insertions, 4 deletions
diff --git a/writerperfect/qa/uitest/epubexport/epubexport.py b/writerperfect/qa/uitest/epubexport/epubexport.py index aaac6759adac..8db15c5bf891 100644 --- a/writerperfect/qa/uitest/epubexport/epubexport.py +++ b/writerperfect/qa/uitest/epubexport/epubexport.py @@ -79,8 +79,8 @@ class EPUBExportTest(UITestCase): self.ui_test.execute_blocking_action(action=uiComponent.execute, dialog_handler=handleDialog) propertyValues = uiComponent.getPropertyValues() filterData = [i.Value for i in propertyValues if i.Name == "FilterData"][0] - # The EPUBCoverImage key was missing, EPUBExportDialog::OKClickHdl() did not set it. - coverImage = [i.Value for i in filterData if i.Name == "EPUBCoverImage"][0] + # The RVNGCoverImage key was missing, EPUBExportDialog::OKClickHdl() did not set it. + coverImage = [i.Value for i in filterData if i.Name == "RVNGCoverImage"][0] self.assertEqual("cover.png", coverImage) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/writerperfect/qa/unit/EPUBExportTest.cxx b/writerperfect/qa/unit/EPUBExportTest.cxx index 82452d958152..1760caa05096 100644 --- a/writerperfect/qa/unit/EPUBExportTest.cxx +++ b/writerperfect/qa/unit/EPUBExportTest.cxx @@ -62,6 +62,7 @@ public: void testParaAutostyleCharProps(); void testMeta(); void testMetaXMP(); + void testMetaAPI(); void testCoverImage(); void testParaNamedstyle(); void testCharNamedstyle(); @@ -96,6 +97,7 @@ public: CPPUNIT_TEST(testParaAutostyleCharProps); CPPUNIT_TEST(testMeta); CPPUNIT_TEST(testMetaXMP); + CPPUNIT_TEST(testMetaAPI); CPPUNIT_TEST(testCoverImage); CPPUNIT_TEST(testParaNamedstyle); CPPUNIT_TEST(testCharNamedstyle); @@ -350,12 +352,33 @@ void EPUBExportTest::testMetaXMP() assertXPathContent(mpXmlDoc, "/opf:package/opf:metadata/opf:meta[@property='dcterms:modified']", "2016-11-20T17:16:07Z"); } +void EPUBExportTest::testMetaAPI() +{ + uno::Sequence<beans::PropertyValue> aFilterData(comphelper::InitPropertySequence( + { + {"RVNGIdentifier", uno::makeAny(OUString("deadc0de-e394-4cd6-9b83-7172794612e5"))}, + {"RVNGTitle", uno::makeAny(OUString("unknown title from api"))}, + {"RVNGInitialCreator", uno::makeAny(OUString("unknown author from api"))}, + {"RVNGLanguage", uno::makeAny(OUString("hu"))}, + {"RVNGDate", uno::makeAny(OUString("2015-11-20T17:16:07Z"))} + })); + createDoc("meta-xmp.fodt", aFilterData); + mpXmlDoc = parseExport("OEBPS/content.opf"); + + // These were values from XMP (deadbeef, etc.), not from API. + assertXPathContent(mpXmlDoc, "/opf:package/opf:metadata/dc:identifier", "deadc0de-e394-4cd6-9b83-7172794612e5"); + assertXPathContent(mpXmlDoc, "/opf:package/opf:metadata/dc:title", "unknown title from api"); + assertXPathContent(mpXmlDoc, "/opf:package/opf:metadata/dc:creator", "unknown author from api"); + assertXPathContent(mpXmlDoc, "/opf:package/opf:metadata/dc:language", "hu"); + assertXPathContent(mpXmlDoc, "/opf:package/opf:metadata/opf:meta[@property='dcterms:modified']", "2015-11-20T17:16:07Z"); +} + void EPUBExportTest::testCoverImage() { OUString aCoverURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "meta.cover-image.png"; uno::Sequence<beans::PropertyValue> aFilterData(comphelper::InitPropertySequence( { - {"EPUBCoverImage", uno::makeAny(aCoverURL)} + {"RVNGCoverImage", uno::makeAny(aCoverURL)} })); createDoc("hello.fodt", aFilterData); mpXmlDoc = parseExport("OEBPS/content.opf"); diff --git a/writerperfect/qa/unit/data/writer/epubexport/meta-xmp.fodt b/writerperfect/qa/unit/data/writer/epubexport/meta-xmp.fodt index b245e9d7abce..9287ecb25a9e 100644 --- a/writerperfect/qa/unit/data/writer/epubexport/meta-xmp.fodt +++ b/writerperfect/qa/unit/data/writer/epubexport/meta-xmp.fodt @@ -1,5 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> -<office:document office:mimetype="application/vnd.oasis.opendocument.text" office:version="1.2" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"> +<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:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:meta> + <meta:initial-creator>unknown author from doc</meta:initial-creator> + <dc:title>unknown title from doc</dc:title> + <dc:language>de</dc:language> + <dc:date>2014-09-27T09:51:19.243117081</dc:date> + </office:meta> <office:body> <office:text> <text:p><text:span>Hello world!</text:span></text:p> |