sc/qa/unit/uicalc/uicalc.cxx | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
New commits: commit 45229e679aead3c1b5f91069d2a87e9597eb93b5 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Wed May 17 12:29:41 2023 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Wed May 17 20:02:21 2023 +0200 tdf#153790: sc_uicalc: Add unittest Change-Id: Idf1628f3367fba3c196a63766ea298996bcbbb73 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151875 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 a6854ae76d56..bfba6bd235e1 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -1893,6 +1893,33 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf150219) CPPUNIT_ASSERT_EQUAL(OUString(""), pDoc->GetString(ScAddress(0, 0, 1))); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf153790) +{ + createScDoc(); + ScDocument* pDoc = getScDoc(); + + insertStringToCell("A1", u"=SUM($Sheet1.B1:C1)"); + + CPPUNIT_ASSERT_EQUAL(OUString("0"), pDoc->GetString(ScAddress(0, 0, 0))); + + goToCell("A1"); + dispatchCommand(mxComponent, ".uno:Copy", {}); + goToCell("A2"); + dispatchCommand(mxComponent, ".uno:Paste", {}); + + CPPUNIT_ASSERT_EQUAL(OUString("=SUM($Sheet1.B2:C2)"), pDoc->GetFormula(0, 1, 0)); + + goToCell("A1"); + dispatchCommand(mxComponent, ".uno:Cut", {}); + goToCell("A3"); + dispatchCommand(mxComponent, ".uno:Paste", {}); + + // Without the fix in place, this test would have failed wiht + // - Expected: =SUM($Sheet1.B1:C1) + // - Actual : =SUM($Sheet1.B1:$Sheet1.C1) + CPPUNIT_ASSERT_EQUAL(OUString("=SUM($Sheet1.B1:C1)"), pDoc->GetFormula(0, 2, 0)); +} + CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf141440) { createScDoc();