Kaydet (Commit) e590e4dd authored tarafından Miklos Vajna's avatar Miklos Vajna

EPUB export: test image handling

Fails without commit 28102e47 (EPUB
export: handle inline images, 2017-08-17).

Change-Id: Ie96430e9b2d988574464d359111619fc18109566
Reviewed-on: https://gerrit.libreoffice.org/42589Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst a6b80833
......@@ -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);
}
......
<?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>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment