summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2012-08-13 15:11:07 +0200
committerEike Rathke <erack@redhat.com>2012-08-13 15:11:15 +0200
commitcc2d0811c25c6a54a952555a1a44bdb9c267c9d0 (patch)
tree9efc4422f1b74023785c1cd73e5087e1d95ffad3 /sc
parent01e1f4eca5f89d685769833076df440a202b6a08 (diff)
test with and without "Empty string as zero" option
Change-Id: I2e4ce4ca3e60b662702f2987c29a79ab1a5b2fdc
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/ucalc.cxx24
1 files changed, 22 insertions, 2 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 1d55a8400403..e8b959b1f36e 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -1052,14 +1052,34 @@ void Test::testFuncParam()
m_pDoc->SetString(0, 1, 0, OUString("=\" \"+3")); // only blank
m_pDoc->SetString(0, 2, 0, OUString("=\" 4 \"+3")); // number in blanks
m_pDoc->SetString(0, 3, 0, OUString("=\" x \"+3")); // non-numeric => #VALUE! error
- m_pDoc->CalcFormulaTree(false, true);
+
+ rtl::OUString aVal;
+ ScCalcConfig aConfig;
+
+ // With "Empty string as zero" option.
+ aConfig.mbEmptyStringAsZero = true;
+ ScInterpreter::SetGlobalConfig(aConfig);
+ m_pDoc->CalcAll();
m_pDoc->GetValue(0, 0, 0, val);
CPPUNIT_ASSERT_MESSAGE("incorrect result", val == 3);
m_pDoc->GetValue(0, 1, 0, val);
CPPUNIT_ASSERT_MESSAGE("incorrect result", val == 3);
m_pDoc->GetValue(0, 2, 0, val);
CPPUNIT_ASSERT_MESSAGE("incorrect result", val == 7);
- rtl::OUString aVal = m_pDoc->GetString( 0, 3, 0);
+ aVal = m_pDoc->GetString( 0, 3, 0);
+ CPPUNIT_ASSERT_MESSAGE("incorrect result", aVal == "#VALUE!");
+
+ // Without "Empty string as zero" option.
+ aConfig.mbEmptyStringAsZero = false;
+ ScInterpreter::SetGlobalConfig(aConfig);
+ m_pDoc->CalcAll();
+ aVal = m_pDoc->GetString( 0, 0, 0);
+ CPPUNIT_ASSERT_MESSAGE("incorrect result", aVal == "#VALUE!");
+ aVal = m_pDoc->GetString( 0, 1, 0);
+ CPPUNIT_ASSERT_MESSAGE("incorrect result", aVal == "#VALUE!");
+ m_pDoc->GetValue(0, 2, 0, val);
+ CPPUNIT_ASSERT_MESSAGE("incorrect result", val == 7);
+ aVal = m_pDoc->GetString( 0, 3, 0);
CPPUNIT_ASSERT_MESSAGE("incorrect result", aVal == "#VALUE!");
m_pDoc->DeleteTab(0);