Update ooo320-m1
[ooovba.git] / qadevOOo / tests / basic / ifc / sheet / XSheetCondition / sheet_XSheetCondition.xba
blob9633f4ce1c5462d816dd90f56b7e1660c1017acf
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="sheet_XSheetCondition" 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: sheet_XSheetCondition.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.sheet.XSheetCondition
50 '*************************************************************************
51 On Error Goto ErrHndl
52 Dim bOK As Boolean
53 Dim oldOperator As Variant
54 Dim oldFormula As String
55 Dim oPos As com.sun.star.table.CellAddress
56 Dim newPos As New com.sun.star.table.CellAddress
58 Test.StartMethod("setOperator()")
59 Test.StartMethod("getOperator()")
60 bOK = true
61 oldOperator = oObj.getOperator()
62 oObj.setOperator(com.sun.star.sheet.ConditionOperator.LESS)
63 bOK = bOK AND oObj.getOperator() &lt;&gt; oldOperator
64 oObj.setOperator(oldOperator)
65 Test.MethodTested("getOperator()", bOK)
66 Test.MethodTested("setOperator()", bOK)
68 Test.StartMethod("getFormula1()")
69 Test.StartMethod("setFormula1()")
70 bOK = true
71 oldFormula = oObj.getFormula1()
72 oObj.setFormula1("1")
73 bOK = bOK AND oObj.getFormula1() = "1"
74 oObj.setFormula1(oldFormula)
75 Test.MethodTested("getFormula1()", bOK)
76 Test.MethodTested("setFormula1()", bOK)
78 Test.StartMethod("getFormula2()")
79 Test.StartMethod("setFormula2()")
80 bOK = true
81 oldFormula = oObj.getFormula2()
82 oObj.setFormula2("2")
83 bOK = bOK AND oObj.getFormula2() = "2"
84 oObj.setFormula2(oldFormula)
85 Test.MethodTested("getFormula2()", bOK)
86 Test.MethodTested("setFormula2()", bOK)
88 Test.StartMethod("getSourcePosition()")
89 Test.StartMethod("setSourcePosition()")
90 bOK = true
91 oPos = oObj.getSourcePosition()
92 bOK = bOK AND oPos.Column &gt;= 0
93 newPos.Sheet = oPos.Sheet
94 newPos.Column = oPos.Column + 1
95 newPos.Row = oPos.Row + 1
96 oObj.setSourcePosition(newPos)
97 bOK = bOK AND oObj.getSourcePosition().Column = oPos.Column + 1
98 Test.MethodTested("getSourcePosition()", bOK)
99 Test.MethodTested("setSourcePosition()", bOK)
101 Exit Sub
102 ErrHndl:
103 Test.Exception()
104 bOK = false
105 resume next
106 End Sub
107 </script:module>