diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-08-04 12:14:43 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-08-04 12:25:56 -0400 |
commit | 0ee728634d29aa3e77139491d4eac2b2962ee418 (patch) | |
tree | e8fa1993aa0dd62290d42941f967681cac0ce2dc | |
parent | 4a8f2431718f99de6fd9ee3461d703d007261c03 (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
-rw-r--r-- | chart2/qa/extras/chart2export.cxx | 11 | ||||
-rw-r--r-- | chart2/qa/extras/chart2import.cxx | 26 | ||||
-rw-r--r-- | chart2/qa/extras/charttest.hxx | 3 | ||||
-rwxr-xr-x | chart2/qa/extras/data/xlsx/chart-auto-background.xlsx | bin | 0 -> 11310 bytes |
4 files changed, 39 insertions, 1 deletions
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx index 0c31f225efea..1beb411e873e 100644 --- a/chart2/qa/extras/chart2export.cxx +++ b/chart2/qa/extras/chart2export.cxx @@ -779,6 +779,17 @@ void Chart2ExportTest::testDataLabelBordersDOCX() load("/chart2/qa/extras/data/docx/", "data-label-borders.docx"); Reference<chart2::XChartDocument> xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY); + + // "Automatic" chart background fill in docx 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 docx should be loaded as solid fill.", + eStyle == drawing::FillStyle_SOLID); + CPPUNIT_ASSERT_MESSAGE("'Automatic' chart background fill in docx should be loaded as solid white.", + (nColor & 0x00FFFFFF) == 0x00FFFFFF); // highest 2 bytes are transparency which we ignore here. + aTest.checkObject1(xChartDoc); xChartDoc.set(getChartDocFromWriter(1), uno::UNO_QUERY); aTest.checkObject2(xChartDoc); 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(); diff --git a/chart2/qa/extras/charttest.hxx b/chart2/qa/extras/charttest.hxx index 7c53b95ecc9d..d9c022d82103 100644 --- a/chart2/qa/extras/charttest.hxx +++ b/chart2/qa/extras/charttest.hxx @@ -30,7 +30,6 @@ #include <unotools/tempfile.hxx> -#include <com/sun/star/drawing/XDrawPageSupplier.hpp> #include <com/sun/star/chart2/XAnyDescriptionAccess.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> #include <com/sun/star/chart2/XDiagram.hpp> @@ -46,6 +45,8 @@ #include <com/sun/star/chart/XChartDataArray.hpp> #include <com/sun/star/chart/XComplexDescriptionAccess.hpp> #include <com/sun/star/drawing/XDrawPagesSupplier.hpp> +#include <com/sun/star/drawing/XDrawPageSupplier.hpp> +#include <com/sun/star/drawing/FillStyle.hpp> #include <com/sun/star/chart/XChartDocument.hpp> #include <com/sun/star/util/XNumberFormatsSupplier.hpp> #include <com/sun/star/util/NumberFormat.hpp> diff --git a/chart2/qa/extras/data/xlsx/chart-auto-background.xlsx b/chart2/qa/extras/data/xlsx/chart-auto-background.xlsx Binary files differnew file mode 100755 index 000000000000..a4594ad4fc1a --- /dev/null +++ b/chart2/qa/extras/data/xlsx/chart-auto-background.xlsx |