diff options
author | Tünde Tóth <toth.tunde@nisz.hu> | 2023-05-17 13:49:29 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2023-05-19 13:09:26 +0200 |
commit | deb2512e5ea16ad8fa9f975569fbc5363cebf8dd (patch) | |
tree | 41e74bc24ea192939166ee971cd29b62c8e1c856 /chart2/qa | |
parent | 384a80fc56e75e3d1ee18ffc303db85490716829 (diff) |
tdf#148142 chart: fix export of modified On/Between tick marks
Reset the MajorOrigin property after import to avoid
of the bad export of the modified document, which reset
the original On tick marks/Between tick marks value.
Follow-up to commit 40d83914d43f60a196dfabddea0b52e2046b333a
"tdf#127792 implement UNO chart attribute MajorOrigin".
Change-Id: I0e3915b7d1b601abd40fbd1ba9d01fc05a8fb7c1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151885
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/chart2export3.cxx | 25 | ||||
-rw-r--r-- | chart2/qa/extras/data/ods/tdf148142.ods | bin | 0 -> 15349 bytes |
2 files changed, 25 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2export3.cxx b/chart2/qa/extras/chart2export3.cxx index d22d5e51e545..845e6c98c6a6 100644 --- a/chart2/qa/extras/chart2export3.cxx +++ b/chart2/qa/extras/chart2export3.cxx @@ -716,6 +716,31 @@ CPPUNIT_TEST_FIXTURE(Chart2ExportTest3, testBarChartSecondaryAxisXLSX) assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx[2]/c:axId", "val", YValueIdOf2Barchart); } +CPPUNIT_TEST_FIXTURE(Chart2ExportTest3, testTdf148142) +{ + // The document contains a line chart with "Between tick marks" X axis position. + loadFromURL(u"ods/tdf148142.ods"); + Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent); + CPPUNIT_ASSERT(xChartDoc.is()); + Reference<chart2::XAxis> xAxis = getAxisFromDoc(xChartDoc, 0, 0, 0); + CPPUNIT_ASSERT(xAxis.is()); + chart2::ScaleData aScaleData = xAxis->getScaleData(); + CPPUNIT_ASSERT(aScaleData.ShiftedCategoryPosition); + + // Set the X axis position to "On tick marks". + aScaleData.ShiftedCategoryPosition = false; + xAxis->setScaleData(aScaleData); + + // Check the X axis position after export. + saveAndReload("calc8"); + Reference<chart2::XChartDocument> xChartDoc2 = getChartDocFromSheet(0, mxComponent); + CPPUNIT_ASSERT(xChartDoc2.is()); + Reference<chart2::XAxis> xAxis2 = getAxisFromDoc(xChartDoc2, 0, 0, 0); + CPPUNIT_ASSERT(xAxis2.is()); + chart2::ScaleData aScaleData2 = xAxis2->getScaleData(); + CPPUNIT_ASSERT(!aScaleData2.ShiftedCategoryPosition); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/qa/extras/data/ods/tdf148142.ods b/chart2/qa/extras/data/ods/tdf148142.ods Binary files differnew file mode 100644 index 000000000000..9b736a06d19a --- /dev/null +++ b/chart2/qa/extras/data/ods/tdf148142.ods |