sw/qa/extras/uiwriter/uiwriter9.cxx |   24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

New commits:
commit dba98bdebcf99c957d883c18f44db2602956e281
Author:     Samuel Adesola <adesolasamuel2...@outlook.com>
AuthorDate: Sat Oct 26 10:17:34 2024 +0000
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Mon Oct 28 10:18:20 2024 +0100

    tdf#159023 CPP unit test for Crash in SwTextFrame::MapModelToView Fix
    
    The commit 4b68824d18316762a6afc35d355221e0228aebf8 was reverted
    and the test was written, the test failed with the bug reverted and
    it passed when the bug was reintroduced. Original bug report can
    be found at https://bugs.documentfoundation.org/show_bug.cgi?id=159023
    
    Change-Id: Iba0242deb6a5423210345559f80b5ab040a8902c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175676
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/qa/extras/uiwriter/uiwriter9.cxx 
b/sw/qa/extras/uiwriter/uiwriter9.cxx
index 1351ca753529..b9c55e8ecfea 100644
--- a/sw/qa/extras/uiwriter/uiwriter9.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter9.cxx
@@ -41,6 +41,7 @@
 #include <view.hxx>
 #include <wrtsh.hxx>
 #include <unotxdoc.hxx>
+#include <itabenum.hxx>
 #include <ndtxt.hxx>
 #include <toxmgr.hxx>
 #include <IDocumentFieldsAccess.hxx>
@@ -834,6 +835,29 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf163340)
     CPPUNIT_ASSERT_EQUAL(u"A."_ustr, getProperty<OUString>(xParaCursor, 
u"ListLabelString"_ustr));
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf159023)
+{
+    createSwDoc();
+    SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+
+    SwInsertTableOptions aTableOptions(SwInsertTableFlags::DefaultBorder, 0);
+    pWrtShell->InsertTable(aTableOptions, /*nRows=*/2, /*nCols=*/2);
+    pWrtShell->MoveTable(GotoPrevTable, fnTableStart);
+
+    dispatchCommand(mxComponent, u".uno:SelectTable"_ustr, {});
+    dispatchCommand(mxComponent, u".uno:Copy"_ustr, {});
+
+    pWrtShell->InsertFootnote(u""_ustr);
+    CPPUNIT_ASSERT(pWrtShell->IsCursorInFootnote());
+
+    dispatchCommand(mxComponent, u".uno:Paste"_ustr, {});
+    dispatchCommand(mxComponent, u".uno:GoLeft"_ustr, {});
+    dispatchCommand(mxComponent, u".uno:GoLeft"_ustr, {});
+
+    // Without the fix in place, this test would have crashed here
+    CPPUNIT_ASSERT(pWrtShell->IsCursorInFootnote());
+}
+
 } // end of anonymous namespace
 CPPUNIT_PLUGIN_IMPLEMENT();
 

Reply via email to