tdf#118561: sc_subsequent_filters_test: Add unittest

Change-Id: Ia1edcdb2931db0dd7b9174a697711c6d79ff9a13
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102103
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
diff --git a/sc/qa/unit/data/ods/tdf118561.ods b/sc/qa/unit/data/ods/tdf118561.ods
new file mode 100644
index 0000000..ba445f4
--- /dev/null
+++ b/sc/qa/unit/data/ods/tdf118561.ods
Binary files differ
diff --git a/sc/qa/unit/data/ods/tdf118561_external.ods b/sc/qa/unit/data/ods/tdf118561_external.ods
new file mode 100644
index 0000000..c700259
--- /dev/null
+++ b/sc/qa/unit/data/ods/tdf118561_external.ods
Binary files differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 463944a..a09bb1b 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -230,6 +230,7 @@ public:
    void testTdf103734();
    void testTdf98844();
    void testTdf100458();
    void testTdf118561();
    void testTdf134455();
    void testTdf119533();
    void testTdf127982();
@@ -395,6 +396,7 @@ public:
    CPPUNIT_TEST(testTdf103734);
    CPPUNIT_TEST(testTdf98844);
    CPPUNIT_TEST(testTdf100458);
    CPPUNIT_TEST(testTdf118561);
    CPPUNIT_TEST(testTdf134455);
    CPPUNIT_TEST(testTdf119533);
    CPPUNIT_TEST(testTdf127982);
@@ -3822,6 +3824,25 @@ void ScFiltersTest::testTdf100458()
    xDocSh->DoClose();
}

void ScFiltersTest::testTdf118561()
{
    ScDocShellRef xDocSh = loadDoc("tdf118561.", FORMAT_ODS);
    CPPUNIT_ASSERT_MESSAGE("Failed to open doc", xDocSh.is());
    ScDocument& rDoc = xDocSh->GetDocument();

    //Without the fix in place, it would have failed with
    //- Expected: apple
    //- Actual  : Err:502
    CPPUNIT_ASSERT_EQUAL(OUString("apple"), rDoc.GetString(ScAddress(1,1,1)));
    CPPUNIT_ASSERT_EQUAL(OUString("apple"), rDoc.GetString(ScAddress(2,1,1)));
    CPPUNIT_ASSERT_EQUAL(OUString("TRUE"), rDoc.GetString(ScAddress(3,1,1)));
    CPPUNIT_ASSERT_EQUAL(OUString("fruits"), rDoc.GetString(ScAddress(4,1,1)));
    CPPUNIT_ASSERT_EQUAL(OUString("apple"), rDoc.GetString(ScAddress(5,1,1)));
    CPPUNIT_ASSERT_EQUAL(OUString("hat"), rDoc.GetString(ScAddress(6,1,1)));

    xDocSh->DoClose();
}

void ScFiltersTest::testTdf134455()
{
    ScDocShellRef xDocSh = loadDoc("tdf134455.", FORMAT_XLSX);