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

New commits:
commit 8a9cd6c9fffc89cf00337e7caeca057567867a67
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Tue Apr 5 14:49:34 2022 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Apr 5 21:22:32 2022 +0200

    tdf#107952: sc_uicalc: Add unittest
    
    Change-Id: I121e645582edfd1985a2a099dc5e572a54a4bf8b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132576
    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 efb043f73604..9b3fb5c8a73f 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -2772,6 +2772,35 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf118983)
     xGlobalSheetSettings->setExpandReferences(bOldValue);
 }
 
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf107952)
+{
+    mxComponent = loadFromDesktop("private:factory/scalc");
+    ScModelObj* pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get());
+    CPPUNIT_ASSERT(pModelObj);
+    ScDocument* pDoc = pModelObj->GetDocument();
+    CPPUNIT_ASSERT(pDoc);
+
+    insertStringToCell(*pModelObj, "B1", "=SUM(A1:A2)");
+
+    goToCell("D10");
+
+    dispatchCommand(mxComponent, ".uno:Undo", {});
+    Scheduler::ProcessEventsToIdle();
+
+    // Without the fix in place, this test would have failed with
+    // - Expected: 1
+    // - Actual  : 3
+    // - Incorrect Column in position B1
+    lcl_AssertCurrentCursorPosition(*pDoc, "B1");
+
+    goToCell("D10");
+
+    dispatchCommand(mxComponent, ".uno:Redo", {});
+    Scheduler::ProcessEventsToIdle();
+
+    lcl_AssertCurrentCursorPosition(*pDoc, "B1");
+}
+
 CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf144022)
 {
     ScModelObj* pModelObj = createDoc("tdf144022.ods");

Reply via email to