diff options
author | Henry Castro <hcastro@collabora.com> | 2023-03-17 15:49:45 -0400 |
---|---|---|
committer | Henry Castro <hcastro@collabora.com> | 2023-05-18 18:17:33 +0200 |
commit | 65ffe4eac759363949c951abcc6f30df0f401e0c (patch) | |
tree | 4da3a8dc7f34377550fd63bd33106be4c995e957 /sc | |
parent | d19f76aa194706fed7119dd0d9b5bee4499334ca (diff) |
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 <hcastro@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149070
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/data/xlsx/condformat_databar.xlsx | bin | 0 -> 8052 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_filters_test.cxx | 23 |
2 files changed, 23 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xlsx/condformat_databar.xlsx b/sc/qa/unit/data/xlsx/condformat_databar.xlsx Binary files differnew file mode 100644 index 000000000000..2d2d727322b7 --- /dev/null +++ b/sc/qa/unit/data/xlsx/condformat_databar.xlsx diff --git a/sc/qa/unit/subsequent_filters_test.cxx b/sc/qa/unit/subsequent_filters_test.cxx index c080942d486d..3359aef79969 100644 --- a/sc/qa/unit/subsequent_filters_test.cxx +++ b/sc/qa/unit/subsequent_filters_test.cxx @@ -147,6 +147,7 @@ public: void testCondFormatImportCellIs(); void testCondFormatThemeColor2XLSX(); // negative bar color and axis color void testCondFormatThemeColor3XLSX(); // theme index 2 and 3 are switched + void testCondFormatCfvoScaleValueXLSX(); void testComplexIconSetsXLSX(); void testTdf101104(); void testTdf64401(); @@ -287,6 +288,7 @@ public: CPPUNIT_TEST(testCondFormatImportCellIs); CPPUNIT_TEST(testCondFormatThemeColor2XLSX); CPPUNIT_TEST(testCondFormatThemeColor3XLSX); + CPPUNIT_TEST(testCondFormatCfvoScaleValueXLSX); CPPUNIT_TEST(testComplexIconSetsXLSX); CPPUNIT_TEST(testTdf101104); CPPUNIT_TEST(testTdf64401); @@ -2593,6 +2595,27 @@ void ScFiltersTest::testCondFormatThemeColor2XLSX() CPPUNIT_ASSERT_EQUAL(Color(197, 90, 17), pDataBarFormatData->maAxisColor); } +void 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(double(0.0), pLower->GetValue()); + CPPUNIT_ASSERT_EQUAL(double(1.0), pUpper->GetValue()); +} + namespace { void checkDatabarPositiveColor(const ScConditionalFormat* pFormat, const Color& rColor) |