summaryrefslogtreecommitdiffstats
path: root/writerperfect/qa
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-01-18 11:49:45 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-01-19 09:07:45 +0100
commit5c4d5021000584ac541e4d0323586c4ff926173f (patch)
tree7116ade1f81d473579374e8d023576dbea47b086 /writerperfect/qa
parentBlind fix for sal_Int32 = long (diff)
downloadcore-5c4d5021000584ac541e4d0323586c4ff926173f.tar.gz
core-5c4d5021000584ac541e4d0323586c4ff926173f.zip
EPUB export: fix validation error on invalid relative links
It's valid to have a relative link that points nowhere in ODF, but the same is not true for EPUB. Change-Id: I7884032e277a0c53d0c513cea70dd2ee29ccd85c
Diffstat (limited to 'writerperfect/qa')
-rw-r--r--writerperfect/qa/unit/EPUBExportTest.cxx11
-rw-r--r--writerperfect/qa/unit/data/writer/epubexport/image-link.fodt2
-rw-r--r--writerperfect/qa/unit/data/writer/epubexport/link-invalid.odtbin0 -> 9554 bytes
3 files changed, 12 insertions, 1 deletions
diff --git a/writerperfect/qa/unit/EPUBExportTest.cxx b/writerperfect/qa/unit/EPUBExportTest.cxx
index f52667a9b6ce..5a1c21c0e48f 100644
--- a/writerperfect/qa/unit/EPUBExportTest.cxx
+++ b/writerperfect/qa/unit/EPUBExportTest.cxx
@@ -85,6 +85,7 @@ public:
void testTableCellWidth();
void testTableRowHeight();
void testLink();
+ void testLinkInvalid();
void testLinkCharFormat();
void testLinkNamedCharFormat();
void testTableWidth();
@@ -129,6 +130,7 @@ public:
CPPUNIT_TEST(testTableCellWidth);
CPPUNIT_TEST(testTableRowHeight);
CPPUNIT_TEST(testLink);
+ CPPUNIT_TEST(testLinkInvalid);
CPPUNIT_TEST(testLinkCharFormat);
CPPUNIT_TEST(testLinkNamedCharFormat);
CPPUNIT_TEST(testTableWidth);
@@ -662,6 +664,15 @@ void EPUBExportTest::testLink()
assertXPath(mpXmlDoc, "//xhtml:p/xhtml:a", "href", "https://libreoffice.org/");
}
+void EPUBExportTest::testLinkInvalid()
+{
+ createDoc("link-invalid.odt", {});
+
+ mpXmlDoc = parseExport("OEBPS/sections/section0001.xhtml");
+ // This was 1, invalid relative link was not filtered out.
+ assertXPath(mpXmlDoc, "//xhtml:p/xhtml:a", 0);
+}
+
void EPUBExportTest::testLinkCharFormat()
{
createDoc("link-charformat.fodt", {});
diff --git a/writerperfect/qa/unit/data/writer/epubexport/image-link.fodt b/writerperfect/qa/unit/data/writer/epubexport/image-link.fodt
index 9414e36fd723..0796cea3e4b1 100644
--- a/writerperfect/qa/unit/data/writer/epubexport/image-link.fodt
+++ b/writerperfect/qa/unit/data/writer/epubexport/image-link.fodt
@@ -16,7 +16,7 @@
</office:master-styles>
<office:body>
<office:text>
- <text:p text:style-name="Standard"><draw:a xlink:type="simple" xlink:href="meta.cover-image.png"><draw:frame draw:style-name="fr1" draw:name="Image1" text:anchor-type="as-char" svg:width="1.806cm" svg:height="1.806cm" draw:z-index="0"><draw:image loext:mime-type="image/png"><office:binary-data>iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAQAAAAAYLlVAAAABGdBTUEAALGPC/xhBQAAAAFz
+ <text:p text:style-name="Standard"><draw:a xlink:type="simple" xlink:href="http://libreoffice.org/"><draw:frame draw:style-name="fr1" draw:name="Image1" text:anchor-type="as-char" svg:width="1.806cm" svg:height="1.806cm" draw:z-index="0"><draw:image loext:mime-type="image/png"><office:binary-data>iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAQAAAAAYLlVAAAABGdBTUEAALGPC/xhBQAAAAFz
UkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAA
AAJiS0dEAACqjSMyAAAACW9GRnMAAAAGAAAAAAAMc1XTAAAACXBIWXMAAA3XAAAN1wFCKJt4
AAAACXZwQWcAAABMAAAAQACdMTgbAAABzUlEQVRo3u3ZPU/CQBjA8X+Jxs3ESUDj4iK+LA5+
diff --git a/writerperfect/qa/unit/data/writer/epubexport/link-invalid.odt b/writerperfect/qa/unit/data/writer/epubexport/link-invalid.odt
new file mode 100644
index 000000000000..3bbbdeb921e3
--- /dev/null
+++ b/writerperfect/qa/unit/data/writer/epubexport/link-invalid.odt
Binary files differ