sc/qa/unit/data/xlsx/condformat_databar.xlsx |binary sc/qa/unit/subsequent_filters_test.cxx | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+)
New commits: commit 65ffe4eac759363949c951abcc6f30df0f401e0c Author: Henry Castro <hcas...@collabora.com> AuthorDate: Fri Mar 17 15:49:45 2023 -0400 Commit: Henry Castro <hcas...@collabora.com> CommitDate: Thu May 18 18:17:33 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> 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 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)