summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga991@gmail.com>2019-10-08 13:29:12 +0200
committerXisco Faulí <xiscofauli@libreoffice.org>2019-10-16 12:30:12 +0200
commit1ae3be79982b1d239fcdae235e3d6e7be185144c (patch)
treecdf2019657b1d646065c438a2c0b832f7ef0bae5 /chart2
parent223b64a79b6fad317c5b1e7cfba080544376ee07 (diff)
tdf#128016 Chart OOXML Import: fix duplicated category labels
Do not create category labels if the category axis is deleted. Regression from commit: fa0a981af41a2606541eec1cb20a379a739691e0 (tdf#114166 DOCX chart import: fix missing complex categories) Cherry picked from commit: e0b0502516a10181bbd1737b93b38b2bba4c98e8 (tdf#128016 Chart OOXML Import: fix duplicated category labels) Change-Id: If357b95956fccbbc6142879f22ebe1b6d715e850 Reviewed-on: https://gerrit.libreoffice.org/80443 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org> Reviewed-on: https://gerrit.libreoffice.org/80821 Reviewed-by: Balazs Varga <balazs.varga991@gmail.com> Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
Diffstat (limited to 'chart2')
-rw-r--r--chart2/qa/extras/chart2import.cxx29
-rw-r--r--chart2/qa/extras/data/docx/testSimpleCategoryAxis.docxbin0 -> 31629 bytes
2 files changed, 29 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx
index e0333c7811e2..da62dfd5e87d 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -129,6 +129,7 @@ public:
void testDataPointInheritedColorDOCX();
void testExternalStrRefsXLSX();
void testSourceNumberFormatComplexCategoriesXLS();
+ void testSimpleCategoryAxis();
void testXaxisValues();
void testTdf123504();
void testTdf122765();
@@ -213,6 +214,7 @@ public:
CPPUNIT_TEST(testDataPointInheritedColorDOCX);
CPPUNIT_TEST(testExternalStrRefsXLSX);
CPPUNIT_TEST(testSourceNumberFormatComplexCategoriesXLS);
+ CPPUNIT_TEST(testSimpleCategoryAxis);
CPPUNIT_TEST(testXaxisValues);
CPPUNIT_TEST(testTdf123504);
CPPUNIT_TEST(testTdf122765);
@@ -1894,6 +1896,33 @@ void Chart2ImportTest::testSourceNumberFormatComplexCategoriesXLS()
CPPUNIT_ASSERT(nNumberFormat != 0);
}
+void Chart2ImportTest::testSimpleCategoryAxis()
+{
+ load("/chart2/qa/extras/data/docx/", "testSimpleCategoryAxis.docx");
+ uno::Reference< chart2::XChartDocument > xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xChartDoc.is());
+
+ // Test the internal data.
+ CPPUNIT_ASSERT(xChartDoc->hasInternalDataProvider());
+
+ Reference<chart2::XInternalDataProvider> xInternalProvider(xChartDoc->getDataProvider(), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xInternalProvider.is());
+
+ Reference<chart::XComplexDescriptionAccess> xDescAccess(xInternalProvider, uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xDescAccess.is());
+
+ // Get the category labels.
+ Sequence<Sequence<OUString> > aCategories = xDescAccess->getComplexRowDescriptions();
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aCategories[0].getLength());
+ CPPUNIT_ASSERT(aCategories[0][0].endsWith("ria 1"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aCategories[1].getLength());
+ CPPUNIT_ASSERT(aCategories[1][0].endsWith("ria 2"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aCategories[2].getLength());
+ CPPUNIT_ASSERT(aCategories[2][0].endsWith("ria 3"));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aCategories[3].getLength());
+ CPPUNIT_ASSERT(aCategories[3][0].endsWith("ria 4"));
+}
+
void Chart2ImportTest::testXaxisValues()
{
load("/chart2/qa/extras/data/docx/", "tdf124083.docx");
diff --git a/chart2/qa/extras/data/docx/testSimpleCategoryAxis.docx b/chart2/qa/extras/data/docx/testSimpleCategoryAxis.docx
new file mode 100644
index 000000000000..de511664a5ba
--- /dev/null
+++ b/chart2/qa/extras/data/docx/testSimpleCategoryAxis.docx
Binary files differ