summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2014-12-11 18:51:04 +0100
committerEike Rathke <erack@redhat.com>2014-12-11 19:08:50 +0100
commita6a0e8059d4996c579d47171a5b833f9b4c22975 (patch)
tree5c3ff1824feead46ae27fe6d9ded9ae0183b4b6c
parente0de89027068c7e2bb60207df0c50efdbfcc70f3 (diff)
unit test for matrix comparison error propagation, fdo#87237
Change-Id: Id02f169b111945673a16d0c852940c805aa89319 (cherry picked from commit 6c41a1272e43a3e3b785724991837b597dbf00ef)
-rw-r--r--sc/qa/unit/ucalc.cxx22
-rw-r--r--sc/qa/unit/ucalc.hxx2
2 files changed, 24 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 248a0e9bff36..49027cf34383 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 269e84e5491a..72ecaa067d44 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);