summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2012-07-18 17:24:08 +0200
committerEike Rathke <erack@redhat.com>2012-07-18 17:25:47 +0200
commit123fa79cb24dced9adea7ef4d007a4516c1555d4 (patch)
tree2806d15965991d8c8a8f9a48b9db1ee99c5d3ba7
parenta439cb5aba49d01df20f67a2c84b68542e4d3d5a (diff)
unit test fdo#50345 accept empty string as scalar numeric 0 argument
Change-Id: Ie04cb8d32e9328212d41fedb63cf81b235aa69de
-rw-r--r--sc/qa/unit/ucalc.cxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index b816f5cf6e8a..7ea887cdb096 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -1042,6 +1042,21 @@ void Test::testFuncParam()
m_pDoc->GetValue(0, 0, 0, val);
CPPUNIT_ASSERT_MESSAGE("incorrect result", val == 0.25);
+ // Conversion of string to numeric argument.
+ m_pDoc->SetString(0, 0, 0, OUString("=\"\"+3")); // empty string
+ 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);
+ 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);
+ CPPUNIT_ASSERT_MESSAGE("incorrect result", aVal == "#VALUE!");
+
m_pDoc->DeleteTab(0);
}