summaryrefslogtreecommitdiff
path: root/sd/qa/unit
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2024-02-12 16:35:49 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2024-02-12 21:00:39 +0100
commit0ac4f5130e823bb64c0519838ebe3aab1da97aaf (patch)
tree9986b4b6d8673f80ec93031b43b1458339ff20c6 /sd/qa/unit
parentc84e8a14e476a70989e66df142e7b2426df02617 (diff)
tdf#159666: sd_uiimpress: Add unittest
Change-Id: Id5e35e1514695bffeced718d48dcfeffc4a4d4d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163250 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sd/qa/unit')
-rw-r--r--sd/qa/unit/data/tdf159666.odgbin0 -> 20613 bytes
-rw-r--r--sd/qa/unit/uiimpress.cxx21
2 files changed, 21 insertions, 0 deletions
diff --git a/sd/qa/unit/data/tdf159666.odg b/sd/qa/unit/data/tdf159666.odg
new file mode 100644
index 000000000000..6b407597f7ca
--- /dev/null
+++ b/sd/qa/unit/data/tdf159666.odg
Binary files differ
diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx
index 41c685feef36..d03e85dab6c8 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();