summaryrefslogtreecommitdiffstats
path: root/sd/qa
diff options
context:
space:
mode:
Diffstat (limited to 'sd/qa')
-rw-r--r--sd/qa/unit/data/tdf159666.odgbin0 -> 20613 bytes
-rw-r--r--sd/qa/unit/export-tests-ooxml4.cxx45
-rw-r--r--sd/qa/unit/uiimpress.cxx21
3 files changed, 66 insertions, 0 deletions
diff --git a/sd/qa/unit/data/tdf159666.odg b/sd/qa/unit/data/tdf159666.odg
new file mode 100644
index 0000000000..6b407597f7
--- /dev/null
+++ b/sd/qa/unit/data/tdf159666.odg
Binary files 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<packages::zip::XZipFileAccess2> 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<size_t>(16), pActualPage->GetObjCount());
}
+CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf159666)
+{
+ createSdDrawDoc("tdf159666.odg");
+
+ auto pXImpressDocument = dynamic_cast<SdXImpressDocument*>(mxComponent.get());
+ sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
+ SdPage* pActualPage = pViewShell->GetActualPage();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(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<size_t>(0), pActualPage->GetObjCount());
+
+ dispatchCommand(mxComponent, ".uno:Undo", {});
+
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(12), pActualPage->GetObjCount());
+}
+
CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf143412)
{
createSdImpressDoc();