diff options
author | Jan Holesovsky <kendy@collabora.com> | 2016-03-24 14:06:09 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-03-29 10:15:02 +0000 |
commit | df492cb5f8f76273c8abdd3ce0186e22b58f99a0 (patch) | |
tree | e9a551b3d472eaa6e7ecfaba80ee61661a6630cf /sc | |
parent | 4d3ca45bf2e0a2b06ea897b5084184a57a299102 (diff) |
tdf#98657: Fix a corner case when NaN's were added to ScFullMatrix.
Change-Id: Id3befb82c39f9caacc908d664d42365ce6996054
Reviewed-on: https://gerrit.libreoffice.org/23491
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc')
-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 1d802f9d934a..3dcb39ad2c57 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_core \ @@ -52,7 +53,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 fcf37961a14e..4eeb47d682d5 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 3da4d2ce2b3a..47652d25e473 100644 --- a/sc/source/core/tool/scmatrix.cxx +++ b/sc/source/core/tool/scmatrix.cxx @@ -3026,7 +3026,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) @@ -3052,6 +3059,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(); |