tdf#98481: sc_subsequent_filters: Add unittest

Change-Id: Ic5c69f1280f972ff3f51353fbc9bbd7c95123a12
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114218
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
diff --git a/sc/qa/unit/data/xlsx/tdf98481.xlsx b/sc/qa/unit/data/xlsx/tdf98481.xlsx
new file mode 100644
index 0000000..bc198d2
--- /dev/null
+++ b/sc/qa/unit/data/xlsx/tdf98481.xlsx
Binary files differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 3d886c7..5bdea80 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -301,6 +301,7 @@ public:
    void testTdf112780();
    void testTdf72470();
    void testTdf35636();
    void testTdf98481();
    void testVBAMacroFunctionODS();
    void testAutoheight2Rows();
    void testXLSDefColWidth();
@@ -498,6 +499,7 @@ public:
    CPPUNIT_TEST(testTdf112780);
    CPPUNIT_TEST(testTdf72470);
    CPPUNIT_TEST(testTdf35636);
    CPPUNIT_TEST(testTdf98481);
    CPPUNIT_TEST(testVBAMacroFunctionODS);
    CPPUNIT_TEST(testAutoheight2Rows);
    CPPUNIT_TEST(testXLSDefColWidth);
@@ -5328,6 +5330,26 @@ void ScFiltersTest::testTdf35636()
    xDocSh->DoClose();
}

void ScFiltersTest::testTdf98481()
{
    ScDocShellRef xDocSh = loadDoc(u"tdf98481.", FORMAT_XLSX);
    CPPUNIT_ASSERT_MESSAGE("Failed to open doc", xDocSh.is());

    ScDocument& rDoc = xDocSh->GetDocument();

    // Without the fix in place, this test would have failed with
    // - Expected: 4
    // - Actual  : 0
    CPPUNIT_ASSERT_EQUAL(4.0, rDoc.GetValue(ScAddress(4,1,0)));
    CPPUNIT_ASSERT_EQUAL(0.0, rDoc.GetValue(ScAddress(4,2,0)));
    CPPUNIT_ASSERT_EQUAL(3.0, rDoc.GetValue(ScAddress(4,3,0)));
    CPPUNIT_ASSERT_EQUAL(4.0, rDoc.GetValue(ScAddress(1,4,0)));
    CPPUNIT_ASSERT_EQUAL(0.0, rDoc.GetValue(ScAddress(2,4,0)));
    CPPUNIT_ASSERT_EQUAL(3.0, rDoc.GetValue(ScAddress(3,4,0)));

    xDocSh->DoClose();
}

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