sc/qa/unit/uicalc/uicalc.cxx |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

New commits:
commit 3467777fa93205b935fbe150a61e03b7b94dffc1
Author:     Xisco Fauli <[email protected]>
AuthorDate: Mon Jan 15 11:24:10 2024 +0100
Commit:     Xisco Fauli <[email protected]>
CommitDate: Mon Jan 15 15:22:30 2024 +0100

    tdf#151752: sc_uicalc: Add unittest
    
    Change-Id: I560de65bffbac2aa8cb194a15958249176c9db46
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162080
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <[email protected]>

diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index e3d526fbd53d..19571c064fed 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -1461,6 +1461,27 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf154991)
     CPPUNIT_ASSERT(!pDoc->ColHidden(0, 0));
 }
 
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf151752)
+{
+    createScDoc();
+    ScDocument* pDoc = getScDoc();
+
+    insertStringToCell("A1", u"1");
+
+    goToCell("A1");
+    dispatchCommand(mxComponent, ".uno:SelectUnprotectedCells", {});
+
+    dispatchCommand(mxComponent, ".uno:Copy", {});
+
+    goToCell("B1");
+
+    // Without the fix in place, this test would have crashed here
+    dispatchCommand(mxComponent, ".uno:Paste", {});
+
+    CPPUNIT_ASSERT_EQUAL(1.0, pDoc->GetValue(0, 0, 0));
+    CPPUNIT_ASSERT_EQUAL(0.0, pDoc->GetValue(1, 0, 0));
+}
+
 CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf95306)
 {
     createScDoc();

Reply via email to