summaryrefslogtreecommitdiff
path: root/writerperfect
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-09-21 10:00:17 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-09-22 08:14:34 +0200
commite590e4dd5e8d9e2fb94a5fff80fb5fd468a01de4 (patch)
tree94201e0f388953915969593583b7647930c72d25 /writerperfect
parenta6b80833b0e8e2601fed7b9bc89ff79087edaf20 (diff)
EPUB export: test image handling
Fails without commit 28102e471d3cb6b6976380ca84b1094078ac1af1 (EPUB export: handle inline images, 2017-08-17). Change-Id: Ie96430e9b2d988574464d359111619fc18109566 Reviewed-on: https://gerrit.libreoffice.org/42589 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'writerperfect')
-rw-r--r--writerperfect/qa/unit/EPUBExportTest.cxx22
-rw-r--r--writerperfect/qa/unit/data/writer/epubexport/image.fodt28
2 files changed, 50 insertions, 0 deletions
diff --git a/writerperfect/qa/unit/EPUBExportTest.cxx b/writerperfect/qa/unit/EPUBExportTest.cxx
index f86f6c395d22..5697e3c58c64 100644
--- a/writerperfect/qa/unit/EPUBExportTest.cxx
+++ b/writerperfect/qa/unit/EPUBExportTest.cxx
@@ -9,8 +9,10 @@
#include <libepubgen/libepubgen.h>
+#include <com/sun/star/document/XFilter.hpp>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/packages/zip/ZipFileAccess.hpp>
#include <comphelper/processfactory.hxx>
@@ -67,6 +69,7 @@ public:
void testParaCharProps();
void testSection();
void testList();
+ void testImage();
CPPUNIT_TEST_SUITE(EPUBExportTest);
CPPUNIT_TEST(testOutlineLevel);
@@ -85,6 +88,7 @@ public:
CPPUNIT_TEST(testParaCharProps);
CPPUNIT_TEST(testSection);
CPPUNIT_TEST(testList);
+ CPPUNIT_TEST(testImage);
CPPUNIT_TEST_SUITE_END();
};
@@ -202,6 +206,16 @@ void EPUBExportTest::testMimetype()
// This was just "libepubgen/x.y.z", i.e. the LO version was missing.
OUString aGenerator = getXPath(mpXmlDoc, "/opf:package/opf:metadata/opf:meta[@name='generator']", "content");
CPPUNIT_ASSERT(aGenerator.startsWith(utl::DocInfoHelper::GetGeneratorString()));
+
+ uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponentContext->getServiceManager(), uno::UNO_QUERY);
+ const OUString aServiceName("com.sun.star.comp.Writer.EPUBExportFilter");
+ uno::Reference<document::XFilter> xFilter(xMSF->createInstance(aServiceName), uno::UNO_QUERY);
+ // Should result in no errors.
+ xFilter->cancel();
+ // We got back what we expected.
+ uno::Reference<lang::XServiceInfo> xServiceInfo(xFilter, uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(aServiceName, xServiceInfo->getImplementationName());
+ CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.document.ExportFilter"));
}
void EPUBExportTest::testEPUB2()
@@ -419,6 +433,14 @@ void EPUBExportTest::testList()
assertXPathContent(mpXmlDoc, "//xhtml:p[2]/xhtml:span", "B");
}
+void EPUBExportTest::testImage()
+{
+ createDoc("image.fodt", {});
+
+ mpXmlDoc = parseExport("OEBPS/sections/section0001.xhtml");
+ assertXPath(mpXmlDoc, "//xhtml:p/xhtml:img", 1);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(EPUBExportTest);
}
diff --git a/writerperfect/qa/unit/data/writer/epubexport/image.fodt b/writerperfect/qa/unit/data/writer/epubexport/image.fodt
new file mode 100644
index 000000000000..52e6d2b97272
--- /dev/null
+++ b/writerperfect/qa/unit/data/writer/epubexport/image.fodt
@@ -0,0 +1,28 @@
+<?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:draw="urn:oasis:names:tc:opendocument:xmlns:drawing: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" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" 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 fo:color="#000000" style:font-size-complex="12pt"/>
+ </style:style>
+ </office:automatic-styles>
+ <office:body>
+ <office:text>
+ <text:p>before<text:span text:style-name="T1"><draw:frame draw:name="Object0" text:anchor-type="as-char" svg:y="0cm" svg:width="1.663cm" svg:height="1.663cm" draw:z-index="0"><draw:image loext:mime-type="image/png"><office:binary-data>iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAQAAAAAYLlVAAAABGdBTUEAALGPC/xhBQAAAAFz
+ UkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAA
+ AAJiS0dEAACqjSMyAAAACW9GRnMAAAAGAAAAAAAMc1XTAAAACXBIWXMAAA3XAAAN1wFCKJt4
+ AAAACXZwQWcAAABMAAAAQACdMTgbAAABzUlEQVRo3u3ZPU/CQBjA8X+Jxs3ESUDj4iK+LA5+
+ BBfjqBE1cXB2MlFAEqMgxvhNNL4sLsK3UPQL6ObkoAETz+FKW2mxCPRYnucWUu76/OC59C49
+ cGOCKqrD9kHRc6ddPv7oW2WCwMh0nF63Myz7Tm8hPTNu0pgHMER3scepTbgK6enJNND83RLn
+ /878yRaPmgBZFDuMsNLeWB9gmFQHP77MIg9gsYciR50NFKvtjIy10yk84pSZA7DYpwR8scmF
+ QQCMuoQMpzbh0iAARrlnVn90CWHTsZcAiHPPdINQAuqsc2MQAAnKDUKWEhZ10twaBEDSJWQo
+ YlFj7S9CzwEegkXWIbQsRAQASFJhpplwbRAACS+hANRJBxMiAkDcJeQ4sQkBhYgMoJ+Ozlwo
+ 2YQ7AJ6CRxyiUGnVy3hVKb0Af9v7hUG2Wy9TEQCUelFTDULB2S+YKYGOMcpM6UIccOQnRA6A
+ cSp6ibfI+wkGADBGpTEd8xz1AaAfTQ7huA8AvUw5hVjuA0D/C5OaMN8XACRZ8F0zCggKAQhA
+ AAIQgAAEIAABCEAAAhCAAAQgAAH4zg3feY4w3Xs44M5+oW0qvCWoGcvaIlM3x/f/ab+O738A
+ hOCNQr34oD4AAAAldEVYdGNyZWF0ZS1kYXRlADIwMTAtMTItMjBUMTc6MDg6MzYrMDE6MDB6
+ 5RscAAAAJXRFWHRtb2RpZnktZGF0ZQAyMDEwLTEyLTIwVDE3OjA4OjM3KzAxOjAwgyNmnAAA
+ AABJRU5ErkJggg==
+ </office:binary-data></draw:image></draw:frame></text:span>after</text:p>
+ </office:text>
+ </office:body>
+</office:document>