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 .
22 import lib
.MultiMethodTest
;
24 import com
.sun
.star
.awt
.XNumericField
;
27 * Testing <code>com.sun.star.awt.XNumericField</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.XNumericField
50 public class _XNumericField
extends MultiMethodTest
{
52 public XNumericField 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 oObj
.setValue(val
+ 1.1) ;
75 tRes
.tested("setValue()", oObj
.getValue() == val
+ 1.1) ;
79 * Just calls the method and stores value returned. <p>
80 * Has <b>OK</b> status if no runtime exceptions occurred.
82 public void _getValue() {
83 val
= oObj
.getValue() ;
85 tRes
.tested("getValue()", true) ;
89 * Sets minimal value changed and then compares it to get value. <p>
90 * Has <b>OK</b> status if set and get values are equal.
91 * The following method tests are to be completed successfully before :
93 * <li> <code> getMin </code> </li>
96 public void _setMin() {
97 requiredMethod("getMin()") ;
99 oObj
.setMin(min
+ 1.1) ;
101 tRes
.tested("setMin()", oObj
.getMin() == min
+ 1.1) ;
105 * Just calls the method and stores value returned. <p>
106 * Has <b>OK</b> status if no runtime exceptions occurred.
108 public void _getMin() {
110 boolean result
= true ;
111 min
= oObj
.getMin() ;
113 tRes
.tested("getMin()", result
) ;
117 * Sets maximal value changed and then compares it to get value. <p>
118 * Has <b>OK</b> status if set and get values are equal.
119 * The following method tests are to be completed successfully before :
121 * <li> <code> getMax </code> </li>
124 public void _setMax() {
125 requiredMethod("getMax()") ;
127 boolean result
= true ;
128 oObj
.setMax(max
+ 1.1) ;
129 result
= oObj
.getMax() == max
+ 1.1 ;
131 tRes
.tested("setMax()", result
) ;
135 * Just calls the method and stores value returned. <p>
136 * Has <b>OK</b> status if no runtime exceptions occurred.
138 public void _getMax() {
140 boolean result
= true ;
141 max
= oObj
.getMax() ;
143 tRes
.tested("getMax()", result
) ;
147 * Sets value changed and then compares it to get value. <p>
148 * Has <b>OK</b> status if set and get values are equal.
149 * The following method tests are to be completed successfully before :
151 * <li> <code> getFirst </code> </li>
154 public void _setFirst() {
155 requiredMethod("getFirst()") ;
157 boolean result
= true ;
158 oObj
.setFirst(first
+ 1.1) ;
159 double ret
= oObj
.getFirst() ;
160 result
= ret
== first
+ 1.1 ;
162 tRes
.tested("setFirst()", result
) ;
166 * Just calls the method and stores value returned. <p>
167 * Has <b>OK</b> status if no runtime exceptions occurred.
169 public void _getFirst() {
171 boolean result
= true ;
172 first
= oObj
.getFirst() ;
174 tRes
.tested("getFirst()", result
) ;
178 * Sets value changed and then compares it to get value. <p>
179 * Has <b>OK</b> status if set and get values are equal.
180 * The following method tests are to be completed successfully before :
182 * <li> <code> getLast </code> </li>
185 public void _setLast() {
186 requiredMethod("getLast()") ;
188 boolean result
= true ;
189 oObj
.setLast(last
+ 1.1) ;
190 double ret
= oObj
.getLast() ;
192 result
= ret
== last
+ 1.1 ;
194 tRes
.tested("setLast()", result
) ;
198 * Just calls the method and stores value returned. <p>
199 * Has <b>OK</b> status if no runtime exceptions occurred.
201 public void _getLast() {
203 boolean result
= true ;
204 last
= oObj
.getLast() ;
206 tRes
.tested("getLast()", result
) ;
210 * Sets value changed and then compares it to get value. <p>
211 * Has <b>OK</b> status if set and get values are equal.
212 * The following method tests are to be completed successfully before :
214 * <li> <code> getSpinSize </code> </li>
217 public void _setSpinSize() {
218 requiredMethod("getSpinSize()") ;
220 boolean result
= true ;
221 oObj
.setSpinSize(spin
+ 1.1) ;
222 result
= oObj
.getSpinSize() == spin
+ 1.1 ;
224 tRes
.tested("setSpinSize()", result
) ;
228 * Just calls the method and stores value returned. <p>
229 * Has <b>OK</b> status if no runtime exceptions occurred.
231 public void _getSpinSize() {
233 boolean result
= true ;
234 spin
= oObj
.getSpinSize() ;
236 tRes
.tested("getSpinSize()", result
) ;
240 * Sets value changed and then compares it to get value. <p>
241 * Has <b>OK</b> status if set and get values are equal.
242 * The following method tests are to be completed successfully before :
244 * <li> <code> getDecimalDigits </code> </li>
247 public void _setDecimalDigits() {
248 requiredMethod("getDecimalDigits()") ;
250 boolean result
= true ;
251 oObj
.setDecimalDigits((short)(digits
+ 1)) ;
253 short res
= oObj
.getDecimalDigits() ;
254 result
= res
== (digits
+ 1) ;
256 tRes
.tested("setDecimalDigits()", result
) ;
260 * Just calls the method and stores value returned. <p>
261 * Has <b>OK</b> status if no runtime exceptions occurred.
263 public void _getDecimalDigits() {
265 boolean result
= true ;
266 digits
= oObj
.getDecimalDigits() ;
268 tRes
.tested("getDecimalDigits()", result
) ;
272 * Sets value changed and then compares it to get value. <p>
273 * Has <b>OK</b> status if set and get values are equal.
274 * The following method tests are to be completed successfully before :
276 * <li> <code> isStrictFormat </code> </li>
279 public void _setStrictFormat() {
280 requiredMethod("isStrictFormat()") ;
282 boolean result
= true ;
283 oObj
.setStrictFormat(!strict
) ;
284 result
= oObj
.isStrictFormat() == !strict
;
286 tRes
.tested("setStrictFormat()", result
) ;
290 * Just calls the method and stores value returned. <p>
291 * Has <b>OK</b> status if no runtime exceptions occurred.
293 public void _isStrictFormat() {
295 boolean result
= true ;
296 strict
= oObj
.isStrictFormat() ;
298 tRes
.tested("isStrictFormat()", result
) ;