diff options
author | Balazs Varga <balazs.varga991@gmail.com> | 2019-03-16 18:05:01 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2019-03-18 16:38:55 +0100 |
commit | 0dac43445b35da7e554dd4d7574c59611a0d0be1 (patch) | |
tree | 25cac121065fa662701be54cfa4971d4f5e88714 /chart2 | |
parent | cf89d6dbfd72e60e459b2ffef313a6d8b477857b (diff) |
tdf#81437 XLSX import: fix missing chart border
of MSO 2007/2010 documents with "automatic" chart area
formatting, setting also the default 0.75 pt border width
and light gray border color.
Note: MSO 2007/2010 and MSO 2013/2016 have different
"automatic" border colors. This fix uses the last, light
gray version instead of the dark one.
Change-Id: I579f3745d5fcb2a36e1b4d519320631d20e60fd4
Reviewed-on: https://gerrit.libreoffice.org/69341
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/qa/extras/chart2import.cxx | 23 | ||||
-rwxr-xr-x | chart2/qa/extras/data/xlsx/chart-area-style-border.xlsx | bin | 0 -> 12006 bytes |
2 files changed, 23 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index 0d8eda002a3b..2172493e654e 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -19,6 +19,7 @@ #include <com/sun/star/chart2/XInternalDataProvider.hpp> #include <com/sun/star/chart/XChartDataArray.hpp> #include <com/sun/star/drawing/FillStyle.hpp> +#include <com/sun/star/drawing/LineStyle.hpp> #include <com/sun/star/chart/XAxisXSupplier.hpp> #include <com/sun/star/chart/MissingValueTreatment.hpp> #include <com/sun/star/chart2/TickmarkStyle.hpp> @@ -70,6 +71,7 @@ public: void testTdf106217(); void testTdf108021(); void testAutoBackgroundXLSX(); + void testAutoChartAreaBorderPropXLSX(); void testChartAreaStyleBackgroundXLSX(); void testChartHatchFillXLSX(); void testAxisTextRotationXLSX(); @@ -155,6 +157,7 @@ public: CPPUNIT_TEST(testTdf106217); CPPUNIT_TEST(testTdf108021); CPPUNIT_TEST(testAutoBackgroundXLSX); + CPPUNIT_TEST(testAutoChartAreaBorderPropXLSX); CPPUNIT_TEST(testChartAreaStyleBackgroundXLSX); CPPUNIT_TEST(testChartHatchFillXLSX); CPPUNIT_TEST(testAxisTextRotationXLSX); @@ -920,6 +923,26 @@ void Chart2ImportTest::testAutoBackgroundXLSX() sal_Int32(0x00FFFFFF), sal_Int32(nColor & 0x00FFFFFF)); // highest 2 bytes are transparency which we ignore here. } +void Chart2ImportTest::testAutoChartAreaBorderPropXLSX() +{ + load("/chart2/qa/extras/data/xlsx/", "chart-area-style-border.xlsx"); + uno::Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent); + CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is()); + + // Test "Automatic" chartarea border style/color/width. + Reference<beans::XPropertySet> xPropSet = xChartDoc->getPageBackground(); + CPPUNIT_ASSERT(xPropSet.is()); + drawing::LineStyle eStyle = xPropSet->getPropertyValue("LineStyle").get<drawing::LineStyle>(); + sal_Int32 nColor = xPropSet->getPropertyValue("LineColor").get<sal_Int32>(); + sal_Int32 nWidth = xPropSet->getPropertyValue("LineWidth").get<sal_Int32>(); + CPPUNIT_ASSERT_EQUAL_MESSAGE("'Automatic' chartarea border should be loaded as solid style.", + drawing::LineStyle_SOLID, eStyle); + CPPUNIT_ASSERT_EQUAL_MESSAGE("'Automatic' chartarea border color should be loaded as light gray.", + sal_Int32(0xD9D9D9), nColor); + CPPUNIT_ASSERT_EQUAL_MESSAGE("'Automatic' chartarea border width should be loaded as 0.75 pt (~0.026 cm)", + sal_Int32(26), nWidth); +} + void Chart2ImportTest::testChartAreaStyleBackgroundXLSX() { load("/chart2/qa/extras/data/xlsx/", "chart-area-style-background.xlsx"); diff --git a/chart2/qa/extras/data/xlsx/chart-area-style-border.xlsx b/chart2/qa/extras/data/xlsx/chart-area-style-border.xlsx Binary files differnew file mode 100755 index 000000000000..81a6a6e606bb --- /dev/null +++ b/chart2/qa/extras/data/xlsx/chart-area-style-border.xlsx |