xref: /AOO41X/main/qadevOOo/tests/java/ifc/awt/_XCurrencyField.java (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir package ifc.awt;
29*cdf0e10cSrcweir 
30*cdf0e10cSrcweir import lib.MultiMethodTest;
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir import com.sun.star.awt.XCurrencyField;
33*cdf0e10cSrcweir 
34*cdf0e10cSrcweir /**
35*cdf0e10cSrcweir * Testing <code>com.sun.star.awt.XCurrencyField</code>
36*cdf0e10cSrcweir * interface methods :
37*cdf0e10cSrcweir * <ul>
38*cdf0e10cSrcweir *  <li><code> setValue()</code></li>
39*cdf0e10cSrcweir *  <li><code> getValue()</code></li>
40*cdf0e10cSrcweir *  <li><code> setMin()</code></li>
41*cdf0e10cSrcweir *  <li><code> getMin()</code></li>
42*cdf0e10cSrcweir *  <li><code> setMax()</code></li>
43*cdf0e10cSrcweir *  <li><code> getMax()</code></li>
44*cdf0e10cSrcweir *  <li><code> setFirst()</code></li>
45*cdf0e10cSrcweir *  <li><code> getFirst()</code></li>
46*cdf0e10cSrcweir *  <li><code> setLast()</code></li>
47*cdf0e10cSrcweir *  <li><code> getLast()</code></li>
48*cdf0e10cSrcweir *  <li><code> setSpinSize()</code></li>
49*cdf0e10cSrcweir *  <li><code> getSpinSize()</code></li>
50*cdf0e10cSrcweir *  <li><code> setDecimalDigits()</code></li>
51*cdf0e10cSrcweir *  <li><code> getDecimalDigits()</code></li>
52*cdf0e10cSrcweir *  <li><code> setStrictFormat()</code></li>
53*cdf0e10cSrcweir *  <li><code> isStrictFormat()</code></li>
54*cdf0e10cSrcweir * </ul> <p>
55*cdf0e10cSrcweir * Test is <b> NOT </b> multithread compilant. <p>
56*cdf0e10cSrcweir * @see com.sun.star.awt.XCurrencyField
57*cdf0e10cSrcweir */
58*cdf0e10cSrcweir public class _XCurrencyField extends MultiMethodTest {
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir 	public XCurrencyField oObj = null;
61*cdf0e10cSrcweir 	private double val = 0;
62*cdf0e10cSrcweir 	private double min = 0;
63*cdf0e10cSrcweir 	private double max = 0;
64*cdf0e10cSrcweir 	private double first = 0;
65*cdf0e10cSrcweir 	private double last = 0;
66*cdf0e10cSrcweir 	private double spin = 0;
67*cdf0e10cSrcweir 	private short digits = 0;
68*cdf0e10cSrcweir 	private boolean strict = true;
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir 	/**
71*cdf0e10cSrcweir 	* Sets value changed and then compares it to get value. <p>
72*cdf0e10cSrcweir 	* Has <b>OK</b> status if set and get values are equal.
73*cdf0e10cSrcweir 	* The following method tests are to be completed successfully before :
74*cdf0e10cSrcweir 	* <ul>
75*cdf0e10cSrcweir 	*  <li> <code> getValue </code>  </li>
76*cdf0e10cSrcweir 	* </ul>
77*cdf0e10cSrcweir 	*/
78*cdf0e10cSrcweir 	public void _setValue() {
79*cdf0e10cSrcweir 		requiredMethod("getValue()");
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir 		oObj.setValue(val + 1.1);
82*cdf0e10cSrcweir 
83*cdf0e10cSrcweir 		tRes.tested("setValue()", oObj.getValue() == val + 1.1);
84*cdf0e10cSrcweir 	}
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir 	/**
87*cdf0e10cSrcweir 	* Just calls the method and stores value returned. <p>
88*cdf0e10cSrcweir 	* Has <b>OK</b> status if no runtime exceptions occured.
89*cdf0e10cSrcweir 	*/
90*cdf0e10cSrcweir 	public void _getValue() {
91*cdf0e10cSrcweir 		val = oObj.getValue();
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir 		tRes.tested("getValue()", true);
94*cdf0e10cSrcweir 	}
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir 	/**
97*cdf0e10cSrcweir 	* Sets minimal value changed and then compares it to get value. <p>
98*cdf0e10cSrcweir 	* Has <b>OK</b> status if set and get values are equal.
99*cdf0e10cSrcweir 	* The following method tests are to be completed successfully before :
100*cdf0e10cSrcweir 	* <ul>
101*cdf0e10cSrcweir 	*  <li> <code> getMin </code>  </li>
102*cdf0e10cSrcweir 	* </ul>
103*cdf0e10cSrcweir 	*/
104*cdf0e10cSrcweir 	public void _setMin() {
105*cdf0e10cSrcweir 		requiredMethod("getMin()");
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir 		oObj.setMin(min + 1.1);
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir 		tRes.tested("setMin()", oObj.getMin() == min + 1.1);
110*cdf0e10cSrcweir 	}
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir 	/**
113*cdf0e10cSrcweir 	* Just calls the method and stores value returned. <p>
114*cdf0e10cSrcweir 	* Has <b>OK</b> status if no runtime exceptions occured.
115*cdf0e10cSrcweir 	*/
116*cdf0e10cSrcweir 	public void _getMin() {
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir 		boolean result = true;
119*cdf0e10cSrcweir 		min = oObj.getMin();
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir 		tRes.tested("getMin()", result);
122*cdf0e10cSrcweir 	}
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir 	/**
125*cdf0e10cSrcweir 	* Sets maximal value changed and then compares it to get value. <p>
126*cdf0e10cSrcweir 	* Has <b>OK</b> status if set and get values are equal.
127*cdf0e10cSrcweir 	* The following method tests are to be completed successfully before :
128*cdf0e10cSrcweir 	* <ul>
129*cdf0e10cSrcweir 	*  <li> <code> getMax </code>  </li>
130*cdf0e10cSrcweir 	* </ul>
131*cdf0e10cSrcweir 	*/
132*cdf0e10cSrcweir 	public void _setMax() {
133*cdf0e10cSrcweir 		requiredMethod("getMax()");
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir 		boolean result = true;
136*cdf0e10cSrcweir 		oObj.setMax(max + 1.1);
137*cdf0e10cSrcweir 		result = oObj.getMax() == max + 1.1;
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir 		tRes.tested("setMax()", result);
140*cdf0e10cSrcweir 	}
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir 	/**
143*cdf0e10cSrcweir 	* Just calls the method and stores value returned. <p>
144*cdf0e10cSrcweir 	* Has <b>OK</b> status if no runtime exceptions occured.
145*cdf0e10cSrcweir 	*/
146*cdf0e10cSrcweir 	public void _getMax() {
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir 		boolean result = true;
149*cdf0e10cSrcweir 		max = oObj.getMax();
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir 		tRes.tested("getMax()", result);
152*cdf0e10cSrcweir 	}
153*cdf0e10cSrcweir 
154*cdf0e10cSrcweir 	/**
155*cdf0e10cSrcweir 	* Sets value changed and then compares it to get value. <p>
156*cdf0e10cSrcweir 	* Has <b>OK</b> status if set and get values are equal.
157*cdf0e10cSrcweir 	* The following method tests are to be completed successfully before :
158*cdf0e10cSrcweir 	* <ul>
159*cdf0e10cSrcweir 	*  <li> <code> getFirst </code>  </li>
160*cdf0e10cSrcweir 	* </ul>
161*cdf0e10cSrcweir 	*/
162*cdf0e10cSrcweir 	public void _setFirst() {
163*cdf0e10cSrcweir 		requiredMethod("getFirst()");
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir 		boolean result = true;
166*cdf0e10cSrcweir 		oObj.setFirst(first + 1.1);
167*cdf0e10cSrcweir 		double ret = oObj.getFirst();
168*cdf0e10cSrcweir 		result = ret == first + 1.1;
169*cdf0e10cSrcweir 
170*cdf0e10cSrcweir 		tRes.tested("setFirst()", result);
171*cdf0e10cSrcweir 	}
172*cdf0e10cSrcweir 
173*cdf0e10cSrcweir 	/**
174*cdf0e10cSrcweir 	* Just calls the method and stores value returned. <p>
175*cdf0e10cSrcweir 	* Has <b>OK</b> status if no runtime exceptions occured.
176*cdf0e10cSrcweir 	*/
177*cdf0e10cSrcweir 	public void _getFirst() {
178*cdf0e10cSrcweir 
179*cdf0e10cSrcweir 		boolean result = true;
180*cdf0e10cSrcweir 		first = oObj.getFirst();
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir 		tRes.tested("getFirst()", result);
183*cdf0e10cSrcweir 	}
184*cdf0e10cSrcweir 
185*cdf0e10cSrcweir 	/**
186*cdf0e10cSrcweir 	* Sets value changed and then compares it to get value. <p>
187*cdf0e10cSrcweir 	* Has <b>OK</b> status if set and get values are equal.
188*cdf0e10cSrcweir 	* The following method tests are to be completed successfully before :
189*cdf0e10cSrcweir 	* <ul>
190*cdf0e10cSrcweir 	*  <li> <code> getLast </code>  </li>
191*cdf0e10cSrcweir 	* </ul>
192*cdf0e10cSrcweir 	*/
193*cdf0e10cSrcweir 	public void _setLast() {
194*cdf0e10cSrcweir 		requiredMethod("getLast()");
195*cdf0e10cSrcweir 
196*cdf0e10cSrcweir 		boolean result = true;
197*cdf0e10cSrcweir 		oObj.setLast(last + 1.1);
198*cdf0e10cSrcweir 		double ret = oObj.getLast();
199*cdf0e10cSrcweir 
200*cdf0e10cSrcweir 		result = ret == last + 1.1;
201*cdf0e10cSrcweir 
202*cdf0e10cSrcweir 		tRes.tested("setLast()", result);
203*cdf0e10cSrcweir 	}
204*cdf0e10cSrcweir 
205*cdf0e10cSrcweir 	/**
206*cdf0e10cSrcweir 	* Just calls the method and stores value returned. <p>
207*cdf0e10cSrcweir 	* Has <b>OK</b> status if no runtime exceptions occured.
208*cdf0e10cSrcweir 	*/
209*cdf0e10cSrcweir 	public void _getLast() {
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir 		boolean result = true;
212*cdf0e10cSrcweir 		last = oObj.getLast();
213*cdf0e10cSrcweir 
214*cdf0e10cSrcweir 		tRes.tested("getLast()", result);
215*cdf0e10cSrcweir 	}
216*cdf0e10cSrcweir 
217*cdf0e10cSrcweir 	/**
218*cdf0e10cSrcweir 	* Sets value changed and then compares it to get value. <p>
219*cdf0e10cSrcweir 	* Has <b>OK</b> status if set and get values are equal.
220*cdf0e10cSrcweir 	* The following method tests are to be completed successfully before :
221*cdf0e10cSrcweir 	* <ul>
222*cdf0e10cSrcweir 	*  <li> <code> getSpinSize </code>  </li>
223*cdf0e10cSrcweir 	* </ul>
224*cdf0e10cSrcweir 	*/
225*cdf0e10cSrcweir 	public void _setSpinSize() {
226*cdf0e10cSrcweir 		requiredMethod("getSpinSize()");
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir 		boolean result = true;
229*cdf0e10cSrcweir 		oObj.setSpinSize(spin + 1.1);
230*cdf0e10cSrcweir 		result = oObj.getSpinSize() == spin + 1.1;
231*cdf0e10cSrcweir 
232*cdf0e10cSrcweir 		tRes.tested("setSpinSize()", result);
233*cdf0e10cSrcweir 	}
234*cdf0e10cSrcweir 
235*cdf0e10cSrcweir 	/**
236*cdf0e10cSrcweir 	* Just calls the method and stores value returned. <p>
237*cdf0e10cSrcweir 	* Has <b>OK</b> status if no runtime exceptions occured.
238*cdf0e10cSrcweir 	*/
239*cdf0e10cSrcweir 	public void _getSpinSize() {
240*cdf0e10cSrcweir 
241*cdf0e10cSrcweir 		boolean result = true;
242*cdf0e10cSrcweir 		spin = oObj.getSpinSize();
243*cdf0e10cSrcweir 
244*cdf0e10cSrcweir 		tRes.tested("getSpinSize()", result);
245*cdf0e10cSrcweir 	}
246*cdf0e10cSrcweir 
247*cdf0e10cSrcweir 	/**
248*cdf0e10cSrcweir 	* Sets value changed and then compares it to get value. <p>
249*cdf0e10cSrcweir 	* Has <b>OK</b> status if set and get values are equal.
250*cdf0e10cSrcweir 	* The following method tests are to be completed successfully before :
251*cdf0e10cSrcweir 	* <ul>
252*cdf0e10cSrcweir 	*  <li> <code> getDecimalDigits </code>  </li>
253*cdf0e10cSrcweir 	* </ul>
254*cdf0e10cSrcweir 	*/
255*cdf0e10cSrcweir 	public void _setDecimalDigits() {
256*cdf0e10cSrcweir 		requiredMethod("getDecimalDigits()");
257*cdf0e10cSrcweir 
258*cdf0e10cSrcweir 		boolean result = true;
259*cdf0e10cSrcweir 		oObj.setDecimalDigits((short) (digits + 1));
260*cdf0e10cSrcweir 
261*cdf0e10cSrcweir 		short res = oObj.getDecimalDigits();
262*cdf0e10cSrcweir 		result = res == ((short) digits + 1);
263*cdf0e10cSrcweir 
264*cdf0e10cSrcweir 		tRes.tested("setDecimalDigits()", result);
265*cdf0e10cSrcweir 	}
266*cdf0e10cSrcweir 
267*cdf0e10cSrcweir 	/**
268*cdf0e10cSrcweir 	* Just calls the method and stores value returned. <p>
269*cdf0e10cSrcweir 	* Has <b>OK</b> status if no runtime exceptions occured.
270*cdf0e10cSrcweir 	*/
271*cdf0e10cSrcweir 	public void _getDecimalDigits() {
272*cdf0e10cSrcweir 
273*cdf0e10cSrcweir 		boolean result = true;
274*cdf0e10cSrcweir 		digits = oObj.getDecimalDigits();
275*cdf0e10cSrcweir 
276*cdf0e10cSrcweir 		tRes.tested("getDecimalDigits()", result);
277*cdf0e10cSrcweir 	}
278*cdf0e10cSrcweir 
279*cdf0e10cSrcweir 	/**
280*cdf0e10cSrcweir 	* Sets value changed and then compares it to get value. <p>
281*cdf0e10cSrcweir 	* Has <b>OK</b> status if set and get values are equal.
282*cdf0e10cSrcweir 	* The following method tests are to be completed successfully before :
283*cdf0e10cSrcweir 	* <ul>
284*cdf0e10cSrcweir 	*  <li> <code> isStrictFormat </code>  </li>
285*cdf0e10cSrcweir 	* </ul>
286*cdf0e10cSrcweir 	*/
287*cdf0e10cSrcweir 	public void _setStrictFormat() {
288*cdf0e10cSrcweir 		requiredMethod("isStrictFormat()");
289*cdf0e10cSrcweir 
290*cdf0e10cSrcweir 		boolean result = true;
291*cdf0e10cSrcweir 		oObj.setStrictFormat(!strict);
292*cdf0e10cSrcweir 		result = oObj.isStrictFormat() == !strict;
293*cdf0e10cSrcweir 
294*cdf0e10cSrcweir 		tRes.tested("setStrictFormat()", result);
295*cdf0e10cSrcweir 	}
296*cdf0e10cSrcweir 
297*cdf0e10cSrcweir 	/**
298*cdf0e10cSrcweir 	* Just calls the method and stores value returned. <p>
299*cdf0e10cSrcweir 	* Has <b>OK</b> status if no runtime exceptions occured.
300*cdf0e10cSrcweir 	*/
301*cdf0e10cSrcweir 	public void _isStrictFormat() {
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir 		boolean result = true;
304*cdf0e10cSrcweir 		strict = oObj.isStrictFormat();
305*cdf0e10cSrcweir 
306*cdf0e10cSrcweir 		tRes.tested("isStrictFormat()", result);
307*cdf0e10cSrcweir 	}
308*cdf0e10cSrcweir }
309