[Libreoffice-commits] core.git: Branch 'private/kohei/if-or-not-if-jump' - sc/qa
Kohei Yoshida
kohei.yoshida at collabora.com
Wed May 14 19:45:13 PDT 2014
sc/qa/unit/ucalc.hxx | 2 ++
sc/qa/unit/ucalc_formula.cxx | 16 ++++++++++++++++
2 files changed, 18 insertions(+)
New commits:
commit 223dbffa46ed3a1bfc0b47a7cfc7792ec9893b3b
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Wed May 14 22:12:19 2014 -0400
Add unit test for IF function.
Change-Id: I2265458883fb05582c54157714b88345362efa0d
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index 6291fd9..6726d9b 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -153,6 +153,7 @@ public:
void testFuncCELL();
void testFuncDATEDIF();
void testFuncINDIRECT();
+ void testFuncIF();
void testFuncIFERROR();
void testFuncSHEET();
void testFuncNOW();
@@ -414,6 +415,7 @@ public:
CPPUNIT_TEST(testFuncCELL);
CPPUNIT_TEST(testFuncDATEDIF);
CPPUNIT_TEST(testFuncINDIRECT);
+ CPPUNIT_TEST(testFuncIF);
CPPUNIT_TEST(testFuncIFERROR);
CPPUNIT_TEST(testFuncGETPIVOTDATA);
CPPUNIT_TEST(testFuncGETPIVOTDATALeafAccess);
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index 3b374d7..efd1d8c 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -2793,6 +2793,22 @@ void Test::testFuncCOUNTIF()
m_pDoc->DeleteTab(0);
}
+void Test::testFuncIF()
+{
+ sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on.
+
+ m_pDoc->InsertTab(0, "Formula");
+
+ m_pDoc->SetString(ScAddress(0,0,0), "=IF(B1=2;\"two\";\"not two\")");
+ CPPUNIT_ASSERT_EQUAL(OUString("not two"), m_pDoc->GetString(ScAddress(0,0,0)));
+ m_pDoc->SetValue(ScAddress(1,0,0), 2.0);
+ CPPUNIT_ASSERT_EQUAL(OUString("two"), m_pDoc->GetString(ScAddress(0,0,0)));
+ m_pDoc->SetValue(ScAddress(1,0,0), 3.0);
+ CPPUNIT_ASSERT_EQUAL(OUString("not two"), m_pDoc->GetString(ScAddress(0,0,0)));
+
+ m_pDoc->DeleteTab(0);
+}
+
void Test::testFuncIFERROR()
{
// IFERROR/IFNA (fdo#56124)
More information about the Libreoffice-commits
mailing list