summaryrefslogtreecommitdiffstats
path: root/chart2/qa
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga991@gmail.com>2019-08-27 10:55:30 +0200
committerLászló Németh <nemeth@numbertext.org>2019-08-30 13:18:14 +0200
commit4afd65776457be3391f3e1340da614dffc8f227b (patch)
tree8b639f65fee08e6937958176bf8cfcec33d1ef03 /chart2/qa
parentsolenv: teach create-tags to handle CPPUNIT_TEST_FIXTURE() (diff)
downloadcore-4afd65776457be3391f3e1340da614dffc8f227b.tar.gz
core-4afd65776457be3391f3e1340da614dffc8f227b.zip
tdf#124083 OOXML import: fix broken charts with missing value X
Importing NaN value X, ie. where only "ptCount" was defined without explicit data, messed up the charts replacing all X values with sequence 1, 2, 3..., showing data points in wrong X positions, also showing the invalid "NaN" data points. Now internal data table contains the original X values, including NaNs, fixing broken charts. Change-Id: Ic3c69e15095d9b29643f5daef8f58c58b4a442db Reviewed-on: https://gerrit.libreoffice.org/78177 Reviewed-by: László Németh <nemeth@numbertext.org> Tested-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'chart2/qa')
-rw-r--r--chart2/qa/extras/chart2import.cxx18
-rw-r--r--chart2/qa/extras/data/docx/tdf124083.docxbin0 -> 25793 bytes
2 files changed, 18 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx
index 116a0a93519f..53f4a2d30e19 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -134,6 +134,7 @@ public:
void testExternalStrRefsXLSX();
void testSourceNumberFormatComplexCategoriesXLS();
void testMultilevelCategoryAxis();
+ void testXaxisValues();
void testTdf123504();
void testTdf122765();
@@ -222,6 +223,7 @@ public:
CPPUNIT_TEST(testExternalStrRefsXLSX);
CPPUNIT_TEST(testSourceNumberFormatComplexCategoriesXLS);
CPPUNIT_TEST(testMultilevelCategoryAxis);
+ CPPUNIT_TEST(testXaxisValues);
CPPUNIT_TEST(testTdf123504);
CPPUNIT_TEST(testTdf122765);
@@ -2023,6 +2025,22 @@ void Chart2ImportTest::testMultilevelCategoryAxis()
CPPUNIT_ASSERT_EQUAL(OUString("Categoria 4"), aCategories[3][1]);
}
+void Chart2ImportTest::testXaxisValues()
+{
+ load("/chart2/qa/extras/data/docx/", "tdf124083.docx");
+ uno::Reference< chart2::XChartDocument > xChartDoc(getChartDocFromWriter(0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xChartDoc.is());
+
+ const uno::Reference< chart2::data::XDataSequence > xDataSeq = getDataSequenceFromDocByRole(xChartDoc, "values-x");
+ Sequence<uno::Any> xSequence = xDataSeq->getData();
+ // test X values
+ CPPUNIT_ASSERT_EQUAL(uno::Any(0.04), xSequence[0]);
+ CPPUNIT_ASSERT(rtl::math::isNan(*static_cast<const double*>(xSequence[1].getValue())));
+ CPPUNIT_ASSERT_EQUAL(uno::Any(0.16), xSequence[2]);
+ CPPUNIT_ASSERT_EQUAL(uno::Any(0.11), xSequence[3]);
+ CPPUNIT_ASSERT(rtl::math::isNan(*static_cast<const double*>(xSequence[4].getValue())));
+}
+
void Chart2ImportTest::testTdf123504()
{
load("/chart2/qa/extras/data/ods/", "pie_chart_100_and_0.ods");
diff --git a/chart2/qa/extras/data/docx/tdf124083.docx b/chart2/qa/extras/data/docx/tdf124083.docx
new file mode 100644
index 000000000000..b8030ca9a807
--- /dev/null
+++ b/chart2/qa/extras/data/docx/tdf124083.docx
Binary files differ