diff options
author | Tünde Tóth <toth.tunde@nisz.hu> | 2020-09-15 14:27:57 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-09-23 10:29:50 +0200 |
commit | 2e1a1054a4a98415057e72269ace9db075d3b191 (patch) | |
tree | 2efc134cab3432a01441b3c91e95b5e3db8134f8 /chart2/qa | |
parent | 4f2daa1cc683a3e3abbca6e15aa168add414eeff (diff) |
tdf#136752 pie chart: improve data label position
to avoid chart distortion.
Set the maximum text width of data point label shape based
to the 80% of the remaining space, when text wrapping is enabled
and the label placement is AVOID_OVERLAP.
Change-Id: I174089ec62df3aa21b5d1f26f74d475945d83684
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102744
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.cxx | 25 | ||||
-rw-r--r-- | chart2/qa/extras/data/xlsx/tdf136752.xlsx | bin | 0 -> 11909 bytes |
2 files changed, 23 insertions, 2 deletions
diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index fe0a2c48231e..6097a8a0388f 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -165,6 +165,7 @@ public: void testTdf136105(); void testTdf91250(); void testTdf134111(); + void testTdf136752(); CPPUNIT_TEST_SUITE(Chart2ImportTest); CPPUNIT_TEST(Fdo60083); @@ -278,6 +279,7 @@ public: CPPUNIT_TEST(testTdf136105); CPPUNIT_TEST(testTdf91250); CPPUNIT_TEST(testTdf134111); + CPPUNIT_TEST(testTdf136752); CPPUNIT_TEST_SUITE_END(); @@ -2550,8 +2552,8 @@ void Chart2ImportTest::testTdf133376() CPPUNIT_ASSERT(xDataPointLabel.is()); // Check the position of the 3rd data point label, which is out from the pie slice awt::Point aLabelPosition = xDataPointLabel->getPosition(); - CPPUNIT_ASSERT_DOUBLES_EQUAL(482, aLabelPosition.X, 30); - CPPUNIT_ASSERT_DOUBLES_EQUAL(5427, aLabelPosition.Y, 30); + CPPUNIT_ASSERT_DOUBLES_EQUAL(349, aLabelPosition.X, 30); + CPPUNIT_ASSERT_DOUBLES_EQUAL(5480, aLabelPosition.Y, 30); } void Chart2ImportTest::testTdf134225() @@ -2658,6 +2660,25 @@ void Chart2ImportTest::testTdf134111() CPPUNIT_ASSERT(bTextBreak); } +void Chart2ImportTest::testTdf136752() +{ + load("/chart2/qa/extras/data/xlsx/", "tdf136752.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()); + // Check the position of the 1st data point label, which is out from the pie slice + awt::Point aLabelPosition = xDataPointLabel->getPosition(); + CPPUNIT_ASSERT_DOUBLES_EQUAL(8675, aLabelPosition.X, 500); + CPPUNIT_ASSERT_DOUBLES_EQUAL(1458, aLabelPosition.Y, 500); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/chart2/qa/extras/data/xlsx/tdf136752.xlsx b/chart2/qa/extras/data/xlsx/tdf136752.xlsx Binary files differnew file mode 100644 index 000000000000..05fad58cfff5 --- /dev/null +++ b/chart2/qa/extras/data/xlsx/tdf136752.xlsx |