From 5c4d5021000584ac541e4d0323586c4ff926173f Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Thu, 18 Jan 2018 11:49:45 +0100 Subject: 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 --- writerperfect/qa/unit/EPUBExportTest.cxx | 11 +++++++++++ .../qa/unit/data/writer/epubexport/image-link.fodt | 2 +- .../qa/unit/data/writer/epubexport/link-invalid.odt | Bin 0 -> 9554 bytes 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 writerperfect/qa/unit/data/writer/epubexport/link-invalid.odt (limited to 'writerperfect/qa') 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 @@ - iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAQAAAAAYLlVAAAABGdBTUEAALGPC/xhBQAAAAFz + 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 Binary files /dev/null and b/writerperfect/qa/unit/data/writer/epubexport/link-invalid.odt differ -- cgit