summaryrefslogtreecommitdiff
path: root/chart2/qa
diff options
context:
space:
mode:
authorTünde Tóth <toth.tunde@nisz.hu>2020-08-03 09:12:14 +0200
committerLászló Németh <nemeth@numbertext.org>2020-08-07 11:54:24 +0200
commitbcda268cde1f8408c2066ce985acedfce3e3bc2e (patch)
tree4ad77a796883cca715409171c7867eedf8f3af66 /chart2/qa
parente520a4f988bf0ff81e75e37588182af92fed7631 (diff)
tdf#134977 Chart OOXML: fix import of custom data label
Use the data series properties for the default properties of the custom data labels. Change-Id: I651fa030276dfdec13b5801c0188bfd07c498b49 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99987 Tested-by: Jenkins 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/chart2export.cxx26
-rw-r--r--chart2/qa/extras/chart2import.cxx2
-rw-r--r--chart2/qa/extras/data/xlsx/custom_data_label.xlsxbin0 -> 13944 bytes
3 files changed, 26 insertions, 2 deletions
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index 628bdb98b213..f9b2651a922c 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -173,6 +173,7 @@ public:
void testTdf133191();
void testTdf132594();
void testTdf134255();
+ void testTdf134977();
CPPUNIT_TEST_SUITE(Chart2ExportTest);
CPPUNIT_TEST(testErrorBarXLSX);
@@ -309,6 +310,7 @@ public:
CPPUNIT_TEST(testTdf133191);
CPPUNIT_TEST(testTdf132594);
CPPUNIT_TEST(testTdf134255);
+ CPPUNIT_TEST(testTdf134977);
CPPUNIT_TEST_SUITE_END();
@@ -2238,7 +2240,7 @@ void Chart2ExportTest::testCustomDataLabel()
CPPUNIT_ASSERT_EQUAL(OUString("line"), aFields[5]->getString());
aFields[5]->getPropertyValue("CharHeight") >>= nFontSize;
aFields[5]->getPropertyValue("CharColor") >>= nFontColor;
- CPPUNIT_ASSERT_EQUAL(static_cast<float>(13), nFontSize);
+ CPPUNIT_ASSERT_EQUAL(static_cast<float>(11.97), nFontSize);
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int64>(0xbf9000), nFontColor);
CPPUNIT_ASSERT_EQUAL(chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_NEWLINE, aFields[6]->getFieldType());
@@ -2837,6 +2839,28 @@ void Chart2ExportTest::testTdf134255()
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:txPr/a:bodyPr", "wrap", "square");
}
+void Chart2ExportTest::testTdf134977()
+{
+ load("/chart2/qa/extras/data/xlsx/", "custom_data_label.xlsx");
+
+ //import test
+ uno::Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
+ CPPUNIT_ASSERT(xChartDoc.is());
+ Reference< chart2::XDataSeries > xDataSeries = getDataSeriesFromDoc(xChartDoc, 0);
+ CPPUNIT_ASSERT(xDataSeries.is());
+ uno::Reference<beans::XPropertySet> xPropertySet(xDataSeries->getDataPointByIndex(0), uno::UNO_SET_THROW);
+ uno::Sequence<uno::Reference<chart2::XDataPointCustomLabelField>> aFields;
+ float nFontSize;
+ xPropertySet->getPropertyValue("CustomLabelFields") >>= aFields;
+ aFields[0]->getPropertyValue("CharHeight") >>= nFontSize;
+ CPPUNIT_ASSERT_EQUAL(static_cast<float>(9), nFontSize);
+
+ //export test
+ xmlDocUniquePtr pXmlDoc = parseExport("xl/charts/chart","Calc Office Open XML");
+ CPPUNIT_ASSERT(pXmlDoc);
+ assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser/c:dLbls/c:dLbl/c:tx/c:rich/a:p/a:r/a:rPr", "sz", "900");
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx
index 6c982238a5b3..d502d163fc64 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -1862,7 +1862,7 @@ void Chart2ImportTest::testTdf115107()
CPPUNIT_ASSERT_EQUAL(OUString("line"), aFields[5]->getString());
aFields[5]->getPropertyValue("CharHeight") >>= nFontSize;
aFields[5]->getPropertyValue("CharColor") >>= nFontColor;
- CPPUNIT_ASSERT_EQUAL(static_cast<float>(13), nFontSize);
+ CPPUNIT_ASSERT_EQUAL(static_cast<float>(11.97), nFontSize);
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int64>(0xbf9000), nFontColor);
CPPUNIT_ASSERT_EQUAL(chart2::DataPointCustomLabelFieldType::DataPointCustomLabelFieldType_NEWLINE, aFields[6]->getFieldType());
diff --git a/chart2/qa/extras/data/xlsx/custom_data_label.xlsx b/chart2/qa/extras/data/xlsx/custom_data_label.xlsx
new file mode 100644
index 000000000000..cc69aaf0dc66
--- /dev/null
+++ b/chart2/qa/extras/data/xlsx/custom_data_label.xlsx
Binary files differ