tdf#76310: subsequent_filters: Add unittest

Change-Id: If39bb4e3c7e767f273351cb381ea055e3934de2d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120338
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
diff --git a/sc/qa/unit/data/ods/tdf76310.ods b/sc/qa/unit/data/ods/tdf76310.ods
new file mode 100644
index 0000000..219437a
--- /dev/null
+++ b/sc/qa/unit/data/ods/tdf76310.ods
Binary files differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 75ff20e..b48e9a2d 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -115,6 +115,7 @@ public:
    void testUpdateCircleInMergedCellODS();
    void testDeleteCircleInMergedCellODS();
    void testBooleanFormatXLSX();
    void testTdf76310();
    void testBasicCellContentODS();
    void testRangeNameXLS();
    void testRangeNameLocalXLS();
@@ -224,6 +225,7 @@ public:
    CPPUNIT_TEST(testUpdateCircleInMergedCellODS);
    CPPUNIT_TEST(testDeleteCircleInMergedCellODS);
    CPPUNIT_TEST(testBooleanFormatXLSX);
    CPPUNIT_TEST(testTdf76310);
    CPPUNIT_TEST(testBasicCellContentODS);
    CPPUNIT_TEST(testRangeNameXLS);
    CPPUNIT_TEST(testRangeNameLocalXLS);
@@ -671,6 +673,25 @@ void ScFiltersTest::testBooleanFormatXLSX()
    xDocSh->DoClose();
}

void ScFiltersTest::testTdf76310()
{
    ScDocShellRef xDocSh = loadDoc(u"tdf76310.", FORMAT_ODS);

    ScDocument& rDoc = xDocSh->GetDocument();

    OUString aFormula;
    rDoc.GetFormula(0, 0, 0, aFormula);
    // Without the fix in place, this test would have failed with
    // - Expected: =1
    // +
    // 2
    // - Actual  : =1 + 2
    CPPUNIT_ASSERT_EQUAL(OUString("=1\n+\n2"), aFormula);
    ASSERT_DOUBLES_EQUAL(3.0, rDoc.GetValue(0, 0, 0));

    xDocSh->DoClose();
}

void ScFiltersTest::testRangeNameXLS()
{
    ScDocShellRef xDocSh = loadDoc(u"named-ranges-global.", FORMAT_XLS);