diff options
author | Jan Holesovsky <kendy@collabora.com> | 2016-03-24 14:06:09 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2016-03-24 14:42:11 +0100 |
commit | 5d644eff8f593358f9f9d21949faa630d94e5665 (patch) | |
tree | 2e9756613fdf4302fdbddaf9ec95d8151c3e018d | |
parent | 856038857f566269d8b21fc1c86aa4b5eb7ae048 (diff) |
tdf#98657: Fix a corner case when NaN's were added to ScFullMatrix.
Change-Id: Id3befb82c39f9caacc908d664d42365ce6996054
-rw-r--r-- | sc/Module_sc.mk | 2 | ||||
-rw-r--r-- | sc/qa/unit/bugfix-test.cxx | 13 | ||||
-rw-r--r-- | sc/qa/unit/data/ods/tdf98657.ods | bin | 0 -> 13965 bytes | |||
-rw-r--r-- | sc/source/core/tool/scmatrix.cxx | 12 |
4 files changed, 25 insertions, 2 deletions
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk index 861532ec62c7..e0cbf5b3da37 100644 --- a/sc/Module_sc.mk +++ b/sc/Module_sc.mk @@ -42,6 +42,7 @@ $(eval $(call gb_Module_add_check_targets,sc,\ Library_scqahelper \ $(if $(and $(filter $(COM),MSC),$(MERGELIBS)),, \ CppunitTest_sc_ucalc) \ + CppunitTest_sc_bugfix_test \ CppunitTest_sc_filters_test \ CppunitTest_sc_rangelst_test \ CppunitTest_sc_mark_test \ @@ -54,7 +55,6 @@ $(eval $(call gb_Module_add_slowcheck_targets,sc, \ CppunitTest_sc_new_cond_format_api \ CppunitTest_sc_subsequent_filters_test \ CppunitTest_sc_subsequent_export_test \ - CppunitTest_sc_bugfix_test \ CppunitTest_sc_html_export_test \ CppunitTest_sc_opencl_test \ CppunitTest_sc_copypaste \ diff --git a/sc/qa/unit/bugfix-test.cxx b/sc/qa/unit/bugfix-test.cxx index f5459532f33f..02969755d823 100644 --- a/sc/qa/unit/bugfix-test.cxx +++ b/sc/qa/unit/bugfix-test.cxx @@ -86,6 +86,7 @@ public: void testTdf43534(); void testTdf91979(); // void testTdf40110(); + void testTdf98657(); CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST(testTdf64229); @@ -94,6 +95,7 @@ public: CPPUNIT_TEST(testTdf43534); CPPUNIT_TEST(testTdf91979); // CPPUNIT_TEST(testTdf40110); + CPPUNIT_TEST(testTdf98657); CPPUNIT_TEST_SUITE_END(); private: uno::Reference<uno::XInterface> m_xCalcComponent; @@ -230,6 +232,17 @@ void ScFiltersTest::testTdf40110() } */ +void ScFiltersTest::testTdf98657() +{ + ScDocShellRef xDocSh = loadDoc("tdf98657.", FORMAT_ODS); + ScDocument& rDoc = xDocSh->GetDocument(); + + xDocSh->DoHardRecalc(true); + + // this was a NaN before the fix + CPPUNIT_ASSERT_EQUAL(double(285.0), rDoc.GetValue(ScAddress(1, 1, 0))); +} + ScFiltersTest::ScFiltersTest() : ScBootstrapFixture( "/sc/qa/unit/data" ) diff --git a/sc/qa/unit/data/ods/tdf98657.ods b/sc/qa/unit/data/ods/tdf98657.ods Binary files differnew file mode 100644 index 000000000000..c65e1fa6a9b9 --- /dev/null +++ b/sc/qa/unit/data/ods/tdf98657.ods diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx index 90fea67c8a65..7c66db7194fa 100644 --- a/sc/source/core/tool/scmatrix.cxx +++ b/sc/source/core/tool/scmatrix.cxx @@ -3261,7 +3261,14 @@ void fillMatrix( ScMatrix& rMat, size_t nCol, const double* pNums, rtl_uString** continue; } - // Empty cell. No action required. + // it's a NaN, need to flush the non-NaN segment if it exists + + if (pNumHead) + { + // Flush this non-NaN segment to the matrix. + rMat.PutDouble(pNumHead, pNum - pNumHead, nCol, pNumHead - pNums); + pNumHead = nullptr; + } } if (pStrHead) @@ -3287,6 +3294,9 @@ void ScVectorRefMatrix::ensureFullMatrix() size_t nColSize = rArrays.size(); mpFullMatrix.reset(new ScFullMatrix(nColSize, mnRowSize)); + if (mpErrorInterpreter) + mpFullMatrix->SetErrorInterpreter(mpErrorInterpreter); + size_t nRowSize = mnRowSize; size_t nRowEnd = mnRowStart + mnRowSize; size_t nDataRowEnd = mpToken->GetArrayLength(); |