tdf#153514: sc_subsequent_filters_test4: Add unittest

Change-Id: Idd4638b68be8400272c496eb61fd17f215f5693b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149078
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
diff --git a/sc/qa/unit/data/xml/tdf153514.xml b/sc/qa/unit/data/xml/tdf153514.xml
new file mode 100644
index 0000000..8715925
--- /dev/null
+++ b/sc/qa/unit/data/xml/tdf153514.xml
@@ -0,0 +1,15 @@
<?xml version="1.0"?>
<office:styles xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0">
    <style:style style:name="aBcD" style:family="table-cell" style:parent-style-name="Status">
        <style:text-properties fo:color="#cc0000"/>
    </style:style>
    <style:style style:name="abCd" style:family="table-cell" style:parent-style-name="Status">
        <style:text-properties fo:color="#cc0000"/>
    </style:style>
    <style:style style:name="Abcd" style:family="table-cell" style:parent-style-name="Status">
        <style:text-properties fo:color="#cc0000"/>
    </style:style>
    <style:style style:name="ABCD" style:family="table-cell" style:parent-style-name="Status">
        <style:text-properties fo:color="#cc0000"/>
    </style:style>
</office:styles>
diff --git a/sc/qa/unit/subsequent_filters_test4.cxx b/sc/qa/unit/subsequent_filters_test4.cxx
index ec22e99..21a9180 100644
--- a/sc/qa/unit/subsequent_filters_test4.cxx
+++ b/sc/qa/unit/subsequent_filters_test4.cxx
@@ -981,6 +981,44 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testColorScaleNumWithRefXLSX)
                         pColorScaleEntry->GetFormula(formula::FormulaGrammar::GRAM_NATIVE));
}

CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testTdf153514)
{
    ScDocument aDoc;
    OUString aFullUrl = m_directories.getURLFromSrc(u"sc/qa/unit/data/xml/tdf153514.xml");

    OUString aValidPath;
    osl::FileBase::getSystemPathFromFileURL(aFullUrl, aValidPath);

    ScOrcusFilters* pOrcus = ScFormatFilter::Get().GetOrcusFilters();
    CPPUNIT_ASSERT(pOrcus);

    pOrcus->importODS_Styles(aDoc, aValidPath);
    ScStyleSheetPool* pStyleSheetPool = aDoc.GetStyleSheetPool();

    ScStyleSheet* pStyleSheet;
    // Case sensitive tests
    pStyleSheet = pStyleSheetPool->FindCaseIns("aBcD", SfxStyleFamily::Para);
    CPPUNIT_ASSERT_EQUAL(OUString("aBcD"), pStyleSheet->GetName());
    pStyleSheet = pStyleSheetPool->FindCaseIns("abCd", SfxStyleFamily::Para);
    CPPUNIT_ASSERT_EQUAL(OUString("abCd"), pStyleSheet->GetName());
    pStyleSheet = pStyleSheetPool->FindCaseIns("Abcd", SfxStyleFamily::Para);
    CPPUNIT_ASSERT_EQUAL(OUString("Abcd"), pStyleSheet->GetName());
    pStyleSheet = pStyleSheetPool->FindCaseIns("ABCD", SfxStyleFamily::Para);
    CPPUNIT_ASSERT_EQUAL(OUString("ABCD"), pStyleSheet->GetName());
    // Case insensitive tests
    pStyleSheet = pStyleSheetPool->FindCaseIns("abcd", SfxStyleFamily::Para);
    CPPUNIT_ASSERT(pStyleSheet);
    CPPUNIT_ASSERT(pStyleSheet->GetName().equalsIgnoreAsciiCase("abcd"));
    CPPUNIT_ASSERT(pStyleSheet->GetName() != "abcd");
    pStyleSheet = pStyleSheetPool->FindCaseIns("ABCd", SfxStyleFamily::Para);
    CPPUNIT_ASSERT(pStyleSheet);
    CPPUNIT_ASSERT(pStyleSheet->GetName().equalsIgnoreAsciiCase("ABCd"));
    CPPUNIT_ASSERT(pStyleSheet->GetName() != "ABCd");
    // Not match tests
    pStyleSheet = pStyleSheetPool->FindCaseIns("NotFound", SfxStyleFamily::Para);
    CPPUNIT_ASSERT(!pStyleSheet);
}

CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testOrcusODSStyleInterface)
{
    ScDocument aDoc;