[Libreoffice-commits] core.git: Branch 'feature/fixes19' - sc/Module_sc.mk sc/qa sc/source

Jan Holesovsky kendy at collabora.com
Thu Mar 24 16:53:22 UTC 2016


 sc/Module_sc.mk                  |    2 +-
 sc/qa/unit/bugfix-test.cxx       |   13 +++++++++++++
 sc/qa/unit/data/ods/tdf98657.ods |binary
 sc/source/core/tool/scmatrix.cxx |   12 +++++++++++-
 4 files changed, 25 insertions(+), 2 deletions(-)

New commits:
commit b7af0c246079e568b401d865db2607e5e8b16428
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Thu Mar 24 14:06:09 2016 +0100

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

diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index 1d802f9..3dcb39a 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 fcf3796..4eeb47d 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
new file mode 100644
index 0000000..c65e1fa
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf98657.ods differ
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 3da4d2c..47652d2 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();


More information about the Libreoffice-commits mailing list