summaryrefslogtreecommitdiffstats
path: root/kspread/tests/generate-openformula-tests
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 01:29:50 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 01:29:50 +0000
commit8362bf63dea22bbf6736609b0f49c152f975eb63 (patch)
tree0eea3928e39e50fae91d4e68b21b1e6cbae25604 /kspread/tests/generate-openformula-tests
downloadkoffice-8362bf63dea22bbf6736609b0f49c152f975eb63.tar.gz
koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.zip
Added old abandoned KDE3 version of koffice
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1077364 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kspread/tests/generate-openformula-tests')
-rwxr-xr-xkspread/tests/generate-openformula-tests44
1 files changed, 44 insertions, 0 deletions
diff --git a/kspread/tests/generate-openformula-tests b/kspread/tests/generate-openformula-tests
new file mode 100755
index 00000000..f39ce2aa
--- /dev/null
+++ b/kspread/tests/generate-openformula-tests
@@ -0,0 +1,44 @@
+#!/bin/bash
+#
+# IMPORTANT: this is like the slowest thing ever. But it works. Usually.
+# Requires an open instance of KSpread, with openformula-test.ods loaded.
+#
+
+KSPREAD=`dcopfind 'kspread*'`
+KSPREAD=`echo $KSPREAD | sed s/DCOPRef\(// | sed s/,\)//`
+for i in `seq 51 514`
+ do
+ CELLREF=`dcop $KSPREAD Document/Map/List1 cell 7 $i`
+ PASS=`dcop $CELLREF value`
+ if test $PASS = 1.000000
+ then
+ CELLREF=`dcop $KSPREAD Document/Map/List1 cell 2 $i`
+ formula=`dcop $CELLREF text`
+ formula=`echo $formula | sed s/\"/\\\\\\\\\"/g`
+
+#nothing if formula contains a cellref ...
+ if test -z "`echo $formula | grep B[1-9]`"
+ then
+ CELLREF=`dcop $KSPREAD Document/Map/List1 cell 3 $i`
+ result=`dcop $CELLREF text`
+#test whether we have a number
+ if test $result = True
+ then
+ VAL="true"
+ else if test $result = False
+ then
+ VAL="false"
+ else if test -z `echo $result | grep -P "^\d+([\.,]\d+)?$"`
+ then
+ VAL="\"${result}\""
+ else
+ result=`echo $result | sed s/,/./`
+ VAL=$result
+ fi;fi;fi
+ echo "CHECK_EVAL(\"=${formula}\", Value($VAL)); // row $i"
+ fi
+ else echo // Not passed for line $i.
+ fi
+done
+
+