sc/qa/unit/data/xlsx/condformat_databar.xlsx |binary
 sc/qa/unit/subsequent_filters_test.cxx       |   21 +++++++++++++++++++++
 2 files changed, 21 insertions(+)

New commits:
commit 02ba31714a5f72495df203833ec9772b380b1b77
Author:     Henry Castro <hcas...@collabora.com>
AuthorDate: Fri Mar 17 15:49:45 2023 -0400
Commit:     Henry Castro <hcas...@collabora.com>
CommitDate: Thu Jun 15 22:43:30 2023 +0200

    sc: qa: add databar unit test
    
    <x14:dataBar maxLength="100" minLength="0" border="1" 
axisPosition="automatic" direction="context" 
negativeBarBorderColorSameAsPositive="0">
     <x14:cfvo type="num">
      <xm:f>0</xm:f>
     </x14:cfvo>
     <x14:cfvo type="num">
      <xm:f>1</xm:f>
     </x14:cfvo>
     <x14:fillColor rgb="FF63C384"/>
     <x14:borderColor rgb="FF63C384"/>
     <x14:negativeFillColor indexed="2"/>
     <x14:negativeBorderColor indexed="2"/>
     <x14:axisColor indexed="64"/>
    </x14:dataBar>
    
    Change-Id: Ib57dac07027e2c3c01ee556a3df791f49637be54
    Signed-off-by: Henry Castro <hcas...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149070
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153120
    Tested-by: Jenkins

diff --git a/sc/qa/unit/data/xlsx/condformat_databar.xlsx 
b/sc/qa/unit/data/xlsx/condformat_databar.xlsx
new file mode 100644
index 000000000000..2d2d727322b7
Binary files /dev/null and b/sc/qa/unit/data/xlsx/condformat_databar.xlsx differ
diff --git a/sc/qa/unit/subsequent_filters_test.cxx 
b/sc/qa/unit/subsequent_filters_test.cxx
index d206ce2cbf69..f633073c85f9 100644
--- a/sc/qa/unit/subsequent_filters_test.cxx
+++ b/sc/qa/unit/subsequent_filters_test.cxx
@@ -1639,6 +1639,27 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest, 
testRowIndex1BasedXLSX)
     CPPUNIT_ASSERT_EQUAL(OUString("Third line."), aStr);
 }
 
+CPPUNIT_TEST_FIXTURE(ScFiltersTest, testCondFormatCfvoScaleValueXLSX)
+{
+    createScDoc("xlsx/condformat_databar.xlsx");
+
+    ScDocument* pDoc = getScDoc();
+    ScConditionalFormat* pFormat = pDoc->GetCondFormat(0, 0, 0);
+    const ScFormatEntry* pEntry = pFormat->GetEntry(0);
+    CPPUNIT_ASSERT(pEntry);
+    CPPUNIT_ASSERT_EQUAL(ScFormatEntry::Type::Databar, pEntry->GetType());
+    const ScDataBarFormat* pDataBar = static_cast<const 
ScDataBarFormat*>(pEntry);
+    const ScDataBarFormatData* pDataBarFormatData = pDataBar->GetDataBarData();
+    const ScColorScaleEntry* pLower = pDataBarFormatData->mpLowerLimit.get();
+    const ScColorScaleEntry* pUpper = pDataBarFormatData->mpUpperLimit.get();
+
+    CPPUNIT_ASSERT_EQUAL(COLORSCALE_VALUE, pLower->GetType());
+    CPPUNIT_ASSERT_EQUAL(COLORSCALE_VALUE, pUpper->GetType());
+
+    CPPUNIT_ASSERT_EQUAL(0.0, pLower->GetValue());
+    CPPUNIT_ASSERT_EQUAL(1.0, pUpper->GetValue());
+}
+
 ScFiltersTest::ScFiltersTest()
     : ScModelTestBase("sc/qa/unit/data")
 {

Reply via email to