diff options
author | Balazs Varga <balazs.varga991@gmail.com> | 2020-01-21 14:20:38 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-01-24 13:01:44 +0100 |
commit | a4cdd4d1266e77330d4745f369db85ee7dba265c (patch) | |
tree | 318b92a64666f3a5cd59a4ee860efa6832ca215e /chart2 | |
parent | 3e4cad1f4b4a6a07b516a0d205d642a985e17484 (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>
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 9317785520c6..223ca95b2b32 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(); @@ -217,6 +218,7 @@ public: CPPUNIT_TEST(testCombinedChartAttachedAxisXLSX); CPPUNIT_TEST(testTdf90510); CPPUNIT_TEST(testTdf109858); + CPPUNIT_TEST(testTdf130105); CPPUNIT_TEST(testTdf111173); CPPUNIT_TEST(testTdf122226); @@ -1668,12 +1670,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 |