tdf#132519: sc_ucalc_formula: Add unittest

Change-Id: Ie2ff5a8961556cf21ca75a58d46f37754e0bb61b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140183
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index 7463f1a..1ade802 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -243,6 +243,7 @@ public:
    void testTdf97369();
    void testTdf97587();
    void testTdf93415();
    void testTdf132519();
    void testTdf100818();
    void testMatConcat();
    void testMatConcatReplication();
@@ -363,6 +364,7 @@ public:
    CPPUNIT_TEST(testTdf97369);
    CPPUNIT_TEST(testTdf97587);
    CPPUNIT_TEST(testTdf93415);
    CPPUNIT_TEST(testTdf132519);
    CPPUNIT_TEST(testTdf100818);
    CPPUNIT_TEST(testMatConcat);
    CPPUNIT_TEST(testMatConcatReplication);
@@ -8901,6 +8903,29 @@ void TestFormula::testTdf93415()
    m_pDoc->DeleteTab(0);
}

void TestFormula::testTdf132519()
{
    CPPUNIT_ASSERT(m_pDoc->InsertTab (0, "Sheet1"));

    ScCalcConfig aConfig;
    aConfig.SetStringRefSyntax( formula::FormulaGrammar::CONV_XL_R1C1 );
    m_pDoc->SetCalcConfig(aConfig);
    m_pDoc->CalcAll();

    m_pDoc->SetString(2, 0, 0, "X");
    m_pDoc->SetString(1, 0, 0, "=CELL(\"ADDRESS\"; C1)");
    m_pDoc->SetString(0, 0, 0, "=INDIRECT(B1)");

    // Without the fix in place, this test would have failed with
    // - Expected: X
    // - Actual  : #REF!
    CPPUNIT_ASSERT_EQUAL(OUString("X"), m_pDoc->GetString(0,0,0));

    CPPUNIT_ASSERT_EQUAL(OUString("R1C3"), m_pDoc->GetString(1,0,0));

    m_pDoc->DeleteTab(0);
}

void TestFormula::testTdf100818()
{
    CPPUNIT_ASSERT(m_pDoc->InsertTab (0, "Sheet1"));