summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2020-04-02 18:49:05 +0200
committerXisco Faulí <xiscofauli@libreoffice.org>2020-04-03 12:13:10 +0200
commit3acf7f20bdf8a54544b459235a84b5c26539a561 (patch)
tree221f208467ca728dda970fc5e13718fbac8d2df2 /sd
parentd9e478330243cbd120f2de33df3333fec2ef9217 (diff)
tdf#127481: Add unittest
Change-Id: I8e0fa60eb6a10be6c7f7b1d1742e236a790e74a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91599 Tested-by: Jenkins Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/uiimpress.cxx39
1 files changed, 39 insertions, 0 deletions
diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx
index 0950215e00b3..31c76fdbd0a9 100644
--- a/sd/qa/unit/uiimpress.cxx
+++ b/sd/qa/unit/uiimpress.cxx
@@ -15,12 +15,14 @@
#include <com/sun/star/uno/Reference.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/propertysequence.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/request.hxx>
#include <sfx2/viewfrm.hxx>
#include <svl/intitem.hxx>
#include <svx/svxids.hrc>
#include <svx/svdoashp.hxx>
+#include <svx/svdotable.hxx>
#include <svl/stritem.hxx>
#include <undo/undomanager.hxx>
#include <vcl/scheduler.hxx>
@@ -226,6 +228,43 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf129346)
checkCurrentPageNumber(1);
}
+CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf127481)
+{
+ mxComponent = loadFromDesktop("private:factory/simpress",
+ "com.sun.star.presentation.PresentationDocument");
+
+ CPPUNIT_ASSERT(mxComponent.is());
+
+ auto pXImpressDocument = dynamic_cast<SdXImpressDocument*>(mxComponent.get());
+ sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell();
+ SdPage* pActualPage = pViewShell->GetActualPage();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), pActualPage->GetObjCount());
+
+ uno::Sequence<beans::PropertyValue> aArgs(comphelper::InitPropertySequence(
+ { { "Rows", uno::makeAny(sal_Int32(1)) }, { "Columns", uno::makeAny(sal_Int32(1)) } }));
+
+ dispatchCommand(mxComponent, ".uno:InsertTable", aArgs);
+ Scheduler::ProcessEventsToIdle();
+
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), pActualPage->GetObjCount());
+
+ dispatchCommand(mxComponent, ".uno:DuplicatePage", aArgs);
+ Scheduler::ProcessEventsToIdle();
+
+ checkCurrentPageNumber(2);
+
+ pActualPage = pViewShell->GetActualPage();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), pActualPage->GetObjCount());
+
+ auto pTableObject = dynamic_cast<sdr::table::SdrTableObj*>(pActualPage->GetObj(2));
+ CPPUNIT_ASSERT(pTableObject);
+
+ //without the fix, it would crash here
+ pViewShell->GetView()->SdrBeginTextEdit(pTableObject);
+
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), pActualPage->GetObjCount());
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */