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">
4
5
6'*************************************************************************
7'
8' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9'
10' Copyright 2000, 2010 Oracle and/or its affiliates.
11'
12' OpenOffice.org - a multi-platform office productivity suite
13'
14' This file is part of OpenOffice.org.
15'
16' OpenOffice.org is free software: you can redistribute it and/or modify
17' it under the terms of the GNU Lesser General Public License version 3
18' only, as published by the Free Software Foundation.
19'
20' OpenOffice.org is distributed in the hope that it will be useful,
21' but WITHOUT ANY WARRANTY; without even the implied warranty of
22' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23' GNU Lesser General Public License version 3 for more details
24' (a copy is included in the LICENSE file that accompanied this code).
25'
26' You should have received a copy of the GNU Lesser General Public License
27' version 3 along with OpenOffice.org.  If not, see
28' <http://www.openoffice.org/license.html>
29' for a copy of the LGPLv3 License.
30'
31'*************************************************************************
32*****
33'*************************************************************************
34
35
36
37' Be sure that all variables are dimensioned:
38option explicit
39
40
41
42Sub RunTest()
43
44'*************************************************************************
45' INTERFACE:
46' com.sun.star.sheet.XSheetCondition
47'*************************************************************************
48On Error Goto ErrHndl
49    Dim bOK As Boolean
50    Dim oldOperator As Variant
51    Dim oldFormula As String
52    Dim oPos As com.sun.star.table.CellAddress
53    Dim newPos As New com.sun.star.table.CellAddress
54
55    Test.StartMethod("setOperator()")
56    Test.StartMethod("getOperator()")
57    bOK = true
58    oldOperator = oObj.getOperator()
59    oObj.setOperator(com.sun.star.sheet.ConditionOperator.LESS)
60    bOK = bOK AND oObj.getOperator() &lt;&gt; oldOperator
61    oObj.setOperator(oldOperator)
62    Test.MethodTested("getOperator()", bOK)
63    Test.MethodTested("setOperator()", bOK)
64
65    Test.StartMethod("getFormula1()")
66    Test.StartMethod("setFormula1()")
67    bOK = true
68    oldFormula = oObj.getFormula1()
69    oObj.setFormula1("1")
70    bOK = bOK AND oObj.getFormula1() = "1"
71    oObj.setFormula1(oldFormula)
72    Test.MethodTested("getFormula1()", bOK)
73    Test.MethodTested("setFormula1()", bOK)
74
75    Test.StartMethod("getFormula2()")
76    Test.StartMethod("setFormula2()")
77    bOK = true
78    oldFormula = oObj.getFormula2()
79    oObj.setFormula2("2")
80    bOK = bOK AND oObj.getFormula2() = "2"
81    oObj.setFormula2(oldFormula)
82    Test.MethodTested("getFormula2()", bOK)
83    Test.MethodTested("setFormula2()", bOK)
84
85    Test.StartMethod("getSourcePosition()")
86    Test.StartMethod("setSourcePosition()")
87    bOK = true
88    oPos = oObj.getSourcePosition()
89    bOK = bOK AND oPos.Column &gt;= 0
90    newPos.Sheet = oPos.Sheet
91    newPos.Column = oPos.Column + 1
92    newPos.Row = oPos.Row + 1
93    oObj.setSourcePosition(newPos)
94    bOK = bOK AND oObj.getSourcePosition().Column = oPos.Column + 1
95    Test.MethodTested("getSourcePosition()", bOK)
96    Test.MethodTested("setSourcePosition()", bOK)
97
98Exit Sub
99ErrHndl:
100    Test.Exception()
101    bOK = false
102    resume next
103End Sub
104</script:module>
105