summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);