[Libreoffice-commits] core.git: sd/qa

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Fri Apr 3 10:13:51 UTC 2020


 sd/qa/unit/uiimpress.cxx |   39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

New commits:
commit 3acf7f20bdf8a54544b459235a84b5c26539a561
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Thu Apr 2 18:49:05 2020 +0200
Commit:     Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Fri Apr 3 12:13:10 2020 +0200

    tdf#127481: Add unittest
    
    Change-Id: I8e0fa60eb6a10be6c7f7b1d1742e236a790e74a3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91599
    Tested-by: Jenkins
    Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>

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: */


More information about the Libreoffice-commits mailing list