1*ef39d40dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*ef39d40dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*ef39d40dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*ef39d40dSAndrew Rist  * distributed with this work for additional information
6*ef39d40dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*ef39d40dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*ef39d40dSAndrew Rist  * "License"); you may not use this file except in compliance
9*ef39d40dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*ef39d40dSAndrew Rist  *
11*ef39d40dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*ef39d40dSAndrew Rist  *
13*ef39d40dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*ef39d40dSAndrew Rist  * software distributed under the License is distributed on an
15*ef39d40dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*ef39d40dSAndrew Rist  * KIND, either express or implied.  See the License for the
17*ef39d40dSAndrew Rist  * specific language governing permissions and limitations
18*ef39d40dSAndrew Rist  * under the License.
19*ef39d40dSAndrew Rist  *
20*ef39d40dSAndrew Rist  *************************************************************/
21*ef39d40dSAndrew Rist 
22*ef39d40dSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir package ifc.sheet;
25cdf0e10cSrcweir 
26cdf0e10cSrcweir import lib.MultiMethodTest;
27cdf0e10cSrcweir import util.ValueChanger;
28cdf0e10cSrcweir 
29cdf0e10cSrcweir import com.sun.star.sheet.ConditionOperator;
30cdf0e10cSrcweir import com.sun.star.sheet.XSheetCondition;
31cdf0e10cSrcweir import com.sun.star.table.CellAddress;
32cdf0e10cSrcweir 
33cdf0e10cSrcweir /**
34cdf0e10cSrcweir * Testing <code>com.sun.star.sheet.XSheetCondition</code>
35cdf0e10cSrcweir * interface methods :
36cdf0e10cSrcweir * <ul>
37cdf0e10cSrcweir *  <li><code> getOperator()</code></li>
38cdf0e10cSrcweir *  <li><code> setOperator()</code></li>
39cdf0e10cSrcweir *  <li><code> getFormula1()</code></li>
40cdf0e10cSrcweir *  <li><code> setFormula1()</code></li>
41cdf0e10cSrcweir *  <li><code> getFormula2()</code></li>
42cdf0e10cSrcweir *  <li><code> setFormula2()</code></li>
43cdf0e10cSrcweir *  <li><code> getSourcePosition()</code></li>
44cdf0e10cSrcweir *  <li><code> setSourcePosition()</code></li>
45cdf0e10cSrcweir * </ul> <p>
46cdf0e10cSrcweir * @see com.sun.star.sheet.XSheetCondition
47cdf0e10cSrcweir */
48cdf0e10cSrcweir public class _XSheetCondition extends MultiMethodTest {
49cdf0e10cSrcweir     public XSheetCondition oObj = null;
50cdf0e10cSrcweir     public String Formula1 = null;
51cdf0e10cSrcweir     public String Formula2 = null;
52cdf0e10cSrcweir     public ConditionOperator Operator = null;
53cdf0e10cSrcweir     public CellAddress SourcePosition = null;
54cdf0e10cSrcweir 
55cdf0e10cSrcweir     /**
56cdf0e10cSrcweir     * Test calls the method, checks and stores returned value. <p>
57cdf0e10cSrcweir     * Has <b> OK </b> status if returned vakue isn't null. <p>
58cdf0e10cSrcweir     */
_getFormula1()59cdf0e10cSrcweir     public void _getFormula1() {
60cdf0e10cSrcweir         Formula1 = oObj.getFormula1();
61cdf0e10cSrcweir         tRes.tested("getFormula1()", Formula1 != null);
62cdf0e10cSrcweir     }
63cdf0e10cSrcweir 
64cdf0e10cSrcweir     /**
65cdf0e10cSrcweir     * Test calls the method, checks and stores returned value. <p>
66cdf0e10cSrcweir     * Has <b> OK </b> status if returned vakue isn't null. <p>
67cdf0e10cSrcweir     */
_getFormula2()68cdf0e10cSrcweir     public void _getFormula2() {
69cdf0e10cSrcweir         Formula2 = oObj.getFormula2();
70cdf0e10cSrcweir         tRes.tested("getFormula2()", Formula2 != null);
71cdf0e10cSrcweir     }
72cdf0e10cSrcweir 
73cdf0e10cSrcweir     /**
74cdf0e10cSrcweir     * Test calls the method, checks and stores returned value. <p>
75cdf0e10cSrcweir     * Has <b> OK </b> status if returned vakue isn't null. <p>
76cdf0e10cSrcweir     */
_getOperator()77cdf0e10cSrcweir     public void _getOperator() {
78cdf0e10cSrcweir         Operator = oObj.getOperator();
79cdf0e10cSrcweir         tRes.tested("getOperator()", Operator != null);
80cdf0e10cSrcweir     }
81cdf0e10cSrcweir 
82cdf0e10cSrcweir     /**
83cdf0e10cSrcweir     * Test calls the method, checks and stores returned value. <p>
84cdf0e10cSrcweir     * Has <b> OK </b> status if returned vakue isn't null. <p>
85cdf0e10cSrcweir     */
_getSourcePosition()86cdf0e10cSrcweir     public void _getSourcePosition() {
87cdf0e10cSrcweir         SourcePosition = oObj.getSourcePosition();
88cdf0e10cSrcweir         tRes.tested("getSourcePosition()", SourcePosition != null);
89cdf0e10cSrcweir     }
90cdf0e10cSrcweir 
91cdf0e10cSrcweir     /**
92cdf0e10cSrcweir     * Test sets new value of formula1, gets formula1 again and compares
93cdf0e10cSrcweir     * returned value with value that was stored by method
94cdf0e10cSrcweir     * <code>getFormula1()</code>. <p>
95cdf0e10cSrcweir     * Has <b> OK </b> status if values aren't equal. <p>
96cdf0e10cSrcweir     * The following method tests are to be completed successfully before :
97cdf0e10cSrcweir     * <ul>
98cdf0e10cSrcweir     *  <li> <code> getFormula1() </code> : to have value of 'Formula1' </li>
99cdf0e10cSrcweir     * </ul>
100cdf0e10cSrcweir     */
_setFormula1()101cdf0e10cSrcweir     public void _setFormula1() {
102cdf0e10cSrcweir         requiredMethod("getFormula1()");
103cdf0e10cSrcweir         oObj.setFormula1("$Sheet1.$C$" + Thread.activeCount());
104cdf0e10cSrcweir         tRes.tested("setFormula1()", !Formula1.equals( oObj.getFormula1() ) );
105cdf0e10cSrcweir     }
106cdf0e10cSrcweir 
107cdf0e10cSrcweir     /**
108cdf0e10cSrcweir     * Test sets new value of formula2, gets formula2 again and compares
109cdf0e10cSrcweir     * returned value with value that was stored by method
110cdf0e10cSrcweir     * <code>getFormula2()</code>. <p>
111cdf0e10cSrcweir     * Has <b> OK </b> status if values aren't equal. <p>
112cdf0e10cSrcweir     * The following method tests are to be completed successfully before :
113cdf0e10cSrcweir     * <ul>
114cdf0e10cSrcweir     *  <li> <code> getFormula2() </code> : to have value of 'Formula2' </li>
115cdf0e10cSrcweir     * </ul>
116cdf0e10cSrcweir     */
_setFormula2()117cdf0e10cSrcweir     public void _setFormula2() {
118cdf0e10cSrcweir         requiredMethod("getFormula2()");
119cdf0e10cSrcweir         oObj.setFormula2("$Sheet1.$A$" + Thread.activeCount());
120cdf0e10cSrcweir         tRes.tested("setFormula2()", !Formula2.equals( oObj.getFormula2() ) );
121cdf0e10cSrcweir     }
122cdf0e10cSrcweir 
123cdf0e10cSrcweir     /**
124cdf0e10cSrcweir     * Test sets new value of operator, gets operator and compares
125cdf0e10cSrcweir     * returned value with value that was set. <p>
126cdf0e10cSrcweir     * Has <b> OK </b> status if values aren't equal. <p>
127cdf0e10cSrcweir     */
_setOperator()128cdf0e10cSrcweir     public void _setOperator() {
129cdf0e10cSrcweir         oObj.setOperator(ConditionOperator.BETWEEN);
130cdf0e10cSrcweir         tRes.tested("setOperator()", !Operator.equals( oObj.getOperator() ) );
131cdf0e10cSrcweir     }
132cdf0e10cSrcweir 
133cdf0e10cSrcweir     /**
134cdf0e10cSrcweir     * Test change value that was stored by method
135cdf0e10cSrcweir     * <code>getSourcePosition()</code>, sets this new value, gets source
136cdf0e10cSrcweir     * position again and compares returned value with value that was set. <p>
137cdf0e10cSrcweir     * Has <b> OK </b> status if values aren't equal. <p>
138cdf0e10cSrcweir     * The following method tests are to be completed successfully before :
139cdf0e10cSrcweir     * <ul>
140cdf0e10cSrcweir     *  <li> <code> getSourcePosition() </code> : to have value of source
141cdf0e10cSrcweir     *  position </li>
142cdf0e10cSrcweir     * </ul>
143cdf0e10cSrcweir     */
_setSourcePosition()144cdf0e10cSrcweir     public void _setSourcePosition() {
145cdf0e10cSrcweir         requiredMethod("getSourcePosition()");
146cdf0e10cSrcweir         oObj.setSourcePosition(
147cdf0e10cSrcweir                     (CellAddress)ValueChanger.changePValue(SourcePosition));
148cdf0e10cSrcweir         tRes.tested(
149cdf0e10cSrcweir             "setSourcePosition()",
150cdf0e10cSrcweir             !SourcePosition.equals( oObj.getSourcePosition() ) );
151cdf0e10cSrcweir     }
152cdf0e10cSrcweir 
153cdf0e10cSrcweir }  // finish class _XSheetCondition
154cdf0e10cSrcweir 
155