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

New commits:
commit 2b2e8471727f0825bb18df58be86a9252de4432e
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Tue Aug 9 18:47:05 2022 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu Aug 11 13:04:31 2022 +0200

    tdf#150219: sc_uicalc: Add unittest
    
    Change-Id: I94aeecb156485095fda476480ead3db1979f3c1a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138060
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index be1a8cfc4b9b..25d16a4d1201 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -1945,6 +1945,29 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf108654)
     CPPUNIT_ASSERT_EQUAL(static_cast<SCTAB>(1), pDoc->GetTableCount());
 }
 
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf150219)
+{
+    mxComponent = loadFromDesktop("private:factory/scalc");
+    ScModelObj* pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get());
+    CPPUNIT_ASSERT(pModelObj);
+    ScDocument* pDoc = pModelObj->GetDocument();
+    CPPUNIT_ASSERT(pDoc);
+
+    insertNewSheet(*pDoc);
+
+    insertStringToCell(*pModelObj, "A1", "=$Sheet1.A1");
+    goToCell("A1");
+
+    CPPUNIT_ASSERT_EQUAL(OUString("0"), pDoc->GetString(ScAddress(0, 0, 1)));
+
+    dispatchCommand(mxComponent, ".uno:ShowPrecedents", {});
+
+    // Without the fix in place, this test would have crashed here
+    dispatchCommand(mxComponent, ".uno:Cut", {});
+
+    CPPUNIT_ASSERT_EQUAL(OUString(""), pDoc->GetString(ScAddress(0, 0, 1)));
+}
+
 CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf133326)
 {
     ScModelObj* pModelObj = createDoc("tdf133326.ods");

Reply via email to