summaryrefslogtreecommitdiff
path: root/chart2/qa
diff options
context:
space:
mode:
authorTünde Tóth <toth.tunde@nisz.hu>2020-12-16 11:29:48 +0100
committerLászló Németh <nemeth@numbertext.org>2020-12-28 11:55:40 +0100
commitf22b77f204e433004aeb5fc2885881c03a62aa70 (patch)
tree862351744f9d245e1b004ceefcb188227a89d478 /chart2/qa
parentbd51df8e4e267cdad369af402bb243cb3ed222f1 (diff)
tdf#121281 pie chart: improve data label position
to avoid chart distortion. Move the data label to inside the chart area when it goes outside the border. Change-Id: I78669ed601f28129944ac8f61c6478d386322b76 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107829 Tested-by: Jenkins Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'chart2/qa')
-rw-r--r--chart2/qa/extras/chart2import.cxx21
-rw-r--r--chart2/qa/extras/data/xlsx/incorrect_label_position.xlsxbin0 -> 14112 bytes
2 files changed, 21 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx
index 9bb042fb6867..943cbd57ea99 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -171,6 +171,7 @@ public:
void testTdf137734();
void testTdf137874();
void testTdfCustomShapePos();
+ void testTdf121281();
CPPUNIT_TEST_SUITE(Chart2ImportTest);
CPPUNIT_TEST(Fdo60083);
@@ -291,6 +292,7 @@ public:
CPPUNIT_TEST(testTdf137734);
CPPUNIT_TEST(testTdf137874);
CPPUNIT_TEST(testTdfCustomShapePos);
+ CPPUNIT_TEST(testTdf121281);
CPPUNIT_TEST_SUITE_END();
@@ -2802,6 +2804,25 @@ void Chart2ImportTest::testTdfCustomShapePos()
}
}
+void Chart2ImportTest::testTdf121281()
+{
+ load("/chart2/qa/extras/data/xlsx/", "incorrect_label_position.xlsx");
+ Reference<chart::XChartDocument> xChartDoc(getChartDocFromSheet(0, mxComponent),
+ UNO_QUERY_THROW);
+ Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(xChartDoc, UNO_QUERY_THROW);
+ Reference<drawing::XDrawPage> xDrawPage(xDrawPageSupplier->getDrawPage(), UNO_SET_THROW);
+ Reference<drawing::XShapes> xShapes(xDrawPage->getByIndex(0), UNO_QUERY_THROW);
+ Reference<drawing::XShape> xDataPointLabel(
+ getShapeByName(xShapes,
+ "CID/MultiClick/CID/D=0:CS=0:CT=0:Series=0:DataLabels=:DataLabel=0"),
+ UNO_SET_THROW);
+
+ CPPUNIT_ASSERT(xDataPointLabel.is());
+ awt::Point aLabelPosition = xDataPointLabel->getPosition();
+ // This failed, if the data label flowed out of the chart area.
+ CPPUNIT_ASSERT_GREATEREQUAL(static_cast<sal_Int32>(0), aLabelPosition.Y);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/xlsx/incorrect_label_position.xlsx b/chart2/qa/extras/data/xlsx/incorrect_label_position.xlsx
new file mode 100644
index 000000000000..4f133b558116
--- /dev/null
+++ b/chart2/qa/extras/data/xlsx/incorrect_label_position.xlsx
Binary files differ