sc/qa/unit/ucalc_formula.cxx | 7 +++++++ 1 file changed, 7 insertions(+)
New commits: commit 26b3fc1f31b682fcc7ac0c10af07e64cffbe86e7 Author: Eike Rathke <er...@redhat.com> AuthorDate: Sat Jan 15 15:41:17 2022 +0100 Commit: Eike Rathke <er...@redhat.com> CommitDate: Sat Jan 15 17:04:56 2022 +0100 A unit test for tdf#146367 Change-Id: Ie47f1525f387d019c7c1131a76faf3784ee99d4a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128466 Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Jenkins diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index 551834284f76..c0fb17bc1b59 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -4987,6 +4987,13 @@ void TestFormula::testFuncSUM() CPPUNIT_ASSERT_EQUAL_MESSAGE("A4 should have inherited the same error as A2.", static_cast<int>(nErr), static_cast<int>(m_pDoc->GetErrCode(ScAddress(0,3,0)))); + // Test the dreaded 0.1 + 0.2 - 0.3 != 0.0 + m_pDoc->SetString(ScAddress(1,0,0), "=SUM(0.1;0.2;-0.3)"); + CPPUNIT_ASSERT_EQUAL(0.0, m_pDoc->GetValue(ScAddress(1,0,0))); + // Also for +/- operators + m_pDoc->SetString(ScAddress(1,1,0), "=0.1+0.2-0.3"); + CPPUNIT_ASSERT_EQUAL(0.0, m_pDoc->GetValue(ScAddress(1,1,0))); + m_pDoc->DeleteTab(0); }