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 <xiscofauli@libreoffice.org>
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index efb043f..9b3fb5c 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");