diff options
-rw-r--r-- | sc/qa/unit/ucalc.cxx | 25 | ||||
-rw-r--r-- | sc/qa/unit/ucalc.hxx | 2 |
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); |