[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - sc/qa

Eike Rathke erack at redhat.com
Thu Dec 11 10:13:07 PST 2014


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

New commits:
commit a6a0e8059d4996c579d47171a5b833f9b4c22975
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
    (cherry picked from commit 6c41a1272e43a3e3b785724991837b597dbf00ef)

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 248a0e9..49027cf 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 269e84e..72ecaa0 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -213,6 +213,7 @@ public:
     void testInsertNameList();
     void testCSV();
     void testMatrix();
+    void testMatrixComparisonWithErrors();
     void testEnterMixedMatrix();
     void testMatrixEditable();
 
@@ -494,6 +495,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