From 2c7ef73e99dcecb6c86bcbf19135b89ad9e7db3a Mon Sep 17 00:00:00 2001 From: Tamas Bunth Date: Thu, 2 Jan 2020 12:55:16 +0100 Subject: tdf#123206 Add test: import custom-label-field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add test for deprecated custom-label-field attribute of the data-point element. Change-Id: I9a7619898fa72900323e5b41728d2146c14203e3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86103 Tested-by: Jenkins Reviewed-by: Tamás Bunth --- chart2/qa/extras/chart2import.cxx | 22 ++++++++++++++++++++-- chart2/qa/extras/data/odp/tdf123206.odp | Bin 0 -> 19589 bytes 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 chart2/qa/extras/data/odp/tdf123206.odp (limited to 'chart2/qa') diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index be010f3b309f..3c505c8c201d 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -149,7 +149,7 @@ public: void testTdf123504(); void testTdf122765(); void testTdf121991(); - + void testTdf123206CustomLabelField(); CPPUNIT_TEST_SUITE(Chart2ImportTest); CPPUNIT_TEST(Fdo60083); CPPUNIT_TEST(testSteppedLines); @@ -247,7 +247,7 @@ public: CPPUNIT_TEST(testTdf123504); CPPUNIT_TEST(testTdf122765); CPPUNIT_TEST(testTdf121991); - + CPPUNIT_TEST(testTdf123206CustomLabelField); CPPUNIT_TEST_SUITE_END(); private: @@ -2296,6 +2296,24 @@ void Chart2ImportTest::testTdf121991() CPPUNIT_ASSERT(!bShowLegendEntry); } +void Chart2ImportTest::testTdf123206CustomLabelField() +{ + // File contains the deprecated "custom-label-field" attribute of the + // "data-point" element. It should be interpreted and stored as a data point + // property. + uno::Reference< chart2::XChartDocument > xChartDoc(getChartDocFromImpress("/chart2/qa/extras/data/odp/", "tdf123206.odp"), uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is()); + CPPUNIT_ASSERT(xChartDoc.is()); + Reference xDataSeries = getDataSeriesFromDoc(xChartDoc, 0); + CPPUNIT_ASSERT(xDataSeries.is()); + Reference xDp = xDataSeries->getDataPointByIndex(1); + Sequence> aLabelFields; + CPPUNIT_ASSERT(xDp->getPropertyValue("CustomLabelFields") >>= aLabelFields); + CPPUNIT_ASSERT_EQUAL(static_cast(1), aLabelFields.getLength()); + CPPUNIT_ASSERT_EQUAL(OUString("Kiskacsa"), aLabelFields[0]->getString()); + +} + CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/chart2/qa/extras/data/odp/tdf123206.odp b/chart2/qa/extras/data/odp/tdf123206.odp new file mode 100644 index 000000000000..1975756bce18 Binary files /dev/null and b/chart2/qa/extras/data/odp/tdf123206.odp differ -- cgit