summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamas Bunth <tamas.bunth@collabora.co.uk>2020-01-02 12:55:16 +0100
committerAndras Timar <andras.timar@collabora.com>2020-01-07 16:44:22 +0100
commita08d63312cea0464f465c1a3fde0e9abd142e696 (patch)
tree845135913fe728f7d8d2a9634922c8e8485a1020
parent1bc8726a3ae59c10c87abc993aa053da621c4436 (diff)
tdf#123206 Add test: import custom-label-field
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 <btomi96@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86114 Reviewed-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r--chart2/qa/extras/chart2import.cxx21
-rw-r--r--chart2/qa/extras/data/odp/tdf123206.odpbin0 -> 19589 bytes
-rw-r--r--xmloff/source/chart/SchXMLPlotAreaContext.cxx2
3 files changed, 22 insertions, 1 deletions
diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx
index c11c5cdf28ad..0a0cd3ed8957 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -134,6 +134,7 @@ public:
void testTdf123504();
void testTdf122765();
void testTdf125444PercentageCustomLabel();
+ void testTdf123206CustomLabelField();
CPPUNIT_TEST_SUITE(Chart2ImportTest);
CPPUNIT_TEST(Fdo60083);
@@ -220,7 +221,7 @@ public:
CPPUNIT_TEST(testTdf123504);
CPPUNIT_TEST(testTdf122765);
CPPUNIT_TEST(testTdf125444PercentageCustomLabel);
-
+ CPPUNIT_TEST(testTdf123206CustomLabelField);
CPPUNIT_TEST_SUITE_END();
private:
@@ -2013,6 +2014,24 @@ void Chart2ImportTest::testTdf125444PercentageCustomLabel()
}
+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<chart2::XDataSeries> xDataSeries = getDataSeriesFromDoc(xChartDoc, 0);
+ CPPUNIT_ASSERT(xDataSeries.is());
+ Reference<beans::XPropertySet> xDp = xDataSeries->getDataPointByIndex(1);
+ Sequence<Reference<chart2::XDataPointCustomLabelField>> aLabelFields;
+ CPPUNIT_ASSERT(xDp->getPropertyValue("CustomLabelFields") >>= aLabelFields);
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(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
--- /dev/null
+++ b/chart2/qa/extras/data/odp/tdf123206.odp
Binary files differ
diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
index 385b59d48bd2..fe6a196005f7 100644
--- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx
+++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
@@ -711,6 +711,8 @@ void SchXMLDataPointContext::StartElement( const uno::Reference< xml::sax::XAttr
}
else if( nPrefix == XML_NAMESPACE_LO_EXT)
{
+ // Deprecated. New documents use the chart:data-label element
+ // instead in order to store custom label text.
if( IsXMLToken( aLocalName, XML_CUSTOM_LABEL_FIELD) && !mbHasLabelParagraph)
{
sCustomLabelField = xAttrList->getValueByIndex( i );