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.awt;
25cdf0e10cSrcweir 
26cdf0e10cSrcweir 
27cdf0e10cSrcweir import lib.MultiMethodTest;
28cdf0e10cSrcweir 
29cdf0e10cSrcweir import com.sun.star.awt.XNumericField;
30cdf0e10cSrcweir 
31cdf0e10cSrcweir /**
32cdf0e10cSrcweir * Testing <code>com.sun.star.awt.XNumericField</code>
33cdf0e10cSrcweir * interface methods :
34cdf0e10cSrcweir * <ul>
35cdf0e10cSrcweir *  <li><code> setValue()</code></li>
36cdf0e10cSrcweir *  <li><code> getValue()</code></li>
37cdf0e10cSrcweir *  <li><code> setMin()</code></li>
38cdf0e10cSrcweir *  <li><code> getMin()</code></li>
39cdf0e10cSrcweir *  <li><code> setMax()</code></li>
40cdf0e10cSrcweir *  <li><code> getMax()</code></li>
41cdf0e10cSrcweir *  <li><code> setFirst()</code></li>
42cdf0e10cSrcweir *  <li><code> getFirst()</code></li>
43cdf0e10cSrcweir *  <li><code> setLast()</code></li>
44cdf0e10cSrcweir *  <li><code> getLast()</code></li>
45cdf0e10cSrcweir *  <li><code> setSpinSize()</code></li>
46cdf0e10cSrcweir *  <li><code> getSpinSize()</code></li>
47cdf0e10cSrcweir *  <li><code> setDecimalDigits()</code></li>
48cdf0e10cSrcweir *  <li><code> getDecimalDigits()</code></li>
49cdf0e10cSrcweir *  <li><code> setStrictFormat()</code></li>
50cdf0e10cSrcweir *  <li><code> isStrictFormat()</code></li>
51cdf0e10cSrcweir * </ul> <p>
52cdf0e10cSrcweir * Test is <b> NOT </b> multithread compilant. <p>
53cdf0e10cSrcweir * @see com.sun.star.awt.XNumericField
54cdf0e10cSrcweir */
55cdf0e10cSrcweir public class _XNumericField extends MultiMethodTest {
56cdf0e10cSrcweir 
57cdf0e10cSrcweir     public XNumericField oObj = null;
58cdf0e10cSrcweir     private double val = 0 ;
59cdf0e10cSrcweir     private double min = 0 ;
60cdf0e10cSrcweir     private double max = 0 ;
61cdf0e10cSrcweir     private double first = 0 ;
62cdf0e10cSrcweir     private double last = 0 ;
63cdf0e10cSrcweir     private double spin = 0 ;
64cdf0e10cSrcweir     private short digits = 0 ;
65cdf0e10cSrcweir     private boolean strict = true ;
66cdf0e10cSrcweir 
67cdf0e10cSrcweir     /**
68cdf0e10cSrcweir     * Sets value changed and then compares it to get value. <p>
69cdf0e10cSrcweir     * Has <b>OK</b> status if set and get values are equal.
70cdf0e10cSrcweir     * The following method tests are to be completed successfully before :
71cdf0e10cSrcweir     * <ul>
72cdf0e10cSrcweir     *  <li> <code> getValue </code>  </li>
73cdf0e10cSrcweir     * </ul>
74cdf0e10cSrcweir     */
_setValue()75cdf0e10cSrcweir     public void _setValue() {
76cdf0e10cSrcweir         requiredMethod("getValue()");
77cdf0e10cSrcweir 
78cdf0e10cSrcweir         oObj.setValue(val + 1.1) ;
79cdf0e10cSrcweir 
80cdf0e10cSrcweir         tRes.tested("setValue()", oObj.getValue() == val + 1.1) ;
81cdf0e10cSrcweir     }
82cdf0e10cSrcweir 
83cdf0e10cSrcweir     /**
84cdf0e10cSrcweir     * Just calls the method and stores value returned. <p>
85cdf0e10cSrcweir     * Has <b>OK</b> status if no runtime exceptions occured.
86cdf0e10cSrcweir     */
_getValue()87cdf0e10cSrcweir     public void _getValue() {
88cdf0e10cSrcweir         val = oObj.getValue() ;
89cdf0e10cSrcweir 
90cdf0e10cSrcweir         tRes.tested("getValue()", true) ;
91cdf0e10cSrcweir     }
92cdf0e10cSrcweir 
93cdf0e10cSrcweir     /**
94cdf0e10cSrcweir     * Sets minimal value changed and then compares it to get value. <p>
95cdf0e10cSrcweir     * Has <b>OK</b> status if set and get values are equal.
96cdf0e10cSrcweir     * The following method tests are to be completed successfully before :
97cdf0e10cSrcweir     * <ul>
98cdf0e10cSrcweir     *  <li> <code> getMin </code>  </li>
99cdf0e10cSrcweir     * </ul>
100cdf0e10cSrcweir     */
_setMin()101cdf0e10cSrcweir     public void _setMin() {
102cdf0e10cSrcweir         requiredMethod("getMin()") ;
103cdf0e10cSrcweir 
104cdf0e10cSrcweir         oObj.setMin(min + 1.1) ;
105cdf0e10cSrcweir 
106cdf0e10cSrcweir         tRes.tested("setMin()", oObj.getMin() == min + 1.1) ;
107cdf0e10cSrcweir     }
108cdf0e10cSrcweir 
109cdf0e10cSrcweir     /**
110cdf0e10cSrcweir     * Just calls the method and stores value returned. <p>
111cdf0e10cSrcweir     * Has <b>OK</b> status if no runtime exceptions occured.
112cdf0e10cSrcweir     */
_getMin()113cdf0e10cSrcweir     public void _getMin() {
114cdf0e10cSrcweir 
115cdf0e10cSrcweir         boolean result = true ;
116cdf0e10cSrcweir         min = oObj.getMin() ;
117cdf0e10cSrcweir 
118cdf0e10cSrcweir         tRes.tested("getMin()", result) ;
119cdf0e10cSrcweir     }
120cdf0e10cSrcweir 
121cdf0e10cSrcweir     /**
122cdf0e10cSrcweir     * Sets maximal value changed and then compares it to get value. <p>
123cdf0e10cSrcweir     * Has <b>OK</b> status if set and get values are equal.
124cdf0e10cSrcweir     * The following method tests are to be completed successfully before :
125cdf0e10cSrcweir     * <ul>
126cdf0e10cSrcweir     *  <li> <code> getMax </code>  </li>
127cdf0e10cSrcweir     * </ul>
128cdf0e10cSrcweir     */
_setMax()129cdf0e10cSrcweir     public void _setMax() {
130cdf0e10cSrcweir         requiredMethod("getMax()") ;
131cdf0e10cSrcweir 
132cdf0e10cSrcweir         boolean result = true ;
133cdf0e10cSrcweir         oObj.setMax(max + 1.1) ;
134cdf0e10cSrcweir         result = oObj.getMax() == max + 1.1 ;
135cdf0e10cSrcweir 
136cdf0e10cSrcweir         tRes.tested("setMax()", result) ;
137cdf0e10cSrcweir     }
138cdf0e10cSrcweir 
139cdf0e10cSrcweir     /**
140cdf0e10cSrcweir     * Just calls the method and stores value returned. <p>
141cdf0e10cSrcweir     * Has <b>OK</b> status if no runtime exceptions occured.
142cdf0e10cSrcweir     */
_getMax()143cdf0e10cSrcweir     public void _getMax() {
144cdf0e10cSrcweir 
145cdf0e10cSrcweir         boolean result = true ;
146cdf0e10cSrcweir         max = oObj.getMax() ;
147cdf0e10cSrcweir 
148cdf0e10cSrcweir         tRes.tested("getMax()", result) ;
149cdf0e10cSrcweir     }
150cdf0e10cSrcweir 
151cdf0e10cSrcweir     /**
152cdf0e10cSrcweir     * Sets value changed and then compares it to get value. <p>
153cdf0e10cSrcweir     * Has <b>OK</b> status if set and get values are equal.
154cdf0e10cSrcweir     * The following method tests are to be completed successfully before :
155cdf0e10cSrcweir     * <ul>
156cdf0e10cSrcweir     *  <li> <code> getFirst </code>  </li>
157cdf0e10cSrcweir     * </ul>
158cdf0e10cSrcweir     */
_setFirst()159cdf0e10cSrcweir     public void _setFirst() {
160cdf0e10cSrcweir         requiredMethod("getFirst()") ;
161cdf0e10cSrcweir 
162cdf0e10cSrcweir         boolean result = true ;
163cdf0e10cSrcweir         oObj.setFirst(first + 1.1) ;
164cdf0e10cSrcweir         double ret = oObj.getFirst() ;
165cdf0e10cSrcweir         result = ret == first + 1.1 ;
166cdf0e10cSrcweir 
167cdf0e10cSrcweir         tRes.tested("setFirst()", result) ;
168cdf0e10cSrcweir     }
169cdf0e10cSrcweir 
170cdf0e10cSrcweir     /**
171cdf0e10cSrcweir     * Just calls the method and stores value returned. <p>
172cdf0e10cSrcweir     * Has <b>OK</b> status if no runtime exceptions occured.
173cdf0e10cSrcweir     */
_getFirst()174cdf0e10cSrcweir     public void _getFirst() {
175cdf0e10cSrcweir 
176cdf0e10cSrcweir         boolean result = true ;
177cdf0e10cSrcweir         first = oObj.getFirst() ;
178cdf0e10cSrcweir 
179cdf0e10cSrcweir         tRes.tested("getFirst()", result) ;
180cdf0e10cSrcweir     }
181cdf0e10cSrcweir 
182cdf0e10cSrcweir     /**
183cdf0e10cSrcweir     * Sets value changed and then compares it to get value. <p>
184cdf0e10cSrcweir     * Has <b>OK</b> status if set and get values are equal.
185cdf0e10cSrcweir     * The following method tests are to be completed successfully before :
186cdf0e10cSrcweir     * <ul>
187cdf0e10cSrcweir     *  <li> <code> getLast </code>  </li>
188cdf0e10cSrcweir     * </ul>
189cdf0e10cSrcweir     */
_setLast()190cdf0e10cSrcweir     public void _setLast() {
191cdf0e10cSrcweir         requiredMethod("getLast()") ;
192cdf0e10cSrcweir 
193cdf0e10cSrcweir         boolean result = true ;
194cdf0e10cSrcweir         oObj.setLast(last + 1.1) ;
195cdf0e10cSrcweir         double ret = oObj.getLast() ;
196cdf0e10cSrcweir 
197cdf0e10cSrcweir         result = ret == last + 1.1 ;
198cdf0e10cSrcweir 
199cdf0e10cSrcweir         tRes.tested("setLast()", result) ;
200cdf0e10cSrcweir     }
201cdf0e10cSrcweir 
202cdf0e10cSrcweir     /**
203cdf0e10cSrcweir     * Just calls the method and stores value returned. <p>
204cdf0e10cSrcweir     * Has <b>OK</b> status if no runtime exceptions occured.
205cdf0e10cSrcweir     */
_getLast()206cdf0e10cSrcweir     public void _getLast() {
207cdf0e10cSrcweir 
208cdf0e10cSrcweir         boolean result = true ;
209cdf0e10cSrcweir         last = oObj.getLast() ;
210cdf0e10cSrcweir 
211cdf0e10cSrcweir         tRes.tested("getLast()", result) ;
212cdf0e10cSrcweir     }
213cdf0e10cSrcweir 
214cdf0e10cSrcweir     /**
215cdf0e10cSrcweir     * Sets value changed and then compares it to get value. <p>
216cdf0e10cSrcweir     * Has <b>OK</b> status if set and get values are equal.
217cdf0e10cSrcweir     * The following method tests are to be completed successfully before :
218cdf0e10cSrcweir     * <ul>
219cdf0e10cSrcweir     *  <li> <code> getSpinSize </code>  </li>
220cdf0e10cSrcweir     * </ul>
221cdf0e10cSrcweir     */
_setSpinSize()222cdf0e10cSrcweir     public void _setSpinSize() {
223cdf0e10cSrcweir         requiredMethod("getSpinSize()") ;
224cdf0e10cSrcweir 
225cdf0e10cSrcweir         boolean result = true ;
226cdf0e10cSrcweir         oObj.setSpinSize(spin + 1.1) ;
227cdf0e10cSrcweir         result = oObj.getSpinSize() == spin + 1.1 ;
228cdf0e10cSrcweir 
229cdf0e10cSrcweir         tRes.tested("setSpinSize()", result) ;
230cdf0e10cSrcweir     }
231cdf0e10cSrcweir 
232cdf0e10cSrcweir     /**
233cdf0e10cSrcweir     * Just calls the method and stores value returned. <p>
234cdf0e10cSrcweir     * Has <b>OK</b> status if no runtime exceptions occured.
235cdf0e10cSrcweir     */
_getSpinSize()236cdf0e10cSrcweir     public void _getSpinSize() {
237cdf0e10cSrcweir 
238cdf0e10cSrcweir         boolean result = true ;
239cdf0e10cSrcweir         spin = oObj.getSpinSize() ;
240cdf0e10cSrcweir 
241cdf0e10cSrcweir         tRes.tested("getSpinSize()", result) ;
242cdf0e10cSrcweir     }
243cdf0e10cSrcweir 
244cdf0e10cSrcweir     /**
245cdf0e10cSrcweir     * Sets value changed and then compares it to get value. <p>
246cdf0e10cSrcweir     * Has <b>OK</b> status if set and get values are equal.
247cdf0e10cSrcweir     * The following method tests are to be completed successfully before :
248cdf0e10cSrcweir     * <ul>
249cdf0e10cSrcweir     *  <li> <code> getDecimalDigits </code>  </li>
250cdf0e10cSrcweir     * </ul>
251cdf0e10cSrcweir     */
_setDecimalDigits()252cdf0e10cSrcweir     public void _setDecimalDigits() {
253cdf0e10cSrcweir         requiredMethod("getDecimalDigits()") ;
254cdf0e10cSrcweir 
255cdf0e10cSrcweir         boolean result = true ;
256cdf0e10cSrcweir         oObj.setDecimalDigits((short)(digits + 1)) ;
257cdf0e10cSrcweir 
258cdf0e10cSrcweir         short res = oObj.getDecimalDigits() ;
259cdf0e10cSrcweir         result = res == ((short)digits + 1) ;
260cdf0e10cSrcweir 
261cdf0e10cSrcweir         tRes.tested("setDecimalDigits()", result) ;
262cdf0e10cSrcweir     }
263cdf0e10cSrcweir 
264cdf0e10cSrcweir     /**
265cdf0e10cSrcweir     * Just calls the method and stores value returned. <p>
266cdf0e10cSrcweir     * Has <b>OK</b> status if no runtime exceptions occured.
267cdf0e10cSrcweir     */
_getDecimalDigits()268cdf0e10cSrcweir     public void _getDecimalDigits() {
269cdf0e10cSrcweir 
270cdf0e10cSrcweir         boolean result = true ;
271cdf0e10cSrcweir         digits = oObj.getDecimalDigits() ;
272cdf0e10cSrcweir 
273cdf0e10cSrcweir         tRes.tested("getDecimalDigits()", result) ;
274cdf0e10cSrcweir     }
275cdf0e10cSrcweir 
276cdf0e10cSrcweir     /**
277cdf0e10cSrcweir     * Sets value changed and then compares it to get value. <p>
278cdf0e10cSrcweir     * Has <b>OK</b> status if set and get values are equal.
279cdf0e10cSrcweir     * The following method tests are to be completed successfully before :
280cdf0e10cSrcweir     * <ul>
281cdf0e10cSrcweir     *  <li> <code> isStrictFormat </code>  </li>
282cdf0e10cSrcweir     * </ul>
283cdf0e10cSrcweir     */
_setStrictFormat()284cdf0e10cSrcweir     public void _setStrictFormat() {
285cdf0e10cSrcweir         requiredMethod("isStrictFormat()") ;
286cdf0e10cSrcweir 
287cdf0e10cSrcweir         boolean result = true ;
288cdf0e10cSrcweir         oObj.setStrictFormat(!strict) ;
289cdf0e10cSrcweir         result = oObj.isStrictFormat() == !strict ;
290cdf0e10cSrcweir 
291cdf0e10cSrcweir         tRes.tested("setStrictFormat()", result) ;
292cdf0e10cSrcweir     }
293cdf0e10cSrcweir 
294cdf0e10cSrcweir     /**
295cdf0e10cSrcweir     * Just calls the method and stores value returned. <p>
296cdf0e10cSrcweir     * Has <b>OK</b> status if no runtime exceptions occured.
297cdf0e10cSrcweir     */
_isStrictFormat()298cdf0e10cSrcweir     public void _isStrictFormat() {
299cdf0e10cSrcweir 
300cdf0e10cSrcweir         boolean result = true ;
301cdf0e10cSrcweir         strict = oObj.isStrictFormat() ;
302cdf0e10cSrcweir 
303cdf0e10cSrcweir         tRes.tested("isStrictFormat()", result) ;
304cdf0e10cSrcweir     }
305cdf0e10cSrcweir }
306cdf0e10cSrcweir 
307cdf0e10cSrcweir 
308