diff options
author | Henry Castro <hcastro@collabora.com> | 2023-03-17 15:49:45 -0400 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2023-03-23 07:15:54 +0000 |
commit | cd262cf8585e3b7d2258703dd257cfd23c2ae44d (patch) | |
tree | ebf0795c28eb155aec8d213082f782491019f9a2 | |
parent | 9d18195cc0bed315c260edc28b1b81ec33c3f091 (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>
Signed-off-by: Henry Castro <hcastro@collabora.com>
Change-Id: Ib57dac07027e2c3c01ee556a3df791f49637be54
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149346
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
-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 | 27 |
2 files changed, 27 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 0f4923716490..c2c3ba68add2 100644 --- a/sc/qa/unit/subsequent_filters_test.cxx +++ b/sc/qa/unit/subsequent_filters_test.cxx @@ -166,6 +166,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(); @@ -288,6 +289,7 @@ public: CPPUNIT_TEST(testCondFormatImportCellIs); CPPUNIT_TEST(testCondFormatThemeColor2XLSX); CPPUNIT_TEST(testCondFormatThemeColor3XLSX); + CPPUNIT_TEST(testCondFormatCfvoScaleValueXLSX); CPPUNIT_TEST(testComplexIconSetsXLSX); CPPUNIT_TEST(testTdf101104); CPPUNIT_TEST(testTdf64401); @@ -2572,6 +2574,31 @@ void ScFiltersTest::testCondFormatThemeColor2XLSX() xDocSh->DoClose(); } +void ScFiltersTest::testCondFormatCfvoScaleValueXLSX() +{ + ScDocShellRef xDocSh = ScBootstrapFixture::loadDoc(u"condformat_databar.", FORMAT_XLSX); + + CPPUNIT_ASSERT_MESSAGE("Failed to load condformat_databar.xlsx", xDocSh.is()); + + ScDocument& rDoc = xDocSh->GetDocument(); + ScConditionalFormat* pFormat = rDoc.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()); + + xDocSh->DoClose(); +} + namespace { void checkDatabarPositiveColor(const ScConditionalFormat* pFormat, const Color& rColor) |