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

Eike Rathke erack at redhat.com
Thu Dec 11 09:55:20 PST 2014


 sc/qa/unit/ucalc.cxx |   22 ++++++++++++++++++++++
 sc/qa/unit/ucalc.hxx |    2 ++
 2 files changed, 24 insertions(+)

New commits:
commit 6c41a1272e43a3e3b785724991837b597dbf00ef
Author: Eike Rathke <erack at redhat.com>
Date:   Thu Dec 11 18:51:04 2014 +0100

    unit test for matrix comparison error propagation, fdo#87237
    
    Change-Id: Id02f169b111945673a16d0c852940c805aa89319

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index b35bc11..029db9d 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -1961,6 +1961,28 @@ void Test::testMatrix()
     }
 }
 
+void Test::testMatrixComparisonWithErrors()
+{
+    m_pDoc->InsertTab(0, "foo");
+
+    // Insert the source values in A1:A2.
+    m_pDoc->SetString(0, 0, 0, "=1/0");
+    m_pDoc->SetValue( 0, 1, 0, 1.0);
+
+    // Create a matrix formula in B3:B4 referencing A1:A2 and doing a greater
+    // than comparison on it's values. Error value must be propagated.
+    ScMarkData aMark;
+    aMark.SelectOneTable(0);
+    m_pDoc->InsertMatrixFormula(1, 2, 1, 3, aMark, "=A1:A2>0");
+
+    CPPUNIT_ASSERT_EQUAL(OUString("#DIV/0!"), m_pDoc->GetString(0,0,0));
+    CPPUNIT_ASSERT_EQUAL(1.0,                 m_pDoc->GetValue( 0,1,0));
+    CPPUNIT_ASSERT_EQUAL(OUString("#DIV/0!"), m_pDoc->GetString(1,2,0));
+    CPPUNIT_ASSERT_EQUAL(OUString("TRUE"),    m_pDoc->GetString(1,3,0));
+
+    m_pDoc->DeleteTab(0);
+}
+
 void Test::testEnterMixedMatrix()
 {
     m_pDoc->InsertTab(0, "foo");
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index 81d8788..b233274 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -215,6 +215,7 @@ public:
     void testInsertNameList();
     void testCSV();
     void testMatrix();
+    void testMatrixComparisonWithErrors();
     void testEnterMixedMatrix();
     void testMatrixEditable();
 
@@ -500,6 +501,7 @@ public:
     CPPUNIT_TEST(testInsertNameList);
     CPPUNIT_TEST(testCSV);
     CPPUNIT_TEST(testMatrix);
+    CPPUNIT_TEST(testMatrixComparisonWithErrors);
     CPPUNIT_TEST(testEnterMixedMatrix);
     CPPUNIT_TEST(testMatrixEditable);
     CPPUNIT_TEST(testPivotTable);


More information about the Libreoffice-commits mailing list