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: _XCurrencyField.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
;
35 import com
.sun
.star
.awt
.XCurrencyField
;
38 * Testing <code>com.sun.star.awt.XCurrencyField</code>
41 * <li><code> setValue()</code></li>
42 * <li><code> getValue()</code></li>
43 * <li><code> setMin()</code></li>
44 * <li><code> getMin()</code></li>
45 * <li><code> setMax()</code></li>
46 * <li><code> getMax()</code></li>
47 * <li><code> setFirst()</code></li>
48 * <li><code> getFirst()</code></li>
49 * <li><code> setLast()</code></li>
50 * <li><code> getLast()</code></li>
51 * <li><code> setSpinSize()</code></li>
52 * <li><code> getSpinSize()</code></li>
53 * <li><code> setDecimalDigits()</code></li>
54 * <li><code> getDecimalDigits()</code></li>
55 * <li><code> setStrictFormat()</code></li>
56 * <li><code> isStrictFormat()</code></li>
58 * Test is <b> NOT </b> multithread compilant. <p>
59 * @see com.sun.star.awt.XCurrencyField
61 public class _XCurrencyField
extends MultiMethodTest
{
63 public XCurrencyField oObj
= null;
64 private double val
= 0;
65 private double min
= 0;
66 private double max
= 0;
67 private double first
= 0;
68 private double last
= 0;
69 private double spin
= 0;
70 private short digits
= 0;
71 private boolean strict
= true;
74 * Sets value changed and then compares it to get value. <p>
75 * Has <b>OK</b> status if set and get values are equal.
76 * The following method tests are to be completed successfully before :
78 * <li> <code> getValue </code> </li>
81 public void _setValue() {
82 requiredMethod("getValue()");
84 oObj
.setValue(val
+ 1.1);
86 tRes
.tested("setValue()", oObj
.getValue() == val
+ 1.1);
90 * Just calls the method and stores value returned. <p>
91 * Has <b>OK</b> status if no runtime exceptions occured.
93 public void _getValue() {
94 val
= oObj
.getValue();
96 tRes
.tested("getValue()", true);
100 * Sets minimal value changed and then compares it to get value. <p>
101 * Has <b>OK</b> status if set and get values are equal.
102 * The following method tests are to be completed successfully before :
104 * <li> <code> getMin </code> </li>
107 public void _setMin() {
108 requiredMethod("getMin()");
110 oObj
.setMin(min
+ 1.1);
112 tRes
.tested("setMin()", oObj
.getMin() == min
+ 1.1);
116 * Just calls the method and stores value returned. <p>
117 * Has <b>OK</b> status if no runtime exceptions occured.
119 public void _getMin() {
121 boolean result
= true;
124 tRes
.tested("getMin()", result
);
128 * Sets maximal value changed and then compares it to get value. <p>
129 * Has <b>OK</b> status if set and get values are equal.
130 * The following method tests are to be completed successfully before :
132 * <li> <code> getMax </code> </li>
135 public void _setMax() {
136 requiredMethod("getMax()");
138 boolean result
= true;
139 oObj
.setMax(max
+ 1.1);
140 result
= oObj
.getMax() == max
+ 1.1;
142 tRes
.tested("setMax()", result
);
146 * Just calls the method and stores value returned. <p>
147 * Has <b>OK</b> status if no runtime exceptions occured.
149 public void _getMax() {
151 boolean result
= true;
154 tRes
.tested("getMax()", result
);
158 * Sets value changed and then compares it to get value. <p>
159 * Has <b>OK</b> status if set and get values are equal.
160 * The following method tests are to be completed successfully before :
162 * <li> <code> getFirst </code> </li>
165 public void _setFirst() {
166 requiredMethod("getFirst()");
168 boolean result
= true;
169 oObj
.setFirst(first
+ 1.1);
170 double ret
= oObj
.getFirst();
171 result
= ret
== first
+ 1.1;
173 tRes
.tested("setFirst()", result
);
177 * Just calls the method and stores value returned. <p>
178 * Has <b>OK</b> status if no runtime exceptions occured.
180 public void _getFirst() {
182 boolean result
= true;
183 first
= oObj
.getFirst();
185 tRes
.tested("getFirst()", result
);
189 * Sets value changed and then compares it to get value. <p>
190 * Has <b>OK</b> status if set and get values are equal.
191 * The following method tests are to be completed successfully before :
193 * <li> <code> getLast </code> </li>
196 public void _setLast() {
197 requiredMethod("getLast()");
199 boolean result
= true;
200 oObj
.setLast(last
+ 1.1);
201 double ret
= oObj
.getLast();
203 result
= ret
== last
+ 1.1;
205 tRes
.tested("setLast()", result
);
209 * Just calls the method and stores value returned. <p>
210 * Has <b>OK</b> status if no runtime exceptions occured.
212 public void _getLast() {
214 boolean result
= true;
215 last
= oObj
.getLast();
217 tRes
.tested("getLast()", result
);
221 * Sets value changed and then compares it to get value. <p>
222 * Has <b>OK</b> status if set and get values are equal.
223 * The following method tests are to be completed successfully before :
225 * <li> <code> getSpinSize </code> </li>
228 public void _setSpinSize() {
229 requiredMethod("getSpinSize()");
231 boolean result
= true;
232 oObj
.setSpinSize(spin
+ 1.1);
233 result
= oObj
.getSpinSize() == spin
+ 1.1;
235 tRes
.tested("setSpinSize()", result
);
239 * Just calls the method and stores value returned. <p>
240 * Has <b>OK</b> status if no runtime exceptions occured.
242 public void _getSpinSize() {
244 boolean result
= true;
245 spin
= oObj
.getSpinSize();
247 tRes
.tested("getSpinSize()", result
);
251 * Sets value changed and then compares it to get value. <p>
252 * Has <b>OK</b> status if set and get values are equal.
253 * The following method tests are to be completed successfully before :
255 * <li> <code> getDecimalDigits </code> </li>
258 public void _setDecimalDigits() {
259 requiredMethod("getDecimalDigits()");
261 boolean result
= true;
262 oObj
.setDecimalDigits((short) (digits
+ 1));
264 short res
= oObj
.getDecimalDigits();
265 result
= res
== ((short) digits
+ 1);
267 tRes
.tested("setDecimalDigits()", result
);
271 * Just calls the method and stores value returned. <p>
272 * Has <b>OK</b> status if no runtime exceptions occured.
274 public void _getDecimalDigits() {
276 boolean result
= true;
277 digits
= oObj
.getDecimalDigits();
279 tRes
.tested("getDecimalDigits()", result
);
283 * Sets value changed and then compares it to get value. <p>
284 * Has <b>OK</b> status if set and get values are equal.
285 * The following method tests are to be completed successfully before :
287 * <li> <code> isStrictFormat </code> </li>
290 public void _setStrictFormat() {
291 requiredMethod("isStrictFormat()");
293 boolean result
= true;
294 oObj
.setStrictFormat(!strict
);
295 result
= oObj
.isStrictFormat() == !strict
;
297 tRes
.tested("setStrictFormat()", result
);
301 * Just calls the method and stores value returned. <p>
302 * Has <b>OK</b> status if no runtime exceptions occured.
304 public void _isStrictFormat() {
306 boolean result
= true;
307 strict
= oObj
.isStrictFormat();
309 tRes
.tested("isStrictFormat()", result
);