Kaydet (Commit) 0ee72863 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

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
üst 4a8f2431
......@@ -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);
......
......@@ -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();
......
......@@ -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>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment