diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-12-01 10:59:36 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-12-04 09:07:27 +0100 |
commit | e83d7993d46b096ecc18c01d92d39e170cce18c1 (patch) | |
tree | daa5c81c6dbd076027876128fa8ca958f9e1f0b4 /writerperfect/qa | |
parent | 3ed8466b55ace15a28761e06b6bb76ebd8758106 (diff) |
EPUB export, fixed layout: disable DTD string in SVG header
epubcheck complains:
ERROR(HTM-003): test.epub/OEBPS/images/image0001.svg(5675,37): External entities are not allowed in EPUB v3 documents. External entity declaration found: %svg-extensibility.mod.
and similar ones. Just not writing the DTD header is enough to address
the error.
Change-Id: I5307e932a0f07585297cce734aceae77e43cc7a6
Reviewed-on: https://gerrit.libreoffice.org/45648
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'writerperfect/qa')
-rw-r--r-- | writerperfect/qa/unit/EPUBExportTest.cxx | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/writerperfect/qa/unit/EPUBExportTest.cxx b/writerperfect/qa/unit/EPUBExportTest.cxx index bd42356e60ce..178041d9c0da 100644 --- a/writerperfect/qa/unit/EPUBExportTest.cxx +++ b/writerperfect/qa/unit/EPUBExportTest.cxx @@ -96,6 +96,7 @@ public: void testPopup(); void testPopupAPI(); void testPageSize(); + void testSVG(); CPPUNIT_TEST_SUITE(EPUBExportTest); CPPUNIT_TEST(testOutlineLevel); @@ -139,6 +140,7 @@ public: CPPUNIT_TEST(testPopup); CPPUNIT_TEST(testPopupAPI); CPPUNIT_TEST(testPageSize); + CPPUNIT_TEST(testSVG); CPPUNIT_TEST_SUITE_END(); }; @@ -813,6 +815,29 @@ void EPUBExportTest::testPageSize() assertXPath(mpXmlDoc, "/xhtml:html/xhtml:head/xhtml:meta[@name='viewport']", "content", "width=816, height=1056"); } +void EPUBExportTest::testSVG() +{ + uno::Sequence<beans::PropertyValue> aFilterData(comphelper::InitPropertySequence( + { + {"EPUBLayoutMethod", uno::makeAny(static_cast<sal_Int32>(libepubgen::EPUB_LAYOUT_METHOD_FIXED))} + })); + createDoc("hello.fodt", aFilterData); + + CPPUNIT_ASSERT(mxZipFile->hasByName("OEBPS/images/image0001.svg")); + uno::Reference<io::XInputStream> xInputStream(mxZipFile->getByName("OEBPS/images/image0001.svg"), uno::UNO_QUERY); + std::shared_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true)); + + SvMemoryStream aMemoryStream; + aMemoryStream.WriteStream(*pStream); + OString aExpected("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<svg"); + CPPUNIT_ASSERT(aMemoryStream.GetSize() > static_cast<sal_uInt64>(aExpected.getLength())); + + // This failed, there was a '<!DOCTYPE' line between the xml and the svg + // one, causing a validation error. + OString aActual(static_cast<const char *>(aMemoryStream.GetBuffer()), aExpected.getLength()); + CPPUNIT_ASSERT_EQUAL(aExpected, aActual); +} + CPPUNIT_TEST_SUITE_REGISTRATION(EPUBExportTest); } |