diff options
author | Balazs Varga <balazs.varga991@gmail.com> | 2020-01-21 14:20:38 +0100 |
---|---|---|
committer | Xisco Faulí <xiscofauli@libreoffice.org> | 2020-02-26 11:59:27 +0100 |
commit | 14a4992311a7cffdf66f8c4656b0c9cb5ebd4e14 (patch) | |
tree | b21945d084f91c4887fe45355fa0a51a701d0865 /chart2 | |
parent | a563d4279e383de3f84379b6393188bcbcb64a95 (diff) |
tdf#130105 Chart OOXML Import: Fix data label position
The position of datapoint labels was overwritten with the
position of series placement. Do not overwrite datapoint
labels placement, if we have explicit datapoint label placement.
Regression from commit: 70944a849dc59fa686e3f316a3983dbc8a47017f
(tdf#109858: Override default point label placement setting...)
Change-Id: Ic27c8a7eb93e8c3776389d1b3d285d120568f024
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87137
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: László Németh <nemeth@numbertext.org>
(cherry picked from commit a4cdd4d1266e77330d4745f369db85ee7dba265c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87594
Tested-by: Jenkins
Reviewed-by: Balazs Varga <balazs.varga991@gmail.com>
Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/qa/extras/chart2import.cxx | 32 | ||||
-rw-r--r-- | chart2/qa/extras/data/xlsx/barchart_outend.xlsx | bin | 0 -> 15277 bytes |
2 files changed, 29 insertions, 3 deletions
diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index 9fa051df2bc1..7b8aaed20371 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -117,6 +117,7 @@ public: void testTdf90510(); // Pie chart label placement settings(XLS) void testTdf109858(); // Pie chart label placement settings(XLSX) + void testTdf130105(); void testTdf111173(); void testTdf122226(); @@ -218,6 +219,7 @@ public: CPPUNIT_TEST(testCombinedChartAttachedAxisXLSX); CPPUNIT_TEST(testTdf90510); CPPUNIT_TEST(testTdf109858); + CPPUNIT_TEST(testTdf130105); CPPUNIT_TEST(testTdf111173); CPPUNIT_TEST(testTdf122226); @@ -1669,12 +1671,36 @@ void Chart2ImportTest::testTdf109858() { load("/chart2/qa/extras/data/xlsx/", "piechart_outside.xlsx"); uno::Reference< chart::XChartDocument > xChart1Doc( getChartCompFromSheet( 0, mxComponent ), UNO_QUERY_THROW ); - Reference<beans::XPropertySet> xPropSet( xChart1Doc->getDiagram()->getDataPointProperties( 0, 0 ), uno::UNO_SET_THROW ); - uno::Any aAny = xPropSet->getPropertyValue( "LabelPlacement" ); + + // test data point labels position + Reference<beans::XPropertySet> xDataPointPropSet( xChart1Doc->getDiagram()->getDataPointProperties( 0, 0 ), uno::UNO_SET_THROW ); + uno::Any aAny = xDataPointPropSet->getPropertyValue( "LabelPlacement" ); CPPUNIT_ASSERT( aAny.hasValue() ); sal_Int32 nLabelPlacement = 0; CPPUNIT_ASSERT( aAny >>= nLabelPlacement ); - CPPUNIT_ASSERT_EQUAL_MESSAGE( "Data labels should be placed outside", chart::DataLabelPlacement::OUTSIDE, nLabelPlacement ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Data point label should be placed bestFit", chart::DataLabelPlacement::AVOID_OVERLAP, nLabelPlacement ); + + // test data series label position + Reference<beans::XPropertySet> xSeriesPropSet(xChart1Doc->getDiagram()->getDataRowProperties(0), uno::UNO_SET_THROW); + aAny = xSeriesPropSet->getPropertyValue( "LabelPlacement" ); + CPPUNIT_ASSERT( aAny >>= nLabelPlacement ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Data series labels should be placed outside", chart::DataLabelPlacement::OUTSIDE, nLabelPlacement ); +} + +void Chart2ImportTest::testTdf130105() +{ + load("/chart2/qa/extras/data/xlsx/", "barchart_outend.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); + uno::Any aAny = xPropertySet->getPropertyValue("LabelPlacement"); + CPPUNIT_ASSERT(aAny.hasValue()); + sal_Int32 nLabelPlacement = 0; + CPPUNIT_ASSERT(aAny >>= nLabelPlacement); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Data label should be placed outend", chart::DataLabelPlacement::OUTSIDE, nLabelPlacement); } void Chart2ImportTest::testTdf111173() diff --git a/chart2/qa/extras/data/xlsx/barchart_outend.xlsx b/chart2/qa/extras/data/xlsx/barchart_outend.xlsx Binary files differnew file mode 100644 index 000000000000..621c0c284439 --- /dev/null +++ b/chart2/qa/extras/data/xlsx/barchart_outend.xlsx |