tdf#133260: sc_ucalc: Add unittest
Change-Id: I4661057a3e65f0e5ab7b18d8ad44bcd08a659039
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104281
Tested-by: Jenkins
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index 676fa52..de29194 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -566,6 +566,7 @@ public:
void testTdf97369();
void testTdf97587();
void testTdf107459();
void testTdf133260();
void testEmptyCalcDocDefaults();
@@ -874,6 +875,7 @@ public:
CPPUNIT_TEST(testTdf97369);
CPPUNIT_TEST(testTdf97587);
CPPUNIT_TEST(testTdf107459);
CPPUNIT_TEST(testTdf133260);
CPPUNIT_TEST(testEmptyCalcDocDefaults);
CPPUNIT_TEST(testPrecisionAsShown);
CPPUNIT_TEST(testProtectedSheetEditByRow);
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index fd65222..83fbd63 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -8520,6 +8520,25 @@ void Test::testTdf107459()
m_pDoc->DeleteTab(0);
}
void Test::testTdf133260()
{
CPPUNIT_ASSERT(m_pDoc->InsertTab (0, "Test"));
ScAddress aPos1(0,0,0);
m_pDoc->SetString(aPos1, "=SUM(ABS(MUNIT(2)))");
ScAddress aPos2(0,1,0);
m_pDoc->SetString(aPos2, "=SUM(ABS(MUNIT(2)*-1))");
// Without the fix in place, this test would have failed with
// - Expected: 2
// - Actual : 1
CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(aPos1));
CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(aPos2));
m_pDoc->DeleteTab(0);
}
void Test::testMatConcat()
{
CPPUNIT_ASSERT(m_pDoc->InsertTab (0, "Test"));