diff options
author | Balazs Varga <balazs.varga991@gmail.com> | 2019-11-12 12:21:20 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2019-11-13 08:34:23 +0100 |
commit | 124db1f2e3008493254e5d710221dbdd40a526db (patch) | |
tree | 84e0e2e02d0feacdff8146b2b423b9a87afc5ec0 /chart2 | |
parent | d7149889a9e1cae7f255691c2a35090ac3245bfa (diff) |
tdf#128732 Chart OOXML import: fix rounding error of color transparency
Change-Id: I52efb541d62a9536c2eb5f99453dc2cb594e6fe4
Reviewed-on: https://gerrit.libreoffice.org/82500
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/qa/extras/chart2import.cxx | 27 | ||||
-rw-r--r-- | chart2/qa/extras/data/xlsx/tdf128732.xlsx | bin | 0 -> 7511 bytes |
2 files changed, 27 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index f04b42d2db6f..665b9f96e62d 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -33,6 +33,8 @@ #include <iterator> #include <com/sun/star/util/Color.hpp> +#include <com/sun/star/awt/Gradient.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> class Chart2ImportTest : public ChartTest { @@ -63,6 +65,7 @@ public: void testODPChartSeries(); void testBnc864396(); void testBnc882383(); + void testTransparancyGradientValue(); void testBnc889755(); void testSimpleStrictXLSX(); void testDelayedCellImport(); // chart range referencing content on later sheets @@ -167,6 +170,7 @@ public: CPPUNIT_TEST(testODPChartSeries); CPPUNIT_TEST(testBnc864396); CPPUNIT_TEST(testBnc882383); + CPPUNIT_TEST(testTransparancyGradientValue); CPPUNIT_TEST(testBnc889755); CPPUNIT_TEST(testSimpleStrictXLSX); CPPUNIT_TEST(testDelayedCellImport); @@ -814,6 +818,29 @@ void Chart2ImportTest::testBnc882383() CPPUNIT_ASSERT(!sGradientName.isEmpty()); } +void Chart2ImportTest::testTransparancyGradientValue() +{ + load("/chart2/qa/extras/data/xlsx/", "tdf128732.xlsx"); + uno::Reference< chart2::XChartDocument > xChartDoc = getChartDocFromSheet(0, mxComponent); + CPPUNIT_ASSERT(xChartDoc.is()); + uno::Reference<chart2::XDataSeries> xDataSeries(getDataSeriesFromDoc(xChartDoc, 0)); + CPPUNIT_ASSERT(xDataSeries.is()); + + uno::Reference<beans::XPropertySet> xPropertySet(xDataSeries->getDataPointByIndex(0), uno::UNO_SET_THROW); + OUString sTranspGradientName; + xPropertySet->getPropertyValue("FillTransparenceGradientName") >>= sTranspGradientName; + CPPUNIT_ASSERT(!sTranspGradientName.isEmpty()); + + awt::Gradient aTransparenceGradient; + uno::Reference< lang::XMultiServiceFactory > xFact(xChartDoc, uno::UNO_QUERY); + CPPUNIT_ASSERT(xFact.is()); + uno::Reference< container::XNameAccess > xTransparenceGradient(xFact->createInstance("com.sun.star.drawing.TransparencyGradientTable"), uno::UNO_QUERY); + uno::Any rTransparenceValue = xTransparenceGradient->getByName(sTranspGradientName); + CPPUNIT_ASSERT(rTransparenceValue >>= aTransparenceGradient); + CPPUNIT_ASSERT_EQUAL(sal_Int32(3355443), aTransparenceGradient.EndColor); + CPPUNIT_ASSERT_EQUAL(sal_Int32(5000268), aTransparenceGradient.StartColor); +} + void Chart2ImportTest::testSimpleStrictXLSX() { load("/chart2/qa/extras/data/xlsx/", "strict_chart.xlsx"); diff --git a/chart2/qa/extras/data/xlsx/tdf128732.xlsx b/chart2/qa/extras/data/xlsx/tdf128732.xlsx Binary files differnew file mode 100644 index 000000000000..b92afb1ed6c5 --- /dev/null +++ b/chart2/qa/extras/data/xlsx/tdf128732.xlsx |