diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-06-01 19:55:11 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-06-01 21:32:21 +0200 |
commit | 7c2f826b4a3183b739eae06a10b586f689864d61 (patch) | |
tree | c5490e6fe9b168d11252f4e957dc1a8ae43cc6b9 /sc | |
parent | 0af4324c57a2ee22afcba72c0244c56cb7df8d4b (diff) |
tdf#90579: sc_uicalc: Add unittest
Change-Id: I96b1b639c766664e14a50ab8a267eb490d7239a2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135274
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/uicalc/uicalc.cxx | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index 5251f579a978..6b8a312a7bd9 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -787,6 +787,43 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf119162) pDoc->GetString(ScAddress(0, 0, 0))); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf90579) +{ + mxComponent = loadFromDesktop("private:factory/scalc"); + ScModelObj* pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get()); + CPPUNIT_ASSERT(pModelObj); + ScDocument* pDoc = pModelObj->GetDocument(); + CPPUNIT_ASSERT(pDoc); + + insertStringToCell(*pModelObj, "A1", "2300"); + insertStringToCell(*pModelObj, "A2", "Libre"); + insertStringToCell(*pModelObj, "B1", "10"); + insertStringToCell(*pModelObj, "B2", "Office"); + insertStringToCell(*pModelObj, "C1", "=SUM(A1:B1)"); + insertStringToCell(*pModelObj, "C2", "=A2&B2"); + + CPPUNIT_ASSERT_EQUAL(OUString("2310"), pDoc->GetString(ScAddress(2, 0, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("LibreOffice"), pDoc->GetString(ScAddress(2, 1, 0))); + + goToCell("C1:C2"); + + dispatchCommand(mxComponent, ".uno:ConvertFormulaToValue", {}); + Scheduler::ProcessEventsToIdle(); + + CPPUNIT_ASSERT_EQUAL(OUString("2310"), pDoc->GetString(ScAddress(2, 0, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("LibreOffice"), pDoc->GetString(ScAddress(2, 1, 0))); + CPPUNIT_ASSERT_EQUAL(OUString(""), pDoc->GetFormula(2, 0, 0)); + CPPUNIT_ASSERT_EQUAL(OUString(""), pDoc->GetFormula(2, 1, 0)); + + dispatchCommand(mxComponent, ".uno:Undo", {}); + Scheduler::ProcessEventsToIdle(); + + CPPUNIT_ASSERT_EQUAL(OUString("2310"), pDoc->GetString(ScAddress(2, 0, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("LibreOffice"), pDoc->GetString(ScAddress(2, 1, 0))); + CPPUNIT_ASSERT_EQUAL(OUString("=SUM(A1:B1)"), pDoc->GetFormula(2, 0, 0)); + CPPUNIT_ASSERT_EQUAL(OUString("=A2&B2"), pDoc->GetFormula(2, 1, 0)); +} + CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf124820) { ScModelObj* pModelObj = createDoc("tdf124820.xlsx"); |