tdf#114406: sc_ucalc: Add unittest
Change-Id: I0d6be8945e3aaecdccfc674c70f60b6f150f3c05
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131934
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 9477fd1..895d5a9 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -90,6 +90,7 @@ public:
void testInput();
void testColumnIterator();
void testTdf90698();
void testTdf114406();
void testTdf93951();
void testTdf134490();
void testTdf135249();
@@ -235,6 +236,7 @@ public:
CPPUNIT_TEST(testInput);
CPPUNIT_TEST(testColumnIterator);
CPPUNIT_TEST(testTdf90698);
CPPUNIT_TEST(testTdf114406);
CPPUNIT_TEST(testTdf93951);
CPPUNIT_TEST(testTdf134490);
CPPUNIT_TEST(testTdf135249);
@@ -675,6 +677,23 @@ void Test::testTdf90698()
m_pDoc->DeleteTab(0);
}
void Test::testTdf114406()
{
CPPUNIT_ASSERT(m_pDoc->InsertTab (0, "Test"));
m_pDoc->SetString(ScAddress(0,0,0), "5");
m_pDoc->SetString(ScAddress(1,0,0), "=A1/100%");
// Without the fix in place, this would have failed with
// - Expected: =A1/100%
// - Actual : =A1/1
OUString aFormula = m_pDoc->GetFormula(1,0,0);
CPPUNIT_ASSERT_EQUAL(OUString("=A1/100%"), aFormula);
CPPUNIT_ASSERT_EQUAL(5.0, m_pDoc->GetValue(ScAddress(1,0,0)));
m_pDoc->DeleteTab(0);
}
void Test::testTdf93951()
{
CPPUNIT_ASSERT(m_pDoc->InsertTab (0, "Test"));