sw/qa/extras/uiwriter/data/tdf155028.odt |binary
 sw/qa/extras/uiwriter/uiwriter3.cxx      |   28 ++++++++++++++++++++++++++++
 2 files changed, 28 insertions(+)

New commits:
commit e2b54a73118849a107f516c61c517f259f7d4530
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Tue May 2 14:31:23 2023 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Wed May 3 11:38:13 2023 +0200

    tdf#155028: sw_uiwriter3: Add unittest
    
    Change-Id: Ida1de2645969394069066519ea18d546af3da96a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151269
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/qa/extras/uiwriter/data/tdf155028.odt 
b/sw/qa/extras/uiwriter/data/tdf155028.odt
new file mode 100644
index 000000000000..f32fef62c359
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf155028.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx 
b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 06407a628ed8..c64c87db2cad 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -1757,6 +1757,34 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, TestAsCharTextBox)
     // Without the fix in place the two texboxes has been fallen apart, and  
asserts will broken.
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf155028)
+{
+    createSwDoc("tdf155028.odt");
+    SwXTextDocument* pTextDoc = 
dynamic_cast<SwXTextDocument*>(mxComponent.get());
+
+    CPPUNIT_ASSERT_EQUAL(1, getShapes());
+    uno::Reference<drawing::XShapes> xGroupShape(getShape(1), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(10), xGroupShape->getCount());
+
+    selectShape(1);
+    dispatchCommand(mxComponent, ".uno:EnterGroup", {});
+
+    // Select a shape in the group
+    pTextDoc->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_TAB);
+    Scheduler::ProcessEventsToIdle();
+
+    dispatchCommand(mxComponent, ".uno:Copy", {});
+
+    // Without the fix in place, this test would have crashed
+    dispatchCommand(mxComponent, ".uno:Paste", {});
+
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(11), xGroupShape->getCount());
+
+    dispatchCommand(mxComponent, ".uno:Undo", {});
+
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(10), xGroupShape->getCount());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf135581)
 {
     createSwDoc("tdf135581.odt");

Reply via email to