tdf#129681: sc: Add unittest

Change-Id: I160774b1b3d32fb5521d3f7a184f33922839bb1c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97239
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
diff --git a/sc/qa/unit/data/ods/tdf129681.ods b/sc/qa/unit/data/ods/tdf129681.ods
new file mode 100644
index 0000000..21fb06c
--- /dev/null
+++ b/sc/qa/unit/data/ods/tdf129681.ods
Binary files differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index f44980c..35b4907 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -231,6 +231,7 @@ public:
    void testTdf132278();
    void testTdf130959();
    void testTdf131380();
    void testTdf129681();
    void testTdf111974XLSM();
    void testTdf83672XLSX();

@@ -383,6 +384,7 @@ public:
    CPPUNIT_TEST(testTdf132278);
    CPPUNIT_TEST(testTdf130959);
    CPPUNIT_TEST(testTdf131380);
    CPPUNIT_TEST(testTdf129681);
    CPPUNIT_TEST(testTdf111974XLSM);
    CPPUNIT_TEST(testTdf83672XLSX);

@@ -3588,6 +3590,34 @@ void ScFiltersTest::testTdf131380()
    xDocSh->DoClose();
}

void ScFiltersTest::testTdf129681()
{
    ScDocShellRef xDocSh = loadDoc("tdf129681.", FORMAT_ODS);
    CPPUNIT_ASSERT_MESSAGE("Failed to open doc", xDocSh.is());

    ScDocument& rDoc = xDocSh->GetDocument();

    CPPUNIT_ASSERT_EQUAL(OUString("Lamb"), rDoc.GetString(ScAddress(4,2,0)));
    CPPUNIT_ASSERT_EQUAL(OUString("Beef"), rDoc.GetString(ScAddress(4,3,0)));
    CPPUNIT_ASSERT_EQUAL(OUString("Pork"), rDoc.GetString(ScAddress(4,4,0)));
    CPPUNIT_ASSERT_EQUAL(OUString("Goat"), rDoc.GetString(ScAddress(4,5,0)));
    CPPUNIT_ASSERT_EQUAL(OUString("Goat"), rDoc.GetString(ScAddress(4,6,0)));
    CPPUNIT_ASSERT_EQUAL(OUString("#VALUE!"), rDoc.GetString(ScAddress(4,7,0)));
    CPPUNIT_ASSERT_EQUAL(OUString("#VALUE!"), rDoc.GetString(ScAddress(4,8,0)));
    CPPUNIT_ASSERT_EQUAL(OUString("Deer"), rDoc.GetString(ScAddress(4,9,0)));

    CPPUNIT_ASSERT_EQUAL(OUString("1"), rDoc.GetString(ScAddress(6,2,0)));
    CPPUNIT_ASSERT_EQUAL(OUString("2"), rDoc.GetString(ScAddress(6,3,0)));
    CPPUNIT_ASSERT_EQUAL(OUString("3"), rDoc.GetString(ScAddress(6,4,0)));
    CPPUNIT_ASSERT_EQUAL(OUString("5"), rDoc.GetString(ScAddress(6,5,0)));
    CPPUNIT_ASSERT_EQUAL(OUString("8"), rDoc.GetString(ScAddress(6,6,0)));
    CPPUNIT_ASSERT_EQUAL(OUString("#VALUE!"), rDoc.GetString(ScAddress(6,7,0)));
    CPPUNIT_ASSERT_EQUAL(OUString("#VALUE!"), rDoc.GetString(ScAddress(6,8,0)));
    CPPUNIT_ASSERT_EQUAL(OUString("#VALUE!"), rDoc.GetString(ScAddress(6,9,0)));

    xDocSh->DoClose();
}

void ScFiltersTest::testTdf111974XLSM()
{
    // Would crash without the fix on loading