summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMark Hung <marklh9@gmail.com>2021-03-11 23:44:06 +0800
committerMichael Stahl <michael.stahl@allotropia.de>2021-03-17 11:00:44 +0100
commiteeeb3a422e25c22201e1325154f1913df3942f2a (patch)
treeb520e2cb7376d21e5ec811302499a7161856bf5c /sd
parentb6e705ec690b9911ce44f3e6cb1273737449f186 (diff)
tdf#136956 reorder undo actions in removeColumns
and removeRows. Inside the removeColumns and removeRows, undo actions are added first, and then cell spans are updated to reflect the removed columns or rows. Once undo the cell spans they become immediately invalid because the rows or columns are already removed, hence cause Impress to crash. Change-Id: I9d8641bdad43026eca03cbeaaa3a5907b516304f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112355 Tested-by: Jenkins Reviewed-by: Mark Hung <marklh9@gmail.com> (cherry picked from commit f3f7cc53efda828af8897fa45fa2a8f18cf3b48b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112526 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/misc-tests.cxx35
1 files changed, 35 insertions, 0 deletions
diff --git a/sd/qa/unit/misc-tests.cxx b/sd/qa/unit/misc-tests.cxx
index 52c3b55513be..75818805295a 100644
--- a/sd/qa/unit/misc-tests.cxx
+++ b/sd/qa/unit/misc-tests.cxx
@@ -27,6 +27,8 @@
#include <com/sun/star/graphic/XGraphic.hpp>
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/frame/XLoadable.hpp>
+#include <com/sun/star/table/XTable.hpp>
+#include <com/sun/star/table/XMergeableCellRange.hpp>
#include <vcl/scheduler.hxx>
#include <osl/thread.hxx>
@@ -83,6 +85,7 @@ public:
void testTdf130988();
void testTdf131033();
void testTdf129898LayerDrawnInSlideshow();
+ void testTdf136956();
CPPUNIT_TEST_SUITE(SdMiscTest);
CPPUNIT_TEST(testTdf96206);
@@ -104,6 +107,7 @@ public:
CPPUNIT_TEST(testTdf130988);
CPPUNIT_TEST(testTdf131033);
CPPUNIT_TEST(testTdf129898LayerDrawnInSlideshow);
+ CPPUNIT_TEST(testTdf136956);
CPPUNIT_TEST_SUITE_END();
virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override
@@ -875,6 +879,37 @@ void SdMiscTest::testTdf129898LayerDrawnInSlideshow()
xDocShRef->DoClose();
}
+void SdMiscTest::testTdf136956()
+{
+ ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/cellspan.odp"), ODP);
+
+ const SdrPage *pPage = GetPage( 1, xDocShRef );
+ sdr::table::SdrTableObj *pTableObj = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(0));
+ CPPUNIT_ASSERT( pTableObj );
+ uno::Reference< table::XTable > xTable(pTableObj->getTable(), uno::UNO_SET_THROW);
+
+ uno::Reference< css::table::XMergeableCellRange > xRange(
+ xTable->createCursorByRange( xTable->getCellRangeByPosition( 0, 0, 3, 2 ) ), uno::UNO_QUERY_THROW );
+
+ // 4x3 Table before merge.
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xTable->getColumnCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable->getRowCount());
+
+ xRange->merge();
+
+ // 1x1 Table after merge.
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getColumnCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getRowCount());
+
+ xDocShRef->GetUndoManager()->Undo();
+
+ // 4x3 Table after undo. Undo crashed before.
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xTable->getColumnCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable->getRowCount());
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdMiscTest);
CPPUNIT_PLUGIN_IMPLEMENT();