From 91fe6b97952aa6f7cef58327fd085a17db38ad95 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 11:44:47 +0200 Subject: Merging upstream version 4:24.2.2. Signed-off-by: Daniel Baumann --- sd/qa/unit/data/tdf159666.odg | Bin 0 -> 20613 bytes sd/qa/unit/export-tests-ooxml4.cxx | 45 +++++++++++++++++++++++++++++++++++++ sd/qa/unit/uiimpress.cxx | 21 +++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 sd/qa/unit/data/tdf159666.odg (limited to 'sd/qa') diff --git a/sd/qa/unit/data/tdf159666.odg b/sd/qa/unit/data/tdf159666.odg new file mode 100644 index 0000000000..6b407597f7 Binary files /dev/null and b/sd/qa/unit/data/tdf159666.odg differ diff --git a/sd/qa/unit/export-tests-ooxml4.cxx b/sd/qa/unit/export-tests-ooxml4.cxx index c4c061c50d..06cc2805d6 100644 --- a/sd/qa/unit/export-tests-ooxml4.cxx +++ b/sd/qa/unit/export-tests-ooxml4.cxx @@ -1095,6 +1095,51 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testTdf157740_slideMasters) assertXPath(pXmlDocContent, "/p:sldMaster/p:sldLayoutIdLst/p:sldLayoutId"_ostr, 1); } +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testTdf159931_slideLayouts) +{ + createSdImpressDoc("odp/repeatBitmapMode.odp"); + save("Impress Office Open XML"); + + xmlDocUniquePtr pXmlDocRels1 = parseExport("ppt/slides/_rels/slide1.xml.rels"); + xmlDocUniquePtr pXmlDocRels2 = parseExport("ppt/slides/_rels/slide2.xml.rels"); + + assertXPath( + pXmlDocRels1, + "(/rels:Relationships/rels:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout'])"_ostr); + + // the relative target e.g. "../slideLayouts/slideLayout2.xml" + OUString sRelativeLayoutPath1 = getXPathContent( + pXmlDocRels1, + "(/rels:Relationships/rels:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout'])/@Target"_ostr); + + assertXPath( + pXmlDocRels2, + "(/rels:Relationships/rels:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout'])"_ostr); + + // the relative target e.g. "../slideLayouts/slideLayout1.xml" + OUString sRelativeLayoutPath2 = getXPathContent( + pXmlDocRels2, + "(/rels:Relationships/rels:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout'])/@Target"_ostr); + + uno::Reference xNameAccess + = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory), + maTempFile.GetURL()); + + // Check that the referenced slideLayout files exist + // Without the accompanying fix in place, this test would have failed with: + // equality assertion failed + // - Expected: 1 + // - Actual : 0 + // i.e. the referenced slideLayout file was missing on export. + OUString sSlideLayoutName1 = sRelativeLayoutPath1.getToken(2, '/'); + OUString sSlideLayoutName2 = sRelativeLayoutPath2.getToken(2, '/'); + + CPPUNIT_ASSERT_EQUAL(true, + bool(xNameAccess->hasByName("ppt/slideLayouts/" + sSlideLayoutName1))); + CPPUNIT_ASSERT_EQUAL(true, + bool(xNameAccess->hasByName("ppt/slideLayouts/" + sSlideLayoutName2))); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx index 41c685feef..d03e85dab6 100644 --- a/sd/qa/unit/uiimpress.cxx +++ b/sd/qa/unit/uiimpress.cxx @@ -288,6 +288,27 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf124708) CPPUNIT_ASSERT_EQUAL(static_cast(16), pActualPage->GetObjCount()); } +CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf159666) +{ + createSdDrawDoc("tdf159666.odg"); + + auto pXImpressDocument = dynamic_cast(mxComponent.get()); + sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); + SdPage* pActualPage = pViewShell->GetActualPage(); + CPPUNIT_ASSERT_EQUAL(static_cast(12), pActualPage->GetObjCount()); + + // Without the fix in place, this test would have crashed here + dispatchCommand(mxComponent, ".uno:SelectAll", {}); + + dispatchCommand(mxComponent, ".uno:Delete", {}); + + CPPUNIT_ASSERT_EQUAL(static_cast(0), pActualPage->GetObjCount()); + + dispatchCommand(mxComponent, ".uno:Undo", {}); + + CPPUNIT_ASSERT_EQUAL(static_cast(12), pActualPage->GetObjCount()); +} + CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf143412) { createSdImpressDoc(); -- cgit v1.2.3