diff options
author | Balazs Varga <balazs.varga991@gmail.com> | 2019-04-01 13:57:33 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2019-04-02 08:34:08 +0200 |
commit | ad363fd42e439b43c57b6541988234fbaf1ddb30 (patch) | |
tree | 3f868c12acc9a03a4fced9f6d08f8bf16347fa09 /chart2 | |
parent | 7b74a1f41c5dd004e4d3af50b79cfd006ec59ab8 (diff) |
tdf#124463 XLSX export: fix splitDataSeriesByAxis
splitDataSeriesByAxis couldn't split series correctly into two
sequences, because it put all series into the first created sequence,
except the first series of the newer sequence.
Other improvement: first sequence of the return vector always
contains the series attached to the primary axis.
Change-Id: I6e107aa990f9a1a1db49cae2a4f3c9d8a35fb54c
Reviewed-on: https://gerrit.libreoffice.org/70059
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/qa/extras/chart2export.cxx | 18 | ||||
-rwxr-xr-x | chart2/qa/extras/data/ods/secondary_axis.ods | bin | 0 -> 16783 bytes |
2 files changed, 18 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx index f4d8f5e981a9..3d537cf2ab90 100644 --- a/chart2/qa/extras/chart2export.cxx +++ b/chart2/qa/extras/chart2export.cxx @@ -112,6 +112,7 @@ public: void testPlotVisOnlyXLSX(); void testBarChartVaryColorsXLSX(); void testMultipleAxisXLSX(); + void testSecondaryAxisXLSX(); void testAxisTitleRotationXLSX(); void testAxisCrossBetweenXSLX(); void testPieChartDataPointExplosionXLSX(); @@ -204,6 +205,7 @@ public: CPPUNIT_TEST(testPlotVisOnlyXLSX); CPPUNIT_TEST(testBarChartVaryColorsXLSX); CPPUNIT_TEST(testMultipleAxisXLSX); + CPPUNIT_TEST(testSecondaryAxisXLSX); CPPUNIT_TEST(testAxisTitleRotationXLSX); CPPUNIT_TEST(testAxisCrossBetweenXSLX); CPPUNIT_TEST(testPieChartDataPointExplosionXLSX); @@ -1742,6 +1744,22 @@ void Chart2ExportTest::testMultipleAxisXLSX() assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx/c:axPos[@val='r']", 1); } +void Chart2ExportTest::testSecondaryAxisXLSX() +{ + load("/chart2/qa/extras/data/ods/", "secondary_axis.ods"); + xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML"); + CPPUNIT_ASSERT(pXmlDoc); + + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart", 2); + // test there is just those series in the first <lineChart> tag which are attached to the primary axis + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart[1]/c:ser", 2); + assertXPathContent(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart[1]/c:ser[1]/c:tx/c:strRef/c:strCache/c:pt/c:v", "b"); + assertXPathContent(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart[1]/c:ser[2]/c:tx/c:strRef/c:strCache/c:pt/c:v", "c"); + // test there is just those series in the second <lineChart> tag which are attached to the secondary axis + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart[2]/c:ser", 1); + assertXPathContent(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart[2]/c:ser[1]/c:tx/c:strRef/c:strCache/c:pt/c:v", "a"); +} + void Chart2ExportTest::testAxisTitleRotationXLSX() { load("/chart2/qa/extras/data/xlsx/", "axis_title_rotation.xlsx"); diff --git a/chart2/qa/extras/data/ods/secondary_axis.ods b/chart2/qa/extras/data/ods/secondary_axis.ods Binary files differnew file mode 100755 index 000000000000..3f8f269c0f00 --- /dev/null +++ b/chart2/qa/extras/data/ods/secondary_axis.ods |