summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-04-09 08:17:17 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-04-09 08:18:33 +0200
commit6c9337ecce749ab2769ed1986d05dbb37e2e3fab (patch)
tree6c84d5e6e3362cae7f136331bf765729dd5d6356 /sc
parenta86f37c5182d11d8f43a8b173d0d4dcea4be42c4 (diff)
add test case for tdf#98554
Change-Id: I7437a1ed8dd915411f6014bc01d4224fe5604f1d
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/data/xlsx/cond_format_theme_color3.xlsxbin0 -> 8530 bytes
-rw-r--r--sc/qa/unit/subsequent_filters-test.cxx56
2 files changed, 56 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xlsx/cond_format_theme_color3.xlsx b/sc/qa/unit/data/xlsx/cond_format_theme_color3.xlsx
new file mode 100644
index 000000000000..2e97684d7880
--- /dev/null
+++ b/sc/qa/unit/data/xlsx/cond_format_theme_color3.xlsx
Binary files differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 8106d2166b75..720cdfefb82c 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -141,6 +141,7 @@ public:
void testNewCondFormatXLSX();
void testCondFormatThemeColorXLSX();
void testCondFormatThemeColor2XLSX(); // negative bar color and axis color
+ void testCondFormatThemeColor3XLSX(); // theme index 2 and 3 are switched
void testComplexIconSetsXLSX();
void testCondFormatParentXLSX();
void testColorScaleNumWithRefXLSX();
@@ -259,6 +260,7 @@ public:
CPPUNIT_TEST(testNewCondFormatXLSX);
CPPUNIT_TEST(testCondFormatThemeColorXLSX);
CPPUNIT_TEST(testCondFormatThemeColor2XLSX);
+ CPPUNIT_TEST(testCondFormatThemeColor3XLSX);
CPPUNIT_TEST(testComplexIconSetsXLSX);
CPPUNIT_TEST(testCondFormatParentXLSX);
CPPUNIT_TEST(testColorScaleNumWithRefXLSX);
@@ -2472,6 +2474,60 @@ void ScFiltersTest::testCondFormatThemeColor2XLSX()
namespace {
+void checkDatabarPositiveColor(ScConditionalFormat* pFormat, const Color& rColor)
+{
+ CPPUNIT_ASSERT(pFormat);
+ const ScFormatEntry* pEntry = pFormat->GetEntry(0);
+ CPPUNIT_ASSERT(pEntry);
+ CPPUNIT_ASSERT_EQUAL(pEntry->GetType(), condformat::DATABAR);
+ const ScDataBarFormat* pDataBar = static_cast<const ScDataBarFormat*>(pEntry);
+ const ScDataBarFormatData* pDataBarFormatData = pDataBar->GetDataBarData();
+
+ CPPUNIT_ASSERT_EQUAL(rColor, pDataBarFormatData->maPositiveColor);
+}
+
+}
+
+void ScFiltersTest::testCondFormatThemeColor3XLSX()
+{
+ ScDocShellRef xDocSh = ScBootstrapFixture::loadDoc("cond_format_theme_color3.", FORMAT_XLSX);
+
+ CPPUNIT_ASSERT_MESSAGE("Failed to load document", xDocSh.Is());
+
+ ScDocument& rDoc = xDocSh->GetDocument();
+ ScConditionalFormat* pFormat = rDoc.GetCondFormat(1, 3, 0);
+ CPPUNIT_ASSERT(pFormat);
+ const ScFormatEntry* pEntry = pFormat->GetEntry(0);
+ CPPUNIT_ASSERT(pEntry);
+ CPPUNIT_ASSERT_EQUAL(pEntry->GetType(), condformat::COLORSCALE);
+ const ScColorScaleFormat* pColorScale = static_cast<const ScColorScaleFormat*>(pEntry);
+
+ CPPUNIT_ASSERT_EQUAL(size_t(2), pColorScale->size());
+ const ScColorScaleEntry* pColorScaleEntry = pColorScale->GetEntry(0);
+ CPPUNIT_ASSERT(pColorScaleEntry);
+ CPPUNIT_ASSERT_EQUAL(Color(175, 171, 171), pColorScaleEntry->GetColor());
+
+ pColorScaleEntry = pColorScale->GetEntry(1);
+ CPPUNIT_ASSERT(pColorScaleEntry);
+ CPPUNIT_ASSERT_EQUAL(Color(51, 63, 80), pColorScaleEntry->GetColor());
+
+ pFormat = rDoc.GetCondFormat(3, 3, 0);
+ checkDatabarPositiveColor(pFormat, Color(59, 56, 56));
+
+ pFormat = rDoc.GetCondFormat(5, 3, 0);
+ checkDatabarPositiveColor(pFormat, Color(173, 185, 202));
+
+ pFormat = rDoc.GetCondFormat(7, 3, 0);
+ checkDatabarPositiveColor(pFormat, Color(89, 89, 89));
+
+ pFormat = rDoc.GetCondFormat(9, 3, 0);
+ checkDatabarPositiveColor(pFormat, Color(217, 217, 217));
+
+ xDocSh->DoClose();
+}
+
+namespace {
+
void testComplexIconSetsXLSX_Impl(ScDocument& rDoc, SCCOL nCol, ScIconSetType eType)
{
ScConditionalFormat* pFormat = rDoc.GetCondFormat(nCol, 1, 0);