summaryrefslogtreecommitdiff
path: root/chart2/qa/extras/chart2import.cxx
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-08-04 12:14:43 -0400
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-08-04 12:25:56 -0400
commit0ee728634d29aa3e77139491d4eac2b2962ee418 (patch)
treee8fa1993aa0dd62290d42941f967681cac0ce2dc /chart2/qa/extras/chart2import.cxx
parent4a8f2431718f99de6fd9ee3461d703d007261c03 (diff)
bnc#886540: Add test cases for chart background fill variance.
"Automatic" fill in docx and xlsx should be solid white, whereas in pptx it is no fill (transparent). Change-Id: I7e64f2f895e4c4ed072a234e622a348599456f37
Diffstat (limited to 'chart2/qa/extras/chart2import.cxx')
-rw-r--r--chart2/qa/extras/chart2import.cxx26
1 files changed, 26 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx
index 659987ae3d7c..73200f92c81c 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -52,6 +52,7 @@ public:
void testFlatODSStackedColumnChart();
void testFdo78080();
void testFdo54361();
+ void testAutoBackgroundXLSX();
CPPUNIT_TEST_SUITE(Chart2ImportTest);
CPPUNIT_TEST(Fdo60083);
@@ -83,6 +84,7 @@ public:
CPPUNIT_TEST(testFlatODSStackedColumnChart);
CPPUNIT_TEST(testFdo78080);
CPPUNIT_TEST(testFdo54361);
+ CPPUNIT_TEST(testAutoBackgroundXLSX);
CPPUNIT_TEST_SUITE_END();
private:
@@ -344,6 +346,13 @@ void Chart2ImportTest::testPPTXHiddenDataSeries()
Reference<chart2::XChartDocument> xChartDoc(getChartDocFromDrawImpress(0, 0), uno::UNO_QUERY);
CPPUNIT_ASSERT(xChartDoc.is());
+ // "Automatic" chart background fill in pptx should be loaded as no fill.
+ Reference<beans::XPropertySet> xPropSet = xChartDoc->getPageBackground();
+ CPPUNIT_ASSERT(xPropSet.is());
+ drawing::FillStyle eStyle = xPropSet->getPropertyValue("FillStyle").get<drawing::FillStyle>();
+ CPPUNIT_ASSERT_MESSAGE("'Automatic' chart background fill in pptx should be loaded as no fill (transparent).",
+ eStyle == drawing::FillStyle_NONE);
+
Reference<chart2::XChartType> xCT = getChartTypeFromDoc(xChartDoc, 0, 0);
CPPUNIT_ASSERT(xCT.is());
@@ -600,6 +609,23 @@ void Chart2ImportTest::testFdo54361()
CPPUNIT_ASSERT_MESSAGE("Background needs to be with solid fill style", aStyle == 1);
}
+void Chart2ImportTest::testAutoBackgroundXLSX()
+{
+ load("/chart2/qa/extras/data/xlsx/", "chart-auto-background.xlsx");
+ uno::Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
+ CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
+
+ // "Automatic" chart background fill in xlsx should be loaded as solid white.
+ Reference<beans::XPropertySet> xPropSet = xChartDoc->getPageBackground();
+ CPPUNIT_ASSERT(xPropSet.is());
+ drawing::FillStyle eStyle = xPropSet->getPropertyValue("FillStyle").get<drawing::FillStyle>();
+ sal_Int32 nColor = xPropSet->getPropertyValue("FillColor").get<sal_Int32>();
+ CPPUNIT_ASSERT_MESSAGE("'Automatic' chart background fill in xlsx should be loaded as solid fill.",
+ eStyle == drawing::FillStyle_SOLID);
+ CPPUNIT_ASSERT_MESSAGE("'Automatic' chart background fill in xlsx should be loaded as solid white.",
+ (nColor & 0x00FFFFFF) == 0x00FFFFFF); // highest 2 bytes are transparency which we ignore here.
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest);
CPPUNIT_PLUGIN_IMPLEMENT();