From 1351d5b97fd3e07c2bac1b7659726809bcb1c28d Mon Sep 17 00:00:00 2001 From: Balazs Varga Date: Wed, 31 Oct 2018 08:43:47 +0100 Subject: tdf#108104 OOXML Import: Fix Hatch fill in Charts Sets an explicit fill hatch, or creates a named fill hatch and stored in a global container. With this patch the SUPPORTED MS Office hatch styles by LibreOffice, or the custom LibreOffice hatches will be appeared correctly instead of the previous display as horizontal lines in LibreOffice. (The background color of the hatch styles are not imported correcty, but that is another BUG.) Change-Id: Ifda9dc805dd08f58db10b35f40d7f511a8614f77 Reviewed-on: https://gerrit.libreoffice.org/62681 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- chart2/qa/extras/chart2import.cxx | 24 +++++++++++++++++++++++ chart2/qa/extras/data/xlsx/chart-hatch-fill.xlsx | Bin 0 -> 11555 bytes 2 files changed, 24 insertions(+) create mode 100755 chart2/qa/extras/data/xlsx/chart-hatch-fill.xlsx (limited to 'chart2/qa/extras') diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index 590cd377c937..6076c63e3680 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -71,6 +71,7 @@ public: void testTdf106217(); void testAutoBackgroundXLSX(); void testChartAreaStyleBackgroundXLSX(); + void testChartHatchFillXLSX(); void testAxisTextRotationXLSX(); // void testTextCanOverlapXLSX(); // TODO : temporarily disabled. void testNumberFormatsXLSX(); @@ -144,6 +145,7 @@ public: CPPUNIT_TEST(testTdf106217); CPPUNIT_TEST(testAutoBackgroundXLSX); CPPUNIT_TEST(testChartAreaStyleBackgroundXLSX); + CPPUNIT_TEST(testChartHatchFillXLSX); CPPUNIT_TEST(testAxisTextRotationXLSX); // CPPUNIT_TEST(testTextCanOverlapXLSX); // TODO : temporarily disabled. CPPUNIT_TEST(testNumberFormatsXLSX); @@ -896,6 +898,28 @@ void Chart2ImportTest::testChartAreaStyleBackgroundXLSX() sal_Int32(0), nColor); } +void Chart2ImportTest::testChartHatchFillXLSX() +{ + load("/chart2/qa/extras/data/xlsx/", "chart-hatch-fill.xlsx"); + uno::Reference xChartDoc = getChartDocFromSheet(0, mxComponent); + CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is()); + + Reference xPropSet = xChartDoc->getPageBackground(); + CPPUNIT_ASSERT(xPropSet.is()); + drawing::FillStyle eStyle = xPropSet->getPropertyValue("FillStyle").get(); + + CPPUNIT_ASSERT_EQUAL_MESSAGE("Chart background fill in this xlsx should be loaded as hatch fill.", + drawing::FillStyle_HATCH, eStyle); + + uno::Reference xDataSeries(getDataSeriesFromDoc(xChartDoc, 0)); + CPPUNIT_ASSERT(xDataSeries.is()); + + uno::Reference xPropertySet(xDataSeries->getDataPointByIndex(1), uno::UNO_QUERY_THROW); + OUString sHatchName; + xPropertySet->getPropertyValue("HatchName") >>= sHatchName; + CPPUNIT_ASSERT(!sHatchName.isEmpty()); +} + void Chart2ImportTest::testAxisTextRotationXLSX() { load("/chart2/qa/extras/data/xlsx/", "axis-label-rotation.xlsx"); diff --git a/chart2/qa/extras/data/xlsx/chart-hatch-fill.xlsx b/chart2/qa/extras/data/xlsx/chart-hatch-fill.xlsx new file mode 100755 index 000000000000..e15a46b144dd Binary files /dev/null and b/chart2/qa/extras/data/xlsx/chart-hatch-fill.xlsx differ -- cgit