[Libreoffice-commits] core.git: 2 commits - sc/qa sc/source

Eike Rathke erack at redhat.com
Tue Jan 27 06:17:37 PST 2015


 sc/qa/unit/ucalc_formula.cxx     |   14 ++++++++++++++
 sc/source/core/tool/interpr5.cxx |    2 +-
 sc/source/core/tool/scmatrix.cxx |    4 ++--
 3 files changed, 17 insertions(+), 3 deletions(-)

New commits:
commit e5eb67781e352b5c13494f1ea1e39ea3a4dc0629
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Jan 27 15:13:59 2015 +0100

    add unit test for tdf#88786
    
    Change-Id: I0cb533399a1e3ce83875f2966cb59354e92f05b5

diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index ab23102..ca731a2 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -4867,6 +4867,20 @@ void Test::testMatrixOp()
     nVal = m_pDoc->GetValue(2, 1, 0);
     CPPUNIT_ASSERT_EQUAL(4.0, nVal);
 
+    m_pDoc->SetString(4, 0, 0, "=SUMPRODUCT({1;2;4}+8)");
+    m_pDoc->SetString(4, 1, 0, "=SUMPRODUCT(8+{1;2;4})");
+    m_pDoc->SetString(4, 2, 0, "=SUMPRODUCT({1;2;4}-8)");
+    m_pDoc->SetString(4, 3, 0, "=SUMPRODUCT(8-{1;2;4})");
+    m_pDoc->SetString(4, 4, 0, "=SUMPRODUCT({1;2;4}+{8;16;32})");
+    m_pDoc->SetString(4, 5, 0, "=SUMPRODUCT({8;16;32}+{1;2;4})");
+    m_pDoc->SetString(4, 6, 0, "=SUMPRODUCT({1;2;4}-{8;16;32})");
+    m_pDoc->SetString(4, 7, 0, "=SUMPRODUCT({8;16;32}-{1;2;4})");
+    double fResult[8] = { 31.0, 31.0, -17.0, 17.0, 63.0, 63.0, -49.0, 49.0 };
+    for (size_t i = 0; i < SAL_N_ELEMENTS(fResult); ++i)
+    {
+        CPPUNIT_ASSERT_EQUAL( fResult[i], m_pDoc->GetValue(4, i, 0));
+    }
+
     m_pDoc->DeleteTab(0);
 }
 
commit b435ca9e6f826704314f8a437c352aa799767bd4
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Jan 27 14:50:36 2015 +0100

    Resolves: tdf#88786 correct matrix sub operation
    
    Change-Id: Ib5ce2ffe17cc34e0b3f04ebc06ea392707b7b9e6

diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index fe87c04..b6d616e 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -1297,7 +1297,7 @@ void ScInterpreter::CalculateAddSub(bool _bSub)
             }
             else
             {
-                pMat->SubAddOp(true, fVal, aString, *pResMat);
+                pMat->SubAddOp(false, -fVal, aString, *pResMat);
             }
             PushMatrix(pResMat);
         }
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index bf2f163..4402002 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -2553,12 +2553,12 @@ public:
 
     double operator()(double nVal) const
     {
-        return nVal - mnVal;
+        return mnVal - nVal;
     }
 
     double operator()(bool bVal) const
     {
-        return (double)bVal - mnVal;
+        return mnVal - (double)bVal;
     }
 
     svl::SharedString operator()(const svl::SharedString&) const


More information about the Libreoffice-commits mailing list