sc/qa/unit/ucalc_formula2.cxx |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

New commits:
commit 2ac7d339a97efa638124c2862551e0876487833b
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Mon Sep 4 10:28:57 2023 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Mon Sep 4 16:12:30 2023 +0200

    tdf#156985: sc_ucalc_formula2: Add unittest
    
    Change-Id: Iaf6d4310eb40bfc4880902f57a75b7f85a8af906
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156508
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sc/qa/unit/ucalc_formula2.cxx b/sc/qa/unit/ucalc_formula2.cxx
index 14f0001f943d..3b068348685a 100644
--- a/sc/qa/unit/ucalc_formula2.cxx
+++ b/sc/qa/unit/ucalc_formula2.cxx
@@ -4606,6 +4606,27 @@ CPPUNIT_TEST_FIXTURE(TestFormula2, testTdf147398)
     m_pDoc->DeleteTab(0);
 }
 
+#if !defined(_WIN32)
+CPPUNIT_TEST_FIXTURE(TestFormula2, testTdf156985)
+{
+    m_pDoc->InsertTab(0, "Test");
+
+    m_pDoc->SetString(0, 0, 0, "=-170.87");
+    m_pDoc->SetString(0, 1, 0, "-223.73");
+    m_pDoc->SetString(0, 2, 0, "-12.58");
+    m_pDoc->SetString(0, 3, 0, "234.98");
+    m_pDoc->SetString(0, 4, 0, "172.2");
+    m_pDoc->SetString(0, 5, 0, "=SUM(A1:A5)");
+
+    // Without the fix in place, this test would have failed with
+    // - Expected: 0
+    // - Actual  : -1.59872115546023e-14
+    CPPUNIT_ASSERT_EQUAL(0.0, m_pDoc->GetValue(0, 5, 0));
+
+    m_pDoc->DeleteTab(0);
+}
+#endif
+
 CPPUNIT_TEST_FIXTURE(TestFormula2, testFormulaAfterDeleteRows)
 {
     sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on.

Reply via email to