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

New commits:
commit 7c2f826b4a3183b739eae06a10b586f689864d61
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Wed Jun 1 19:55:11 2022 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Wed Jun 1 21:32:21 2022 +0200

    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 <xiscofa...@libreoffice.org>

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");

Reply via email to