[Libreoffice-commits] core.git: sc/qa

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Fri Feb 26 19:21:41 UTC 2021


 sc/qa/unit/data/ods/tdf64401.ods       |binary
 sc/qa/unit/subsequent_filters-test.cxx |   56 +++++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+)

New commits:
commit 0efaa25ddfa84aa3fee88a357ff15f5ec50b234a
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Fri Feb 26 12:24:31 2021 +0100
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Fri Feb 26 20:20:56 2021 +0100

    tdf#64401: sc_subsequent_filters: Add unittest
    
    Change-Id: I624d4f94899634fa7b65768b7d5bbf82d786cc57
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111623
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sc/qa/unit/data/ods/tdf64401.ods b/sc/qa/unit/data/ods/tdf64401.ods
new file mode 100644
index 000000000000..76bca568bbff
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf64401.ods differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index b5f9d0f12fd4..8c0b8df909b8 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 testTdf64401();
     void testCondFormatParentXLSX();
     void testColorScaleNumWithRefXLSX();
     void testCondFormatXLSB();
@@ -371,6 +372,7 @@ public:
     CPPUNIT_TEST(testCondFormatThemeColor2XLSX);
     CPPUNIT_TEST(testCondFormatThemeColor3XLSX);
     CPPUNIT_TEST(testComplexIconSetsXLSX);
+    CPPUNIT_TEST(testTdf64401);
     CPPUNIT_TEST(testCondFormatParentXLSX);
     CPPUNIT_TEST(testColorScaleNumWithRefXLSX);
     CPPUNIT_TEST(testCondFormatXLSB);
@@ -2796,6 +2798,60 @@ void ScFiltersTest::testComplexIconSetsXLSX()
     xDocSh->DoClose();
 }
 
+void ScFiltersTest::testTdf64401()
+{
+    ScDocShellRef xDocSh = ScBootstrapFixture::loadDoc(u"tdf64401.", FORMAT_ODS);
+
+    CPPUNIT_ASSERT_MESSAGE("Failed to load tdf64401.ods", xDocSh.is());
+
+    ScDocument& rDoc = xDocSh->GetDocument();
+    CPPUNIT_ASSERT_EQUAL(size_t(1), rDoc.GetCondFormList(0)->size());
+
+    ScConditionalFormat* pFormat = rDoc.GetCondFormat(0, 0, 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 = 0; i < 10; ++i)
+    {
+        sal_Int32 nIndex = 0;
+        if ( i >= 7 ) // B5 = 8
+            nIndex = 2;
+        else if ( i >= 3 ) // B4 = 4
+            nIndex = 1;
+
+        std::unique_ptr<ScIconSetInfo> pInfo(pIconSet->GetIconSetInfo(ScAddress(0, i, 0)));
+        CPPUNIT_ASSERT(pInfo);
+        CPPUNIT_ASSERT_EQUAL(nIndex, pInfo->nIconIndex);
+        CPPUNIT_ASSERT_EQUAL(IconSet_3Arrows, pInfo->eIconSetType);
+
+    }
+
+    // Update values in B4 and B5
+    rDoc.SetValue(ScAddress(1,3,0), 2.0);
+    rDoc.SetValue(ScAddress(1,4,0), 9.0);
+
+    for(size_t i = 0; i < 10; ++i)
+    {
+        sal_Int32 nIndex = 0;
+        if ( i >= 8 ) // B5 = 9
+            nIndex = 2;
+        else if ( i >= 1 ) // B4 = 2
+            nIndex = 1;
+
+        std::unique_ptr<ScIconSetInfo> pInfo(pIconSet->GetIconSetInfo(ScAddress(0, i, 0)));
+        CPPUNIT_ASSERT(pInfo);
+        CPPUNIT_ASSERT_EQUAL(nIndex, pInfo->nIconIndex);
+        CPPUNIT_ASSERT_EQUAL(IconSet_3Arrows, pInfo->eIconSetType);
+
+    }
+
+    xDocSh->DoClose();
+}
+
 void ScFiltersTest::testCondFormatParentXLSX()
 {
     ScDocShellRef xDocSh = ScBootstrapFixture::loadDoc(u"cond_parent.", FORMAT_XLSX);


More information about the Libreoffice-commits mailing list