diff options
author | Tünde Tóth <toth.tunde@nisz.hu> | 2022-07-27 08:58:35 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2022-08-18 13:39:31 +0200 |
commit | e59db22b3b57c9e1a5678218cb56fb75bcc84c26 (patch) | |
tree | ebebb3ac16caba9876cd136561d534e8509cec64 /chart2/qa/extras/chart2import2.cxx | |
parent | 326534372ee5436d2f6e972de46fc01bb635e9d9 (diff) |
tdf#150434: chart2, XLSX import: strip long legend labels
Full text of legend labels could overflow the chart area,
if the legend text was too long. If it's longer than
520 characters, strip it at the first space from the
500th character (or if there is no space, at the 500th
character). This results better XLSX interoperability, too.
Change-Id: I23a94f6baaf620b40e9b2819738eba5c5a921722
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137492
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'chart2/qa/extras/chart2import2.cxx')
-rw-r--r-- | chart2/qa/extras/chart2import2.cxx | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2import2.cxx b/chart2/qa/extras/chart2import2.cxx index ee41c37dd48a..eb983f7687f1 100644 --- a/chart2/qa/extras/chart2import2.cxx +++ b/chart2/qa/extras/chart2import2.cxx @@ -60,6 +60,7 @@ public: void testTdf121281(); void testTdf139658(); void testTdf146066(); + void testTdf150434(); CPPUNIT_TEST_SUITE(Chart2ImportTest2); @@ -101,6 +102,7 @@ public: CPPUNIT_TEST(testTdf121281); CPPUNIT_TEST(testTdf139658); CPPUNIT_TEST(testTdf146066); + CPPUNIT_TEST(testTdf150434); CPPUNIT_TEST_SUITE_END(); }; @@ -930,6 +932,22 @@ void Chart2ImportTest2::testTdf146066() CPPUNIT_ASSERT_EQUAL(OUString("35"), xLabel7->getString()); } +void Chart2ImportTest2::testTdf150434() +{ + load(u"/chart2/qa/extras/data/xlsx/", u"tdf150434.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> xLegend = getShapeByName(xShapes, "CID/D=0:Legend="); + CPPUNIT_ASSERT(xLegend.is()); + awt::Point aPosition = xLegend->getPosition(); + + // This failed, if the legend flowed out of the chart area. + CPPUNIT_ASSERT_GREATEREQUAL(static_cast<sal_Int32>(0), aPosition.Y); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest2); CPPUNIT_PLUGIN_IMPLEMENT(); |