[Libreoffice-commits] core.git: sw/qa
Mike Kaganski
mike.kaganski at collabora.com
Fri Nov 27 14:45:49 PST 2015
sw/qa/core/uwriter.cxx | 11 +++++++++++
1 file changed, 11 insertions(+)
New commits:
commit e963e4788d4d4a493e02d3f6c4b1024f3091c502
Author: Mike Kaganski <mike.kaganski at collabora.com>
Date: Fri Nov 27 14:15:41 2015 +1000
tdf#61228: Unit test
Change-Id: I297e78acca3881cf4c88f679e96d98e985de22bb
Reviewed-on: https://gerrit.libreoffice.org/20218
Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
Tested-by: Julien Nabet <serval2412 at yahoo.fr>
diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx
index 3d6751c..1e08262 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()
More information about the Libreoffice-commits
mailing list