summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga991@gmail.com>2019-10-08 13:29:12 +0200
committerLászló Németh <nemeth@numbertext.org>2019-10-12 09:23:28 +0200
commite0b0502516a10181bbd1737b93b38b2bba4c98e8 (patch)
treeb0571d34dcd0e87d020795c2cd4f016d0ec3b2e7 /chart2
parent2ec58f883bd4d7fe0ac1b716d1abc05cb2b16b4e (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) Change-Id: If357b95956fccbbc6142879f22ebe1b6d715e850 Reviewed-on: https://gerrit.libreoffice.org/80443 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.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 34477f69d6ac..d0fcb34faafd 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -136,6 +136,7 @@ public:
void testDataPointInheritedColorDOCX();
void testExternalStrRefsXLSX();
void testSourceNumberFormatComplexCategoriesXLS();
+ void testSimpleCategoryAxis();
void testMultilevelCategoryAxis();
void testXaxisValues();
void testTdf123504();
@@ -227,6 +228,7 @@ public:
CPPUNIT_TEST(testDataPointInheritedColorDOCX);
CPPUNIT_TEST(testExternalStrRefsXLSX);
CPPUNIT_TEST(testSourceNumberFormatComplexCategoriesXLS);
+ CPPUNIT_TEST(testSimpleCategoryAxis);
CPPUNIT_TEST(testMultilevelCategoryAxis);
CPPUNIT_TEST(testXaxisValues);
CPPUNIT_TEST(testTdf123504);
@@ -2062,6 +2064,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::testMultilevelCategoryAxis()
{
load("/chart2/qa/extras/data/docx/", "testMultilevelCategoryAxis.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