diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index b508f3e123dd..be36047efadb 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -25,7 +25,6 @@ #include - class Chart2ImportTest : public ChartTest { public: @@ -413,13 +412,13 @@ void Chart2ImportTest::testPPTXSparseChartSeries() std::vector > aValues = getDataSeriesYValuesFromChartType(xCT); CPPUNIT_ASSERT_EQUAL(size_t(2), aValues.size()); - CPPUNIT_ASSERT_EQUAL(0.0, aValues[0][0]); + CPPUNIT_ASSERT( rtl::math::isNan( aValues[0][0] ) ); CPPUNIT_ASSERT_EQUAL(2.5, aValues[0][1]); CPPUNIT_ASSERT_EQUAL(3.5, aValues[0][2]); - CPPUNIT_ASSERT_EQUAL(0.0, aValues[0][3]); + CPPUNIT_ASSERT( rtl::math::isNan( aValues[0][3] ) ); CPPUNIT_ASSERT_EQUAL(-2.4, aValues[1][0]); - CPPUNIT_ASSERT_EQUAL(0.0, aValues[1][1]); - CPPUNIT_ASSERT_EQUAL(0.0, aValues[1][2]); + CPPUNIT_ASSERT( rtl::math::isNan( aValues[1][1] ) ); + CPPUNIT_ASSERT( rtl::math::isNan( aValues[1][2] ) ); CPPUNIT_ASSERT_EQUAL(-2.8, aValues[1][3]); } @@ -1169,17 +1168,17 @@ void Chart2ImportTest::testInternalDataProvider() { // Parse empty first and last xDataSeq = rxDataProvider->createDataSequenceByValueArray("values-y", "{\"\";42;42;\"\"}"); xSequence = xDataSeq->getData(); - CPPUNIT_ASSERT_EQUAL(uno::Any(sal_Int32(0)), xSequence[0]); + CPPUNIT_ASSERT( rtl::math::isNan( *static_cast(xSequence[0].getValue()))); CPPUNIT_ASSERT_EQUAL(uno::Any(sal_Int32(42)), xSequence[1]); CPPUNIT_ASSERT_EQUAL(uno::Any(sal_Int32(42)), xSequence[2]); - CPPUNIT_ASSERT_EQUAL(uno::Any(sal_Int32(0)), xSequence[3]); + CPPUNIT_ASSERT( rtl::math::isNan( *static_cast(xSequence[3].getValue()))); // Parse empty middle xDataSeq = rxDataProvider->createDataSequenceByValueArray("values-y", "{42;\"\";\"\";42}"); xSequence = xDataSeq->getData(); CPPUNIT_ASSERT_EQUAL(uno::Any(sal_Int32(42)), xSequence[0]); - CPPUNIT_ASSERT_EQUAL(uno::Any(sal_Int32(0)), xSequence[1]); - CPPUNIT_ASSERT_EQUAL(uno::Any(sal_Int32(0)), xSequence[2]); + CPPUNIT_ASSERT( rtl::math::isNan( *static_cast(xSequence[1].getValue())) ); + CPPUNIT_ASSERT( rtl::math::isNan( *static_cast(xSequence[2].getValue())) ); CPPUNIT_ASSERT_EQUAL(uno::Any(sal_Int32(42)), xSequence[3]); // Parse mixed types, numeric only role diff --git a/chart2/source/tools/InternalDataProvider.cxx b/chart2/source/tools/InternalDataProvider.cxx index ef6facdee058..9f5f3187fd36 100644 --- a/chart2/source/tools/InternalDataProvider.cxx +++ b/chart2/source/tools/InternalDataProvider.cxx @@ -573,7 +573,12 @@ InternalDataProvider::createDataSequenceFromArray( const OUString& rArrayStr, co std::vector aValues; aValues.reserve(aRawElems.size()); for (OUString & aRawElem : aRawElems) - aValues.push_back(aRawElem.toDouble()); + { + if (aRawElem.isEmpty()) + aValues.push_back(NAN); + else + aValues.push_back(aRawElem.toDouble()); + } sal_Int32 n = m_aInternalData.appendColumn(); m_aInternalData.setColumnValues(n, aValues);