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
;
26 * Testing <code>com.sun.star.awt.XCurrencyField</code>
29 * <li><code> setValue()</code></li>
30 * <li><code> getValue()</code></li>
31 * <li><code> setMin()</code></li>
32 * <li><code> getMin()</code></li>
33 * <li><code> setMax()</code></li>
34 * <li><code> getMax()</code></li>
35 * <li><code> setFirst()</code></li>
36 * <li><code> getFirst()</code></li>
37 * <li><code> setLast()</code></li>
38 * <li><code> getLast()</code></li>
39 * <li><code> setSpinSize()</code></li>
40 * <li><code> getSpinSize()</code></li>
41 * <li><code> setDecimalDigits()</code></li>
42 * <li><code> getDecimalDigits()</code></li>
43 * <li><code> setStrictFormat()</code></li>
44 * <li><code> isStrictFormat()</code></li>
46 * Test is <b> NOT </b> multithread compliant. <p>
47 * @see com.sun.star.awt.XCurrencyField
49 public class _XCurrencyField
extends MultiMethodTest
{
51 public XCurrencyField oObj
= null;
52 private double val
= 0;
53 private double min
= 0;
54 private double max
= 0;
55 private double first
= 0;
56 private double last
= 0;
57 private double spin
= 0;
58 private short digits
= 0;
59 private boolean strict
= true;
62 * Sets value changed and then compares it to get value. <p>
63 * Has <b>OK</b> status if set and get values are equal.
64 * The following method tests are to be completed successfully before :
66 * <li> <code> getValue </code> </li>
69 public void _setValue() {
70 requiredMethod("getValue()");
72 oObj
.setValue(val
+ 1.1);
74 tRes
.tested("setValue()", oObj
.getValue() == val
+ 1.1);
78 * Just calls the method and stores value returned. <p>
79 * Has <b>OK</b> status if no runtime exceptions occurred.
81 public void _getValue() {
82 val
= oObj
.getValue();
84 tRes
.tested("getValue()", true);
88 * Sets minimal value changed and then compares it to get value. <p>
89 * Has <b>OK</b> status if set and get values are equal.
90 * The following method tests are to be completed successfully before :
92 * <li> <code> getMin </code> </li>
95 public void _setMin() {
96 requiredMethod("getMin()");
98 oObj
.setMin(min
+ 1.1);
100 tRes
.tested("setMin()", oObj
.getMin() == min
+ 1.1);
104 * Just calls the method and stores value returned. <p>
105 * Has <b>OK</b> status if no runtime exceptions occurred.
107 public void _getMin() {
109 boolean result
= true;
112 tRes
.tested("getMin()", result
);
116 * Sets maximal value changed and then compares it to get value. <p>
117 * Has <b>OK</b> status if set and get values are equal.
118 * The following method tests are to be completed successfully before :
120 * <li> <code> getMax </code> </li>
123 public void _setMax() {
124 requiredMethod("getMax()");
126 boolean result
= true;
127 oObj
.setMax(max
+ 1.1);
128 result
= oObj
.getMax() == max
+ 1.1;
130 tRes
.tested("setMax()", result
);
134 * Just calls the method and stores value returned. <p>
135 * Has <b>OK</b> status if no runtime exceptions occurred.
137 public void _getMax() {
139 boolean result
= true;
142 tRes
.tested("getMax()", result
);
146 * Sets value changed and then compares it to get value. <p>
147 * Has <b>OK</b> status if set and get values are equal.
148 * The following method tests are to be completed successfully before :
150 * <li> <code> getFirst </code> </li>
153 public void _setFirst() {
154 requiredMethod("getFirst()");
156 boolean result
= true;
157 oObj
.setFirst(first
+ 1.1);
158 double ret
= oObj
.getFirst();
159 result
= ret
== first
+ 1.1;
161 tRes
.tested("setFirst()", result
);
165 * Just calls the method and stores value returned. <p>
166 * Has <b>OK</b> status if no runtime exceptions occurred.
168 public void _getFirst() {
170 boolean result
= true;
171 first
= oObj
.getFirst();
173 tRes
.tested("getFirst()", result
);
177 * Sets value changed and then compares it to get value. <p>
178 * Has <b>OK</b> status if set and get values are equal.
179 * The following method tests are to be completed successfully before :
181 * <li> <code> getLast </code> </li>
184 public void _setLast() {
185 requiredMethod("getLast()");
187 boolean result
= true;
188 oObj
.setLast(last
+ 1.1);
189 double ret
= oObj
.getLast();
191 result
= ret
== last
+ 1.1;
193 tRes
.tested("setLast()", result
);
197 * Just calls the method and stores value returned. <p>
198 * Has <b>OK</b> status if no runtime exceptions occurred.
200 public void _getLast() {
202 boolean result
= true;
203 last
= oObj
.getLast();
205 tRes
.tested("getLast()", result
);
209 * Sets value changed and then compares it to get value. <p>
210 * Has <b>OK</b> status if set and get values are equal.
211 * The following method tests are to be completed successfully before :
213 * <li> <code> getSpinSize </code> </li>
216 public void _setSpinSize() {
217 requiredMethod("getSpinSize()");
219 boolean result
= true;
220 oObj
.setSpinSize(spin
+ 1.1);
221 result
= oObj
.getSpinSize() == spin
+ 1.1;
223 tRes
.tested("setSpinSize()", result
);
227 * Just calls the method and stores value returned. <p>
228 * Has <b>OK</b> status if no runtime exceptions occurred.
230 public void _getSpinSize() {
232 boolean result
= true;
233 spin
= oObj
.getSpinSize();
235 tRes
.tested("getSpinSize()", result
);
239 * Sets value changed and then compares it to get value. <p>
240 * Has <b>OK</b> status if set and get values are equal.
241 * The following method tests are to be completed successfully before :
243 * <li> <code> getDecimalDigits </code> </li>
246 public void _setDecimalDigits() {
247 requiredMethod("getDecimalDigits()");
249 boolean result
= true;
250 oObj
.setDecimalDigits((short) (digits
+ 1));
252 short res
= oObj
.getDecimalDigits();
253 result
= res
== (digits
+ 1);
255 tRes
.tested("setDecimalDigits()", result
);
259 * Just calls the method and stores value returned. <p>
260 * Has <b>OK</b> status if no runtime exceptions occurred.
262 public void _getDecimalDigits() {
264 boolean result
= true;
265 digits
= oObj
.getDecimalDigits();
267 tRes
.tested("getDecimalDigits()", result
);
271 * Sets value changed and then compares it to get value. <p>
272 * Has <b>OK</b> status if set and get values are equal.
273 * The following method tests are to be completed successfully before :
275 * <li> <code> isStrictFormat </code> </li>
278 public void _setStrictFormat() {
279 requiredMethod("isStrictFormat()");
281 boolean result
= true;
282 oObj
.setStrictFormat(!strict
);
283 result
= oObj
.isStrictFormat() == !strict
;
285 tRes
.tested("setStrictFormat()", result
);
289 * Just calls the method and stores value returned. <p>
290 * Has <b>OK</b> status if no runtime exceptions occurred.
292 public void _isStrictFormat() {
294 boolean result
= true;
295 strict
= oObj
.isStrictFormat();
297 tRes
.tested("isStrictFormat()", result
);