Update ooo320-m1
[ooovba.git] / qadevOOo / tests / basic / ifc / table / XCell / table_XCell.xba
blob9a9215569475f6887a29002e73c91dd64f5e2937
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
3 <script:module xmlns:script="http://openoffice.org/2000/script" script:name="table_XCell" script:language="StarBasic">
6 '*************************************************************************
8 ' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9 '
10 ' Copyright 2008 by Sun Microsystems, Inc.
12 ' OpenOffice.org - a multi-platform office productivity suite
14 ' $RCSfile: table_XCell.xba,v $
16 ' $Revision: 1.3 $
18 ' This file is part of OpenOffice.org.
20 ' OpenOffice.org is free software: you can redistribute it and/or modify
21 ' it under the terms of the GNU Lesser General Public License version 3
22 ' only, as published by the Free Software Foundation.
24 ' OpenOffice.org is distributed in the hope that it will be useful,
25 ' but WITHOUT ANY WARRANTY; without even the implied warranty of
26 ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 ' GNU Lesser General Public License version 3 for more details
28 ' (a copy is included in the LICENSE file that accompanied this code).
30 ' You should have received a copy of the GNU Lesser General Public License
31 ' version 3 along with OpenOffice.org. If not, see
32 ' <http://www.openoffice.org/license.html>
33 ' for a copy of the LGPLv3 License.
35 '*************************************************************************
36 '*************************************************************************
40 ' Be sure that all variables are dimensioned:
41 option explicit
45 Sub RunTest()
47 '*************************************************************************
48 ' INTERFACE:
49 ' com.sun.star.table.XCell
50 '*************************************************************************
51 On Error Goto ErrHndl
52 Dim bOK As Boolean
53 Dim aFormula As String
54 Dim aValue As Integer
55 Dim aType As Variant
57 Test.StartMethod("setFormula()")
58 bOK = true
59 Out.Log("setFormula(""=2+2"")")
60 oObj.setFormula("=2+2")
61 Test.MethodTested("setFormula()", bOK)
63 Test.StartMethod("getFormula()")
64 bOK = true
65 aFormula = oObj.getFormula()
66 Out.Log("getFormula() returned '" &amp; aFormula &amp; "'")
67 bOK = bOK AND inStr(1, aFormula, "2+2")
68 Test.MethodTested("getFormula()", bOK)
70 Test.StartMethod("getValue()")
71 bOK = true
72 aValue = oObj.getValue()
73 bOK = bOK AND aValue = 4
74 Test.MethodTested("getValue()", bOK)
76 Test.StartMethod("setValue()")
77 bOK = true
78 oObj.setValue(10)
79 bOK = bOK AND oObj.getValue = 10
80 Test.MethodTested("setValue()", bOK)
82 Test.StartMethod("getType()")
83 bOK = true
84 aType = oObj.getType()
85 bOK = bOK AND (aType = com.sun.star.table.CellContentType.EMPTY OR _
86 aType = com.sun.star.table.CellContentType.VALUE OR _
87 aType = com.sun.star.table.CellContentType.TEXT OR _
88 aType = com.sun.star.table.CellContentType.FORMULA)
89 Test.MethodTested("getType()", bOK)
91 Test.StartMethod("getError()")
92 bOK = true
93 bOK = bOK AND (oObj.getError() = 0)
94 oObj.setFormula("=sqrt(-2)")
95 bOK = bOK AND (oObj.getError() &lt;&gt; 0)
96 Test.MethodTested("getError()", bOK)
98 Exit Sub
99 ErrHndl:
100 Test.Exception()
101 bOK = false
102 resume next
103 End Sub
104 </script:module>