From c2e8a96a8107a37901e475c65a8e61211fc3b132 Mon Sep 17 00:00:00 2001 From: Tünde Tóth Date: Thu, 31 Mar 2022 13:11:04 +0200 Subject: tdf#53970 PPTX: fix broken export of linked media files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Missing TargetMode="External" in the export of linked media files resulted corrupted PPTX. Change-Id: I76246db331d199810a5b413d44bec95283e88e47 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132402 Tested-by: László Németh Reviewed-by: László Németh --- sd/qa/unit/data/odp/tdf53970_linked.odp | Bin 0 -> 13158 bytes sd/qa/unit/export-tests-ooxml2.cxx | 27 +++++++++++++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 sd/qa/unit/data/odp/tdf53970_linked.odp (limited to 'sd') diff --git a/sd/qa/unit/data/odp/tdf53970_linked.odp b/sd/qa/unit/data/odp/tdf53970_linked.odp new file mode 100644 index 000000000000..3ddb7933463f Binary files /dev/null and b/sd/qa/unit/data/odp/tdf53970_linked.odp differ diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index a620386ad22d..5fac35ea1833 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -1804,15 +1804,30 @@ void SdOOXMLExportTest2::testTdf59323_slideFooters() void SdOOXMLExportTest2::testTdf53970() { - ::sd::DrawDocShellRef xDocShRef - = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf53970.odp"), ODP); - xDocShRef = saveAndReload(xDocShRef.get(), PPTX); + // Embedded media file + { + ::sd::DrawDocShellRef xDocShRef + = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf53970.odp"), ODP); + xDocShRef = saveAndReload(xDocShRef.get(), PPTX); + // Without fix in place, the media shape was lost on export. + CPPUNIT_ASSERT(getPage(0, xDocShRef)->hasElements()); - // Without fix in place, the media shape was lost on export. - CPPUNIT_ASSERT(getPage(0, xDocShRef)->hasElements()); + xDocShRef->DoClose(); + } - xDocShRef->DoClose(); + // Linked media file + { + ::sd::DrawDocShellRef xDocShRef = loadURL( + m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf53970_linked.odp"), ODP); + utl::TempFile tempFile; + xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); + xDocShRef->DoClose(); + + xmlDocUniquePtr pXmlRels = parseExport(tempFile, "ppt/slides/_rels/slide1.xml.rels"); + CPPUNIT_ASSERT(pXmlRels); + assertXPath(pXmlRels, "/rels:Relationships/rels:Relationship[@TargetMode='External']", 2); + } } CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2); -- cgit