1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _XSheetCondition.java,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
33 import lib
.MultiMethodTest
;
34 import util
.ValueChanger
;
36 import com
.sun
.star
.sheet
.ConditionOperator
;
37 import com
.sun
.star
.sheet
.XSheetCondition
;
38 import com
.sun
.star
.table
.CellAddress
;
41 * Testing <code>com.sun.star.sheet.XSheetCondition</code>
44 * <li><code> getOperator()</code></li>
45 * <li><code> setOperator()</code></li>
46 * <li><code> getFormula1()</code></li>
47 * <li><code> setFormula1()</code></li>
48 * <li><code> getFormula2()</code></li>
49 * <li><code> setFormula2()</code></li>
50 * <li><code> getSourcePosition()</code></li>
51 * <li><code> setSourcePosition()</code></li>
53 * @see com.sun.star.sheet.XSheetCondition
55 public class _XSheetCondition
extends MultiMethodTest
{
56 public XSheetCondition oObj
= null;
57 public String Formula1
= null;
58 public String Formula2
= null;
59 public ConditionOperator Operator
= null;
60 public CellAddress SourcePosition
= null;
63 * Test calls the method, checks and stores returned value. <p>
64 * Has <b> OK </b> status if returned vakue isn't null. <p>
66 public void _getFormula1() {
67 Formula1
= oObj
.getFormula1();
68 tRes
.tested("getFormula1()", Formula1
!= null);
72 * Test calls the method, checks and stores returned value. <p>
73 * Has <b> OK </b> status if returned vakue isn't null. <p>
75 public void _getFormula2() {
76 Formula2
= oObj
.getFormula2();
77 tRes
.tested("getFormula2()", Formula2
!= null);
81 * Test calls the method, checks and stores returned value. <p>
82 * Has <b> OK </b> status if returned vakue isn't null. <p>
84 public void _getOperator() {
85 Operator
= oObj
.getOperator();
86 tRes
.tested("getOperator()", Operator
!= null);
90 * Test calls the method, checks and stores returned value. <p>
91 * Has <b> OK </b> status if returned vakue isn't null. <p>
93 public void _getSourcePosition() {
94 SourcePosition
= oObj
.getSourcePosition();
95 tRes
.tested("getSourcePosition()", SourcePosition
!= null);
99 * Test sets new value of formula1, gets formula1 again and compares
100 * returned value with value that was stored by method
101 * <code>getFormula1()</code>. <p>
102 * Has <b> OK </b> status if values aren't equal. <p>
103 * The following method tests are to be completed successfully before :
105 * <li> <code> getFormula1() </code> : to have value of 'Formula1' </li>
108 public void _setFormula1() {
109 requiredMethod("getFormula1()");
110 oObj
.setFormula1("$Sheet1.$C$" + Thread
.activeCount());
111 tRes
.tested("setFormula1()", !Formula1
.equals( oObj
.getFormula1() ) );
115 * Test sets new value of formula2, gets formula2 again and compares
116 * returned value with value that was stored by method
117 * <code>getFormula2()</code>. <p>
118 * Has <b> OK </b> status if values aren't equal. <p>
119 * The following method tests are to be completed successfully before :
121 * <li> <code> getFormula2() </code> : to have value of 'Formula2' </li>
124 public void _setFormula2() {
125 requiredMethod("getFormula2()");
126 oObj
.setFormula2("$Sheet1.$A$" + Thread
.activeCount());
127 tRes
.tested("setFormula2()", !Formula2
.equals( oObj
.getFormula2() ) );
131 * Test sets new value of operator, gets operator and compares
132 * returned value with value that was set. <p>
133 * Has <b> OK </b> status if values aren't equal. <p>
135 public void _setOperator() {
136 oObj
.setOperator(ConditionOperator
.BETWEEN
);
137 tRes
.tested("setOperator()", !Operator
.equals( oObj
.getOperator() ) );
141 * Test change value that was stored by method
142 * <code>getSourcePosition()</code>, sets this new value, gets source
143 * position again and compares returned value with value that was set. <p>
144 * Has <b> OK </b> status if values aren't equal. <p>
145 * The following method tests are to be completed successfully before :
147 * <li> <code> getSourcePosition() </code> : to have value of source
151 public void _setSourcePosition() {
152 requiredMethod("getSourcePosition()");
153 oObj
.setSourcePosition(
154 (CellAddress
)ValueChanger
.changePValue(SourcePosition
));
156 "setSourcePosition()",
157 !SourcePosition
.equals( oObj
.getSourcePosition() ) );
160 } // finish class _XSheetCondition