diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-01-18 15:53:54 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-01-19 09:11:12 +0100 |
commit | 9035ee7c90ed5ff78864145fd92241491033c074 (patch) | |
tree | 9bbdf4bf8f8c6c285f55d446118ed7cadc65da49 /writerperfect/qa/unit | |
parent | d5d4166df8ad189761387146966c91d58c28076f (diff) |
EPUB export: accept relative links for image popup from default media dir
Previously:
- the user had to copy the linked image to the same dir as the doc
- set a relative link on the image (in ODF, it resulted in "../foo.png")
- copy the image to the media dir ("test" by default for "test.odt")
- export to EPUB to have the image popup
Now, additionally:
- relative link may point to the default media dir (in ODF, it results
in "../test/foo.png")
- no need to copy the image
- export to EPUB creates the popup
So one less step is necessary. The downside is that this way the
relative URL contain the base name of the document, so renaming the
document breaks these relative links.
Change-Id: I93894a28393d36a33dcec7bfe7c4a54fd83768da
Diffstat (limited to 'writerperfect/qa/unit')
-rw-r--r-- | writerperfect/qa/unit/EPUBExportTest.cxx | 14 | ||||
-rw-r--r-- | writerperfect/qa/unit/data/writer/epubexport/popup-media.odt | bin | 0 -> 10111 bytes | |||
-rw-r--r-- | writerperfect/qa/unit/data/writer/epubexport/popup-media/libreoffice.png | bin | 0 -> 714 bytes |
3 files changed, 14 insertions, 0 deletions
diff --git a/writerperfect/qa/unit/EPUBExportTest.cxx b/writerperfect/qa/unit/EPUBExportTest.cxx index 5a1c21c0e48f..176324b0dff7 100644 --- a/writerperfect/qa/unit/EPUBExportTest.cxx +++ b/writerperfect/qa/unit/EPUBExportTest.cxx @@ -94,6 +94,7 @@ public: void testImageLink(); void testFootnote(); void testPopup(); + void testPopupMedia(); void testPopupAPI(); void testPageSize(); void testSVG(); @@ -139,6 +140,7 @@ public: CPPUNIT_TEST(testImageLink); CPPUNIT_TEST(testFootnote); CPPUNIT_TEST(testPopup); + CPPUNIT_TEST(testPopupMedia); CPPUNIT_TEST(testPopupAPI); CPPUNIT_TEST(testPageSize); CPPUNIT_TEST(testSVG); @@ -791,6 +793,18 @@ void EPUBExportTest::testPopup() assertXPath(mpXmlDoc, "//xhtml:body/xhtml:aside[2]/xhtml:img", 1); } +void EPUBExportTest::testPopupMedia() +{ + // This is the same as testPopup(), but the links point to images in the + // default media directory, not in the document directory. + createDoc("popup-media.odt", {}); + + mpXmlDoc = parseExport("OEBPS/sections/section0001.xhtml"); + // Test image popup anchor. This failed, number of XPath nodes was 0. + assertXPath(mpXmlDoc, "//xhtml:body/xhtml:p[1]/xhtml:a", "type", "noteref"); + assertXPath(mpXmlDoc, "//xhtml:body/xhtml:p[1]/xhtml:a/xhtml:img", 1); +} + void EPUBExportTest::testPopupAPI() { // Make sure that the popup works with data from a media directory. diff --git a/writerperfect/qa/unit/data/writer/epubexport/popup-media.odt b/writerperfect/qa/unit/data/writer/epubexport/popup-media.odt Binary files differnew file mode 100644 index 000000000000..5f45e7ce8aef --- /dev/null +++ b/writerperfect/qa/unit/data/writer/epubexport/popup-media.odt diff --git a/writerperfect/qa/unit/data/writer/epubexport/popup-media/libreoffice.png b/writerperfect/qa/unit/data/writer/epubexport/popup-media/libreoffice.png Binary files differnew file mode 100644 index 000000000000..cc74f136fbdf --- /dev/null +++ b/writerperfect/qa/unit/data/writer/epubexport/popup-media/libreoffice.png |