tdf#101104: sc_subsequent_filters: Add unittest
Change-Id: Ifd39b958d011db0ca1575bc340bc23983075062d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113025
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
diff --git a/sc/qa/unit/data/ods/tdf101104.ods b/sc/qa/unit/data/ods/tdf101104.ods
new file mode 100644
index 0000000..d33bb90
--- /dev/null
+++ b/sc/qa/unit/data/ods/tdf101104.ods
Binary files differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 09d0f6d..fd55c00 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -162,6 +162,7 @@ public:
void testCondFormatThemeColor2XLSX(); // negative bar color and axis color
void testCondFormatThemeColor3XLSX(); // theme index 2 and 3 are switched
void testComplexIconSetsXLSX();
void testTdf101104();
void testTdf64401();
void testCondFormatParentXLSX();
void testColorScaleNumWithRefXLSX();
@@ -376,6 +377,7 @@ public:
CPPUNIT_TEST(testCondFormatThemeColor2XLSX);
CPPUNIT_TEST(testCondFormatThemeColor3XLSX);
CPPUNIT_TEST(testComplexIconSetsXLSX);
CPPUNIT_TEST(testTdf101104);
CPPUNIT_TEST(testTdf64401);
CPPUNIT_TEST(testCondFormatParentXLSX);
CPPUNIT_TEST(testColorScaleNumWithRefXLSX);
@@ -2806,6 +2808,37 @@ void ScFiltersTest::testComplexIconSetsXLSX()
xDocSh->DoClose();
}
void ScFiltersTest::testTdf101104()
{
ScDocShellRef xDocSh = ScBootstrapFixture::loadDoc(u"tdf101104.", FORMAT_ODS);
CPPUNIT_ASSERT_MESSAGE("Failed to load tdf101104.ods", xDocSh.is());
ScDocument& rDoc = xDocSh->GetDocument();
CPPUNIT_ASSERT_EQUAL(size_t(2), rDoc.GetCondFormList(0)->size());
ScConditionalFormat* pFormat = rDoc.GetCondFormat(1, 1, 0);
CPPUNIT_ASSERT(pFormat);
CPPUNIT_ASSERT_EQUAL(size_t(1), pFormat->size());
const ScFormatEntry* pEntry = pFormat->GetEntry(0);
CPPUNIT_ASSERT(pEntry);
CPPUNIT_ASSERT_EQUAL(ScFormatEntry::Type::Iconset, pEntry->GetType());
const ScIconSetFormat* pIconSet = static_cast<const ScIconSetFormat*>(pEntry);
for(size_t i = 1; i < 10; ++i)
{
std::unique_ptr<ScIconSetInfo> pInfo(pIconSet->GetIconSetInfo(ScAddress(1, i, 0)));
// Without the fix in place, this test would have failed here
CPPUNIT_ASSERT(pInfo);
CPPUNIT_ASSERT_EQUAL(sal_Int32(2), pInfo->nIconIndex);
CPPUNIT_ASSERT_EQUAL(IconSet_3Arrows, pInfo->eIconSetType);
}
xDocSh->DoClose();
}
void ScFiltersTest::testTdf64401()
{
ScDocShellRef xDocSh = ScBootstrapFixture::loadDoc(u"tdf64401.", FORMAT_ODS);