summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2015-11-20 22:49:36 +0100
committerEike Rathke <erack@redhat.com>2015-11-21 00:03:26 +0100
commit01de2fc790b50c04f13907026f1a7782009fea61 (patch)
tree11df585c72fa090d32bde6f4cf5820a32953b072 /sc
parentfd8c802533e962b8cd13f8aecc6a2a8aa487bba1 (diff)
unit test testMatrixConditionalBooleanResult
Change-Id: I6531a79b510da18b6799edd32d40cfce7dd2975a
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/ucalc.cxx25
-rw-r--r--sc/qa/unit/ucalc.hxx2
2 files changed, 27 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 66890c97e898..3fc85a679f38 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -2033,6 +2033,31 @@ void Test::testMatrixComparisonWithErrors()
m_pDoc->DeleteTab(0);
}
+void Test::testMatrixConditionalBooleanResult()
+{
+ m_pDoc->InsertTab(0, "foo");
+
+ // Create matrix formulas in A1:B1,A2:B2,A3:B3,A4:B4 producing mixed
+ // boolean and numeric results in an unformatted area.
+ ScMarkData aMark;
+ aMark.SelectOneTable(0);
+ m_pDoc->InsertMatrixFormula( 0,0, 1,0, aMark, "=IF({1,0};TRUE();42)"); // {TRUE,42}
+ m_pDoc->InsertMatrixFormula( 0,1, 1,1, aMark, "=IF({0,1};TRUE();42)"); // {42,1} aim for {42,TRUE}
+ m_pDoc->InsertMatrixFormula( 0,2, 1,2, aMark, "=IF({1,0};42;FALSE())"); // {42,0} aim for {42,FALSE}
+ m_pDoc->InsertMatrixFormula( 0,3, 1,3, aMark, "=IF({0,1};42;FALSE())"); // {FALSE,42}
+
+ CPPUNIT_ASSERT_EQUAL( OUString("TRUE"), m_pDoc->GetString(0,0,0));
+ CPPUNIT_ASSERT_EQUAL( OUString("42"), m_pDoc->GetString(1,0,0));
+ CPPUNIT_ASSERT_EQUAL( OUString("42"), m_pDoc->GetString(0,1,0));
+ //CPPUNIT_ASSERT_EQUAL( OUString("TRUE"), m_pDoc->GetString(1,1,0)); // not yet
+ CPPUNIT_ASSERT_EQUAL( OUString("42"), m_pDoc->GetString(0,2,0));
+ //CPPUNIT_ASSERT_EQUAL( OUString("FALSE"), m_pDoc->GetString(1,2,0)); // not yet
+ CPPUNIT_ASSERT_EQUAL( OUString("FALSE"), m_pDoc->GetString(0,3,0));
+ CPPUNIT_ASSERT_EQUAL( OUString("42"), 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 9ea7f4ba9cdd..fc90f81d4b24 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -236,6 +236,7 @@ public:
void testCSV();
void testMatrix();
void testMatrixComparisonWithErrors();
+ void testMatrixConditionalBooleanResult();
void testEnterMixedMatrix();
void testMatrixEditable();
@@ -559,6 +560,7 @@ public:
CPPUNIT_TEST(testCSV);
CPPUNIT_TEST(testMatrix);
CPPUNIT_TEST(testMatrixComparisonWithErrors);
+ CPPUNIT_TEST(testMatrixConditionalBooleanResult);
CPPUNIT_TEST(testEnterMixedMatrix);
CPPUNIT_TEST(testMatrixEditable);
CPPUNIT_TEST(testPivotTable);