2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 import lib
.MultiMethodTest
;
23 import com
.sun
.star
.awt
.XCurrencyField
;
27 * Testing <code>com.sun.star.awt.XCurrencyField</code>
30 * <li><code> setValue()</code></li>
31 * <li><code> getValue()</code></li>
32 * <li><code> setMin()</code></li>
33 * <li><code> getMin()</code></li>
34 * <li><code> setMax()</code></li>
35 * <li><code> getMax()</code></li>
36 * <li><code> setFirst()</code></li>
37 * <li><code> getFirst()</code></li>
38 * <li><code> setLast()</code></li>
39 * <li><code> getLast()</code></li>
40 * <li><code> setSpinSize()</code></li>
41 * <li><code> getSpinSize()</code></li>
42 * <li><code> setDecimalDigits()</code></li>
43 * <li><code> getDecimalDigits()</code></li>
44 * <li><code> setStrictFormat()</code></li>
45 * <li><code> isStrictFormat()</code></li>
47 * Test is <b> NOT </b> multithread compliant. <p>
48 * @see com.sun.star.awt.XCurrencyField
50 public class _XCurrencyField
extends MultiMethodTest
{
52 public XCurrencyField oObj
= null;
53 private double val
= 0;
54 private double min
= 0;
55 private double max
= 0;
56 private double first
= 0;
57 private double last
= 0;
58 private double spin
= 0;
59 private short digits
= 0;
60 private boolean strict
= true;
63 * Sets value changed and then compares it to get value. <p>
64 * Has <b>OK</b> status if set and get values are equal.
65 * The following method tests are to be completed successfully before :
67 * <li> <code> getValue </code> </li>
70 public void _setValue() {
71 requiredMethod("getValue()");
73 double value
= val
+ 1.1;
75 double ret
= oObj
.getValue();
76 boolean result
= utils
.approxEqual(ret
, value
);
78 tRes
.tested("setValue()", result
);
82 * Just calls the method and stores value returned. <p>
83 * Has <b>OK</b> status if no runtime exceptions occurred.
85 public void _getValue() {
86 val
= oObj
.getValue();
88 tRes
.tested("getValue()", true);
92 * Sets minimal value changed and then compares it to get value. <p>
93 * Has <b>OK</b> status if set and get values are equal.
94 * The following method tests are to be completed successfully before :
96 * <li> <code> getMin </code> </li>
99 public void _setMin() {
100 requiredMethod("getMin()");
102 double value
= min
+ 1.1;
104 double ret
= oObj
.getMin();
105 boolean result
= utils
.approxEqual(ret
, value
);
107 tRes
.tested("setMin()", result
);
111 * Just calls the method and stores value returned. <p>
112 * Has <b>OK</b> status if no runtime exceptions occurred.
114 public void _getMin() {
116 boolean result
= true;
119 tRes
.tested("getMin()", result
);
123 * Sets maximal value changed and then compares it to get value. <p>
124 * Has <b>OK</b> status if set and get values are equal.
125 * The following method tests are to be completed successfully before :
127 * <li> <code> getMax </code> </li>
130 public void _setMax() {
131 requiredMethod("getMax()");
133 double value
= max
+ 1.1;
135 double ret
= oObj
.getMax();
136 boolean result
= utils
.approxEqual(ret
, value
);
138 tRes
.tested("setMax()", result
);
142 * Just calls the method and stores value returned. <p>
143 * Has <b>OK</b> status if no runtime exceptions occurred.
145 public void _getMax() {
147 boolean result
= true;
150 tRes
.tested("getMax()", result
);
154 * Sets value changed and then compares it to get value. <p>
155 * Has <b>OK</b> status if set and get values are equal.
156 * The following method tests are to be completed successfully before :
158 * <li> <code> getFirst </code> </li>
161 public void _setFirst() {
162 requiredMethod("getFirst()");
164 double value
= first
+ 1.1;
165 oObj
.setFirst(value
);
166 double ret
= oObj
.getFirst();
167 boolean result
= utils
.approxEqual(ret
, value
);
169 tRes
.tested("setFirst()", result
);
173 * Just calls the method and stores value returned. <p>
174 * Has <b>OK</b> status if no runtime exceptions occurred.
176 public void _getFirst() {
178 boolean result
= true;
179 first
= oObj
.getFirst();
181 tRes
.tested("getFirst()", result
);
185 * Sets value changed and then compares it to get value. <p>
186 * Has <b>OK</b> status if set and get values are equal.
187 * The following method tests are to be completed successfully before :
189 * <li> <code> getLast </code> </li>
192 public void _setLast() {
193 requiredMethod("getLast()");
195 double value
= last
+ 1.1;
197 double ret
= oObj
.getLast();
198 boolean result
= utils
.approxEqual(ret
, value
);
200 tRes
.tested("setLast()", result
);
204 * Just calls the method and stores value returned. <p>
205 * Has <b>OK</b> status if no runtime exceptions occurred.
207 public void _getLast() {
209 boolean result
= true;
210 last
= oObj
.getLast();
212 tRes
.tested("getLast()", result
);
216 * Sets value changed and then compares it to get value. <p>
217 * Has <b>OK</b> status if set and get values are equal.
218 * The following method tests are to be completed successfully before :
220 * <li> <code> getSpinSize </code> </li>
223 public void _setSpinSize() {
224 requiredMethod("getSpinSize()");
226 double value
= spin
+ 1.1;
227 oObj
.setSpinSize(value
);
228 double ret
= oObj
.getSpinSize();
229 boolean result
= utils
.approxEqual(ret
, value
);
231 tRes
.tested("setSpinSize()", result
);
235 * Just calls the method and stores value returned. <p>
236 * Has <b>OK</b> status if no runtime exceptions occurred.
238 public void _getSpinSize() {
240 boolean result
= true;
241 spin
= oObj
.getSpinSize();
243 tRes
.tested("getSpinSize()", result
);
247 * Sets value changed and then compares it to get value. <p>
248 * Has <b>OK</b> status if set and get values are equal.
249 * The following method tests are to be completed successfully before :
251 * <li> <code> getDecimalDigits </code> </li>
254 public void _setDecimalDigits() {
255 requiredMethod("getDecimalDigits()");
257 boolean result
= true;
258 oObj
.setDecimalDigits((short) (digits
+ 1));
260 short res
= oObj
.getDecimalDigits();
261 result
= res
== (digits
+ 1);
263 tRes
.tested("setDecimalDigits()", result
);
267 * Just calls the method and stores value returned. <p>
268 * Has <b>OK</b> status if no runtime exceptions occurred.
270 public void _getDecimalDigits() {
272 boolean result
= true;
273 digits
= oObj
.getDecimalDigits();
275 tRes
.tested("getDecimalDigits()", result
);
279 * Sets value changed and then compares it to get value. <p>
280 * Has <b>OK</b> status if set and get values are equal.
281 * The following method tests are to be completed successfully before :
283 * <li> <code> isStrictFormat </code> </li>
286 public void _setStrictFormat() {
287 requiredMethod("isStrictFormat()");
289 boolean result
= true;
290 oObj
.setStrictFormat(!strict
);
291 result
= oObj
.isStrictFormat() == !strict
;
293 tRes
.tested("setStrictFormat()", result
);
297 * Just calls the method and stores value returned. <p>
298 * Has <b>OK</b> status if no runtime exceptions occurred.
300 public void _isStrictFormat() {
302 boolean result
= true;
303 strict
= oObj
.isStrictFormat();
305 tRes
.tested("isStrictFormat()", result
);