sc/qa/unit/data/xml/tdf153514.xml | 15 ++++++++++++ sc/qa/unit/subsequent_filters_test4.cxx | 38 ++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+)
New commits: commit 8cf73a9a8227f90217c595be04519f0c3692754c Author: Baole Fang <baole.f...@gmail.com> AuthorDate: Sat Mar 18 00:52:25 2023 -0400 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Tue Mar 21 04:34:23 2023 +0000 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.kagan...@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 000000000000..8715925a1d58 --- /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 ec22e998d611..21a918086304 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;