summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2015-11-27 14:15:41 +1000
committerMike Kaganski <mikekaganski@hotmail.com>2015-11-27 22:45:15 +0000
commite963e4788d4d4a493e02d3f6c4b1024f3091c502 (patch)
treee8484b5746268ef48b47acc1ff7d719535494464
parentf1c6db90b519d35e7e6b62adbbd07ad5bd4cabfd (diff)
tdf#61228: Unit test
Change-Id: I297e78acca3881cf4c88f679e96d98e985de22bb Reviewed-on: https://gerrit.libreoffice.org/20218 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
-rw-r--r--sw/qa/core/uwriter.cxx11
1 files changed, 11 insertions, 0 deletions
diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx
index 3d6751c67a56..1e08262cded2 100644
--- a/sw/qa/core/uwriter.cxx
+++ b/sw/qa/core/uwriter.cxx
@@ -63,6 +63,7 @@
#include "ring.hxx"
#include "calbck.hxx"
#include "pagedesc.hxx"
+#include "calc.hxx"
typedef tools::SvRef<SwDocShell> SwDocShellRef;
@@ -1213,6 +1214,16 @@ void SwDocTest::testFormulas()
aFormula.PtrToBoxNm(pTable);
CPPUNIT_ASSERT_EQUAL(OUString("<?>+<Table1.?>"), aFormula.GetFormula());
+
+ // tdf#61228: Evaluating non-defined function should return an error
+ SwCalc aCalc(*m_pDoc);
+ SwSbxValue val = aCalc.Calculate("foobar()");
+ CPPUNIT_ASSERT(aCalc.IsCalcError() && val.IsVoidValue() && val.IsDouble());
+ CPPUNIT_ASSERT_EQUAL(DBL_MAX, val.GetDouble());
+ // Evaluating non-defined variable should return 0 without an error
+ val = aCalc.Calculate("foobar");
+ CPPUNIT_ASSERT(!aCalc.IsCalcError() && val.IsVoidValue() && val.IsLong());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), val.GetLong());
}
void SwDocTest::testMarkMove()