diff options
author | Balazs Varga <balazs.varga991@gmail.com> | 2019-11-14 15:02:35 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2019-11-22 08:03:55 +0100 |
commit | c0cd2d4e0fa70d6eaf3cd3929bc0ad4786e9f4ed (patch) | |
tree | cd0372ee71feadf2f0438e3f2bd502b994e890db /chart2/qa/extras | |
parent | 3cccdabf19a99fd3f657985c1822436d7679df2b (diff) |
tdf#123774 OOXML chart export: keep digits of percentages of data points
by exporting PercentageNumberFormat, checking the "Label" format
directly and taking the respective number format based on that.
Note: also fix the "LinkNumberFormatToSource" property. If we create a
pie chart with data labels and set the "Show value as number" or
"Show value as percentage" and check on/off "Source format", this move
is not set the property in the XPropertySet.
Because of this, it fixes also the export of correct value of
"link-data-style-to-source" property into ODS files.
But this patch doesn't fix the export of old ODS files to OOXML,
because they contain wrong (always true) "link-data-style-to-source"
value.
Change-Id: I4098a245dec5bf35cde20c9ccb79aca726230118
Reviewed-on: https://gerrit.libreoffice.org/82703
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: László Németh <nemeth@numbertext.org>
(cherry picked from commit a59eb39c6ec01ae2a9d8ddbb61a9c27f527c9caa)
Reviewed-on: https://gerrit.libreoffice.org/83410
Diffstat (limited to 'chart2/qa/extras')
-rw-r--r-- | chart2/qa/extras/chart2export.cxx | 14 | ||||
-rw-r--r-- | chart2/qa/extras/data/ods/tdf123774.ods | bin | 0 -> 16140 bytes |
2 files changed, 14 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx index 694e814250bd..8d42c8ac93ac 100644 --- a/chart2/qa/extras/chart2export.cxx +++ b/chart2/qa/extras/chart2export.cxx @@ -99,6 +99,7 @@ public: void testMarkerColorXLSX(); void testRoundedCornersXLSX(); void testAxisNumberFormatXLSX(); + void testDataPointLabelNumberFormatXLSX(); void testDataLabelDefaultValuesXLSX(); void testTitleOverlayXLSX(); void testInvertIfNegativeXLSX(); @@ -210,6 +211,7 @@ public: CPPUNIT_TEST(testMarkerColorXLSX); CPPUNIT_TEST(testRoundedCornersXLSX); CPPUNIT_TEST(testAxisNumberFormatXLSX); + CPPUNIT_TEST(testDataPointLabelNumberFormatXLSX); CPPUNIT_TEST(testDataLabelDefaultValuesXLSX); CPPUNIT_TEST(testTitleOverlayXLSX); CPPUNIT_TEST(testInvertIfNegativeXLSX); @@ -1584,6 +1586,18 @@ void Chart2ExportTest::testAxisNumberFormatXLSX() assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx[2]/c:numFmt", "sourceLinked", "1"); } +void Chart2ExportTest::testDataPointLabelNumberFormatXLSX() +{ + load("/chart2/qa/extras/data/ods/", "tdf123774.ods"); + xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + CPPUNIT_ASSERT(pXmlDoc); + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:numFmt", "formatCode", "[$-40E]0.00%"); + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:numFmt", "sourceLinked", "0"); + + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:dLbl[1]/c:numFmt", "formatCode", "[$-40E]0.00%"); + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:dLbl[1]/c:numFmt", "sourceLinked", "0"); +} + void Chart2ExportTest::testDataLabelDefaultValuesXLSX() { load("/chart2/qa/extras/data/xlsx/", "data_label.xlsx"); diff --git a/chart2/qa/extras/data/ods/tdf123774.ods b/chart2/qa/extras/data/ods/tdf123774.ods Binary files differnew file mode 100644 index 000000000000..5c422b58c357 --- /dev/null +++ b/chart2/qa/extras/data/ods/tdf123774.ods |