[Libreoffice-commits] .: sc/qa
Eike Rathke
erack at kemper.freedesktop.org
Mon Aug 13 06:11:34 PDT 2012
sc/qa/unit/ucalc.cxx | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
New commits:
commit cc2d0811c25c6a54a952555a1a44bdb9c267c9d0
Author: Eike Rathke <erack at redhat.com>
Date: Mon Aug 13 15:11:07 2012 +0200
test with and without "Empty string as zero" option
Change-Id: I2e4ce4ca3e60b662702f2987c29a79ab1a5b2fdc
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 1d55a84..e8b959b 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);
More information about the Libreoffice-commits
mailing list