Kaydet (Commit) 5d644eff authored tarafından Jan Holesovsky's avatar Jan Holesovsky

tdf#98657: Fix a corner case when NaN's were added to ScFullMatrix.

Change-Id: Id3befb82c39f9caacc908d664d42365ce6996054
üst 85603885
...@@ -42,6 +42,7 @@ $(eval $(call gb_Module_add_check_targets,sc,\ ...@@ -42,6 +42,7 @@ $(eval $(call gb_Module_add_check_targets,sc,\
Library_scqahelper \ Library_scqahelper \
$(if $(and $(filter $(COM),MSC),$(MERGELIBS)),, \ $(if $(and $(filter $(COM),MSC),$(MERGELIBS)),, \
CppunitTest_sc_ucalc) \ CppunitTest_sc_ucalc) \
CppunitTest_sc_bugfix_test \
CppunitTest_sc_filters_test \ CppunitTest_sc_filters_test \
CppunitTest_sc_rangelst_test \ CppunitTest_sc_rangelst_test \
CppunitTest_sc_mark_test \ CppunitTest_sc_mark_test \
...@@ -54,7 +55,6 @@ $(eval $(call gb_Module_add_slowcheck_targets,sc, \ ...@@ -54,7 +55,6 @@ $(eval $(call gb_Module_add_slowcheck_targets,sc, \
CppunitTest_sc_new_cond_format_api \ CppunitTest_sc_new_cond_format_api \
CppunitTest_sc_subsequent_filters_test \ CppunitTest_sc_subsequent_filters_test \
CppunitTest_sc_subsequent_export_test \ CppunitTest_sc_subsequent_export_test \
CppunitTest_sc_bugfix_test \
CppunitTest_sc_html_export_test \ CppunitTest_sc_html_export_test \
CppunitTest_sc_opencl_test \ CppunitTest_sc_opencl_test \
CppunitTest_sc_copypaste \ CppunitTest_sc_copypaste \
......
...@@ -86,6 +86,7 @@ public: ...@@ -86,6 +86,7 @@ public:
void testTdf43534(); void testTdf43534();
void testTdf91979(); void testTdf91979();
// void testTdf40110(); // void testTdf40110();
void testTdf98657();
CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST_SUITE(ScFiltersTest);
CPPUNIT_TEST(testTdf64229); CPPUNIT_TEST(testTdf64229);
...@@ -94,6 +95,7 @@ public: ...@@ -94,6 +95,7 @@ public:
CPPUNIT_TEST(testTdf43534); CPPUNIT_TEST(testTdf43534);
CPPUNIT_TEST(testTdf91979); CPPUNIT_TEST(testTdf91979);
// CPPUNIT_TEST(testTdf40110); // CPPUNIT_TEST(testTdf40110);
CPPUNIT_TEST(testTdf98657);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
private: private:
uno::Reference<uno::XInterface> m_xCalcComponent; uno::Reference<uno::XInterface> m_xCalcComponent;
...@@ -230,6 +232,17 @@ void ScFiltersTest::testTdf40110() ...@@ -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() ScFiltersTest::ScFiltersTest()
: ScBootstrapFixture( "/sc/qa/unit/data" ) : ScBootstrapFixture( "/sc/qa/unit/data" )
......
...@@ -3261,7 +3261,14 @@ void fillMatrix( ScMatrix& rMat, size_t nCol, const double* pNums, rtl_uString** ...@@ -3261,7 +3261,14 @@ void fillMatrix( ScMatrix& rMat, size_t nCol, const double* pNums, rtl_uString**
continue; 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) if (pStrHead)
...@@ -3287,6 +3294,9 @@ void ScVectorRefMatrix::ensureFullMatrix() ...@@ -3287,6 +3294,9 @@ void ScVectorRefMatrix::ensureFullMatrix()
size_t nColSize = rArrays.size(); size_t nColSize = rArrays.size();
mpFullMatrix.reset(new ScFullMatrix(nColSize, mnRowSize)); mpFullMatrix.reset(new ScFullMatrix(nColSize, mnRowSize));
if (mpErrorInterpreter)
mpFullMatrix->SetErrorInterpreter(mpErrorInterpreter);
size_t nRowSize = mnRowSize; size_t nRowSize = mnRowSize;
size_t nRowEnd = mnRowStart + mnRowSize; size_t nRowEnd = mnRowStart + mnRowSize;
size_t nDataRowEnd = mpToken->GetArrayLength(); size_t nDataRowEnd = mpToken->GetArrayLength();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment