merge the formfield patch from ooo-build
[ooovba.git] / qadevOOo / tests / java / ifc / awt / _XNumericField.java
blob37c913d121f63483dc97b7096c87fabbdb1bc5b1
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _XNumericField.java,v $
10 * $Revision: 1.4 $
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 ************************************************************************/
31 package ifc.awt;
34 import lib.MultiMethodTest;
36 import com.sun.star.awt.XNumericField;
38 /**
39 * Testing <code>com.sun.star.awt.XNumericField</code>
40 * interface methods :
41 * <ul>
42 * <li><code> setValue()</code></li>
43 * <li><code> getValue()</code></li>
44 * <li><code> setMin()</code></li>
45 * <li><code> getMin()</code></li>
46 * <li><code> setMax()</code></li>
47 * <li><code> getMax()</code></li>
48 * <li><code> setFirst()</code></li>
49 * <li><code> getFirst()</code></li>
50 * <li><code> setLast()</code></li>
51 * <li><code> getLast()</code></li>
52 * <li><code> setSpinSize()</code></li>
53 * <li><code> getSpinSize()</code></li>
54 * <li><code> setDecimalDigits()</code></li>
55 * <li><code> getDecimalDigits()</code></li>
56 * <li><code> setStrictFormat()</code></li>
57 * <li><code> isStrictFormat()</code></li>
58 * </ul> <p>
59 * Test is <b> NOT </b> multithread compilant. <p>
60 * @see com.sun.star.awt.XNumericField
62 public class _XNumericField extends MultiMethodTest {
64 public XNumericField oObj = null;
65 private double val = 0 ;
66 private double min = 0 ;
67 private double max = 0 ;
68 private double first = 0 ;
69 private double last = 0 ;
70 private double spin = 0 ;
71 private short digits = 0 ;
72 private boolean strict = true ;
74 /**
75 * Sets value changed and then compares it to get value. <p>
76 * Has <b>OK</b> status if set and get values are equal.
77 * The following method tests are to be completed successfully before :
78 * <ul>
79 * <li> <code> getValue </code> </li>
80 * </ul>
82 public void _setValue() {
83 requiredMethod("getValue()");
85 oObj.setValue(val + 1.1) ;
87 tRes.tested("setValue()", oObj.getValue() == val + 1.1) ;
90 /**
91 * Just calls the method and stores value returned. <p>
92 * Has <b>OK</b> status if no runtime exceptions occured.
94 public void _getValue() {
95 val = oObj.getValue() ;
97 tRes.tested("getValue()", true) ;
101 * Sets minimal value changed and then compares it to get value. <p>
102 * Has <b>OK</b> status if set and get values are equal.
103 * The following method tests are to be completed successfully before :
104 * <ul>
105 * <li> <code> getMin </code> </li>
106 * </ul>
108 public void _setMin() {
109 requiredMethod("getMin()") ;
111 oObj.setMin(min + 1.1) ;
113 tRes.tested("setMin()", oObj.getMin() == min + 1.1) ;
117 * Just calls the method and stores value returned. <p>
118 * Has <b>OK</b> status if no runtime exceptions occured.
120 public void _getMin() {
122 boolean result = true ;
123 min = oObj.getMin() ;
125 tRes.tested("getMin()", result) ;
129 * Sets maximal value changed and then compares it to get value. <p>
130 * Has <b>OK</b> status if set and get values are equal.
131 * The following method tests are to be completed successfully before :
132 * <ul>
133 * <li> <code> getMax </code> </li>
134 * </ul>
136 public void _setMax() {
137 requiredMethod("getMax()") ;
139 boolean result = true ;
140 oObj.setMax(max + 1.1) ;
141 result = oObj.getMax() == max + 1.1 ;
143 tRes.tested("setMax()", result) ;
147 * Just calls the method and stores value returned. <p>
148 * Has <b>OK</b> status if no runtime exceptions occured.
150 public void _getMax() {
152 boolean result = true ;
153 max = oObj.getMax() ;
155 tRes.tested("getMax()", result) ;
159 * Sets value changed and then compares it to get value. <p>
160 * Has <b>OK</b> status if set and get values are equal.
161 * The following method tests are to be completed successfully before :
162 * <ul>
163 * <li> <code> getFirst </code> </li>
164 * </ul>
166 public void _setFirst() {
167 requiredMethod("getFirst()") ;
169 boolean result = true ;
170 oObj.setFirst(first + 1.1) ;
171 double ret = oObj.getFirst() ;
172 result = ret == first + 1.1 ;
174 tRes.tested("setFirst()", result) ;
178 * Just calls the method and stores value returned. <p>
179 * Has <b>OK</b> status if no runtime exceptions occured.
181 public void _getFirst() {
183 boolean result = true ;
184 first = oObj.getFirst() ;
186 tRes.tested("getFirst()", result) ;
190 * Sets value changed and then compares it to get value. <p>
191 * Has <b>OK</b> status if set and get values are equal.
192 * The following method tests are to be completed successfully before :
193 * <ul>
194 * <li> <code> getLast </code> </li>
195 * </ul>
197 public void _setLast() {
198 requiredMethod("getLast()") ;
200 boolean result = true ;
201 oObj.setLast(last + 1.1) ;
202 double ret = oObj.getLast() ;
204 result = ret == last + 1.1 ;
206 tRes.tested("setLast()", result) ;
210 * Just calls the method and stores value returned. <p>
211 * Has <b>OK</b> status if no runtime exceptions occured.
213 public void _getLast() {
215 boolean result = true ;
216 last = oObj.getLast() ;
218 tRes.tested("getLast()", result) ;
222 * Sets value changed and then compares it to get value. <p>
223 * Has <b>OK</b> status if set and get values are equal.
224 * The following method tests are to be completed successfully before :
225 * <ul>
226 * <li> <code> getSpinSize </code> </li>
227 * </ul>
229 public void _setSpinSize() {
230 requiredMethod("getSpinSize()") ;
232 boolean result = true ;
233 oObj.setSpinSize(spin + 1.1) ;
234 result = oObj.getSpinSize() == spin + 1.1 ;
236 tRes.tested("setSpinSize()", result) ;
240 * Just calls the method and stores value returned. <p>
241 * Has <b>OK</b> status if no runtime exceptions occured.
243 public void _getSpinSize() {
245 boolean result = true ;
246 spin = oObj.getSpinSize() ;
248 tRes.tested("getSpinSize()", result) ;
252 * Sets value changed and then compares it to get value. <p>
253 * Has <b>OK</b> status if set and get values are equal.
254 * The following method tests are to be completed successfully before :
255 * <ul>
256 * <li> <code> getDecimalDigits </code> </li>
257 * </ul>
259 public void _setDecimalDigits() {
260 requiredMethod("getDecimalDigits()") ;
262 boolean result = true ;
263 oObj.setDecimalDigits((short)(digits + 1)) ;
265 short res = oObj.getDecimalDigits() ;
266 result = res == ((short)digits + 1) ;
268 tRes.tested("setDecimalDigits()", result) ;
272 * Just calls the method and stores value returned. <p>
273 * Has <b>OK</b> status if no runtime exceptions occured.
275 public void _getDecimalDigits() {
277 boolean result = true ;
278 digits = oObj.getDecimalDigits() ;
280 tRes.tested("getDecimalDigits()", result) ;
284 * Sets value changed and then compares it to get value. <p>
285 * Has <b>OK</b> status if set and get values are equal.
286 * The following method tests are to be completed successfully before :
287 * <ul>
288 * <li> <code> isStrictFormat </code> </li>
289 * </ul>
291 public void _setStrictFormat() {
292 requiredMethod("isStrictFormat()") ;
294 boolean result = true ;
295 oObj.setStrictFormat(!strict) ;
296 result = oObj.isStrictFormat() == !strict ;
298 tRes.tested("setStrictFormat()", result) ;
302 * Just calls the method and stores value returned. <p>
303 * Has <b>OK</b> status if no runtime exceptions occured.
305 public void _isStrictFormat() {
307 boolean result = true ;
308 strict = oObj.isStrictFormat() ;
310 tRes.tested("isStrictFormat()", result) ;