summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorTünde Tóth <tundeth@gmail.com>2019-12-18 16:46:36 +0100
committerLászló Németh <nemeth@numbertext.org>2020-01-10 14:22:57 +0100
commit86be3422cd55fa9e44104f1628648061bb6a3495 (patch)
tree99e0a154d9e88cba9d121e9ace83419357805530 /chart2
parent6e847aa817999ab18acd534f9e6a86685bb268fc (diff)
tdf#129857 Chart OOXML export: fix deleted legend entries
The legend showed deleted legend entries too after export. Change-Id: I872654d6e4d3f385c468b7fde03d39e233692fa1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86161 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.cxx40
-rw-r--r--chart2/qa/extras/chart2import.cxx39
2 files changed, 40 insertions, 39 deletions
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index 62aa0764a69a..96278053d59f 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -150,6 +150,7 @@ public:
void testTdf122031();
void testTdf115012();
void testTdf123206_customLabelText();
+ void testDeletedLegendEntries();
CPPUNIT_TEST_SUITE(Chart2ExportTest);
CPPUNIT_TEST(testErrorBarXLSX);
@@ -263,6 +264,7 @@ public:
CPPUNIT_TEST(testTdf122031);
CPPUNIT_TEST(testTdf115012);
CPPUNIT_TEST(testTdf123206_customLabelText);
+ CPPUNIT_TEST(testDeletedLegendEntries);
CPPUNIT_TEST_SUITE_END();
@@ -2403,6 +2405,44 @@ void Chart2ExportTest::testTdf123206_customLabelText()
assertXPathContent(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:pieChart/c:ser/c:dLbls/c:dLbl[2]/c:tx/c:rich/a:p/a:r/a:t", "kiscica");
}
+void Chart2ExportTest::testDeletedLegendEntries()
+{
+ load("/chart2/qa/extras/data/xlsx/", "deleted_legend_entry.xlsx");
+ {
+ reload("Calc Office Open XML");
+ Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
+ CPPUNIT_ASSERT(xChartDoc.is());
+ Reference<chart2::XDataSeries> xDataSeries(getDataSeriesFromDoc(xChartDoc, 1));
+ CPPUNIT_ASSERT(xDataSeries.is());
+ Reference<beans::XPropertySet> xPropertySet(xDataSeries, uno::UNO_QUERY_THROW);
+ bool bShowLegendEntry = true;
+ CPPUNIT_ASSERT(xPropertySet->getPropertyValue("ShowLegendEntry") >>= bShowLegendEntry);
+ CPPUNIT_ASSERT(!bShowLegendEntry);
+ }
+
+ load("/chart2/qa/extras/data/xlsx/", "deleted_legend_entry2.xlsx");
+ {
+ reload("Calc Office Open XML");
+ Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
+ CPPUNIT_ASSERT(xChartDoc.is());
+ Reference<chart2::XDataSeries> xDataSeries(getDataSeriesFromDoc(xChartDoc, 0));
+ CPPUNIT_ASSERT(xDataSeries.is());
+ Reference<beans::XPropertySet> xPropertySet(xDataSeries, uno::UNO_QUERY_THROW);
+ bool bShowLegendEntry = true;
+ CPPUNIT_ASSERT(xPropertySet->getPropertyValue("ShowLegendEntry") >>= bShowLegendEntry);
+ CPPUNIT_ASSERT(!bShowLegendEntry);
+
+ Reference<chart2::XChartDocument> xChartDoc2 = getChartDocFromSheet(1, mxComponent);
+ CPPUNIT_ASSERT(xChartDoc.is());
+ Reference<chart2::XDataSeries> xDataSeries2(getDataSeriesFromDoc(xChartDoc2, 0));
+ CPPUNIT_ASSERT(xDataSeries2.is());
+ Reference<beans::XPropertySet> xPropertySet2(xDataSeries2, uno::UNO_QUERY_THROW);
+ Sequence<sal_Int32> deletedLegendEntriesSeq;
+ CPPUNIT_ASSERT(xPropertySet2->getPropertyValue("DeletedLegendEntries") >>= deletedLegendEntriesSeq);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), deletedLegendEntriesSeq[0]);
+ }
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx
index 5fcf205df813..9317785520c6 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -148,10 +148,8 @@ public:
void testXaxisValues();
void testTdf123504();
void testTdf122765();
- void testTdf121991();
void testTdf123206CustomLabelField();
void testTdf125444PercentageCustomLabel();
- void testDeletedLegendEntries();
CPPUNIT_TEST_SUITE(Chart2ImportTest);
CPPUNIT_TEST(Fdo60083);
@@ -249,10 +247,8 @@ public:
CPPUNIT_TEST(testXaxisValues);
CPPUNIT_TEST(testTdf123504);
CPPUNIT_TEST(testTdf122765);
- CPPUNIT_TEST(testTdf121991);
CPPUNIT_TEST(testTdf123206CustomLabelField);
CPPUNIT_TEST(testTdf125444PercentageCustomLabel);
- CPPUNIT_TEST(testDeletedLegendEntries);
CPPUNIT_TEST_SUITE_END();
@@ -2289,19 +2285,6 @@ void Chart2ImportTest::testTdf122765()
CPPUNIT_ASSERT_GREATER(sal_Int32(7000), aSlicePosition.X);
}
-void Chart2ImportTest::testTdf121991()
-{
- load("/chart2/qa/extras/data/xlsx/", "deleted_legend_entry.xlsx");
- Reference< chart2::XChartDocument > xChartDoc = getChartDocFromSheet(0, mxComponent);
- CPPUNIT_ASSERT(xChartDoc.is());
- Reference<chart2::XDataSeries> xDataSeries(getDataSeriesFromDoc(xChartDoc, 1));
- CPPUNIT_ASSERT(xDataSeries.is());
- Reference<beans::XPropertySet> xPropertySet(xDataSeries, uno::UNO_QUERY_THROW);
- bool bShowLegendEntry = true;
- CPPUNIT_ASSERT(xPropertySet->getPropertyValue("ShowLegendEntry") >>= bShowLegendEntry);
- CPPUNIT_ASSERT(!bShowLegendEntry);
-}
-
void Chart2ImportTest::testTdf123206CustomLabelField()
{
// File contains the deprecated "custom-label-field" attribute of the
@@ -2339,28 +2322,6 @@ void Chart2ImportTest::testTdf125444PercentageCustomLabel()
CPPUNIT_ASSERT_EQUAL(chart2::DataPointCustomLabelFieldType_PERCENTAGE, aLabelFields[2]->getFieldType());
}
-void Chart2ImportTest::testDeletedLegendEntries()
-{
- load("/chart2/qa/extras/data/xlsx/", "deleted_legend_entry2.xlsx");
- Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
- CPPUNIT_ASSERT(xChartDoc.is());
- Reference<chart2::XDataSeries> xDataSeries(getDataSeriesFromDoc(xChartDoc, 0));
- CPPUNIT_ASSERT(xDataSeries.is());
- Reference<beans::XPropertySet> xPropertySet(xDataSeries, uno::UNO_QUERY_THROW);
- bool bShowLegendEntry = true;
- CPPUNIT_ASSERT(xPropertySet->getPropertyValue("ShowLegendEntry") >>= bShowLegendEntry);
- CPPUNIT_ASSERT(!bShowLegendEntry);
-
- Reference<chart2::XChartDocument> xChartDoc2 = getChartDocFromSheet(1, mxComponent);
- CPPUNIT_ASSERT(xChartDoc.is());
- Reference<chart2::XDataSeries> xDataSeries2(getDataSeriesFromDoc(xChartDoc2, 0));
- CPPUNIT_ASSERT(xDataSeries2.is());
- Reference<beans::XPropertySet> xPropertySet2(xDataSeries2, uno::UNO_QUERY_THROW);
- Sequence<sal_Int32> deletedLegendEntriesSeq;
- CPPUNIT_ASSERT(xPropertySet2->getPropertyValue("DeletedLegendEntries") >>= deletedLegendEntriesSeq);
- CPPUNIT_ASSERT_EQUAL(sal_Int32(1), deletedLegendEntriesSeq[0]);
-}
-
CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ImportTest);
CPPUNIT_PLUGIN_IMPLEMENT();