From 1aacd856ab0cf7217e2435c2e8c84d2e00963cb2 Mon Sep 17 00:00:00 2001 From: Balazs Varga Date: Tue, 27 Oct 2020 21:19:36 +0100 Subject: tdf#138307 Chart import: fix lost custom shape text MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do not set empty text to SdrOutliner, if it is already set. Note: Also fix the missing custom shape problem in tdf#72776 and tdf#93641. The wrong position (X:0, Y:0) of these shapes is another problem. Regression from commit 6f62a5c4ee2c1b7654c7fcaa618fb495e0d32f0a (tdf#128985: ODP: Style text directions revert to RTL on save and re-open) Change-Id: I07d8cb12836daf15db347f6bb19c17ed9373189e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104909 Tested-by: László Németh Reviewed-by: László Németh Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106853 Tested-by: Jenkins --- chart2/qa/extras/chart2export.cxx | 20 +++++++++++++++++++- chart2/qa/extras/chart2import.cxx | 2 -- chart2/qa/extras/data/ods/tdf72776.ods | Bin 0 -> 14798 bytes 3 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 chart2/qa/extras/data/ods/tdf72776.ods (limited to 'chart2') diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx index a39b36234862..d92e06cdc01c 100644 --- a/chart2/qa/extras/chart2export.cxx +++ b/chart2/qa/extras/chart2export.cxx @@ -184,6 +184,7 @@ public: void testTdf137917(); void testTdf138204(); void testTdf138181(); + void testCustomShapeText(); CPPUNIT_TEST_SUITE(Chart2ExportTest); CPPUNIT_TEST(testErrorBarXLSX); @@ -330,6 +331,7 @@ public: CPPUNIT_TEST(testTdf137917); CPPUNIT_TEST(testTdf138204); CPPUNIT_TEST(testTdf138181); + CPPUNIT_TEST(testCustomShapeText); CPPUNIT_TEST_SUITE_END(); @@ -3016,7 +3018,7 @@ void Chart2ExportTest::testTdf138181() { load("/chart2/qa/extras/data/xlsx/", "piechart_deleted_legendentry.xlsx"); Reference xChartDoc(getChartDocFromSheet(0, mxComponent), - UNO_QUERY_THROW); + UNO_QUERY_THROW); Reference xDrawPageSupplier(xChartDoc, UNO_QUERY_THROW); Reference xDrawPage(xDrawPageSupplier->getDrawPage(), UNO_SET_THROW); Reference xShapes(xDrawPage->getByIndex(0), UNO_QUERY_THROW); @@ -3038,6 +3040,22 @@ void Chart2ExportTest::testTdf138181() CPPUNIT_ASSERT(xLegendEntry3.is()); } +void Chart2ExportTest::testCustomShapeText() +{ + load("/chart2/qa/extras/data/ods/", "tdf72776.ods"); + reload("calc8"); + Reference xChartDoc(getChartDocFromSheet(0, mxComponent), + UNO_QUERY_THROW); + // test that the text of custom shape exists inside the chart + Reference xDrawPageSupplier(xChartDoc, UNO_QUERY_THROW); + Reference xDrawPage(xDrawPageSupplier->getDrawPage(), UNO_SET_THROW); + Reference xCustomShape(xDrawPage->getByIndex(1), UNO_QUERY_THROW); + CPPUNIT_ASSERT(xCustomShape.is()); + + Reference< text::XText > xRange(xCustomShape, uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT(!xRange->getString().isEmpty()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index 483a862fee1c..67f0d31197d2 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -30,8 +30,6 @@ #include #include #include -#include -#include #include #include diff --git a/chart2/qa/extras/data/ods/tdf72776.ods b/chart2/qa/extras/data/ods/tdf72776.ods new file mode 100644 index 000000000000..4ddad64a5ef5 Binary files /dev/null and b/chart2/qa/extras/data/ods/tdf72776.ods differ -- cgit