merge the formfield patch from ooo-build
[ooovba.git] / qadevOOo / tests / java / ifc / awt / _XTimeField.java
blobbdb772f122343194a8911f868f3a6f7eedb874dc
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _XTimeField.java,v $
10 * $Revision: 1.5 $
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 ************************************************************************/
31 package ifc.awt;
34 import lib.MultiMethodTest;
36 import com.sun.star.awt.XTimeField;
38 /**
39 * Testing <code>com.sun.star.awt.XTimeField</code>
40 * interface methods :
41 * <ul>
42 * <li><code> setTime()</code></li>
43 * <li><code> getTime()</code></li>
44 * <li><code> setMin()</code></li>
45 * <li><code> getMin()</code></li>
46 * <li><code> setMax()</code></li>
47 * <li><code> getMax()</code></li>
48 * <li><code> setFirst()</code></li>
49 * <li><code> getFirst()</code></li>
50 * <li><code> setLast()</code></li>
51 * <li><code> getLast()</code></li>
52 * <li><code> setEmpty()</code></li>
53 * <li><code> isEmpty()</code></li>
54 * <li><code> setStrictFormat()</code></li>
55 * <li><code> isStrictFormat()</code></li>
56 * </ul> <p>
57 * Test is <b> NOT </b> multithread compilant. <p>
58 * @see com.sun.star.awt.XTimeField
60 public class _XTimeField extends MultiMethodTest {
62 public XTimeField oObj = null;
63 private boolean strict = false ;
65 /**
66 * Sets a new value and checks if it was correctly set. <p>
67 * Has <b> OK </b> status if set and get values are equal.
68 * The following method tests are to be completed successfully before :
69 * <ul>
70 * <li> <code> getTime </code> </li>
71 * </ul>
73 public void _setTime() {
74 requiredMethod("getTime()") ;
76 boolean result = true ;
77 oObj.setTime(11150000) ;
79 result = oObj.getTime() == 11150000 ;
81 if (! result ) {
82 System.out.println("Getting "+oObj.getTime()+ " expected 11150000");
85 tRes.tested("setTime()", result) ;
88 /**
89 * Gets the current value. <p>
90 * Has <b> OK </b> status if no runtime exceptions occured
92 public void _getTime() {
94 boolean result = true ;
95 oObj.getTime() ;
97 tRes.tested("getTime()", result) ;
101 * Sets a new value and checks if it was correctly set. <p>
102 * Has <b> OK </b> status if set and get values are equal.
103 * The following method tests are to be completed successfully before :
104 * <ul>
105 * <li> <code> getMin </code> </li>
106 * </ul>
108 public void _setMin() {
110 boolean result = true ;
111 oObj.setMin(4978) ;
113 result = oObj.getMin() == 4978 ;
115 tRes.tested("setMin()", result) ;
119 * Gets the current value. <p>
120 * Has <b> OK </b> status if no runtime exceptions occured
122 public void _getMin() {
124 boolean result = true ;
125 oObj.getMin() ;
127 tRes.tested("getMin()", result) ;
131 * Sets a new value and checks if it was correctly set. <p>
132 * Has <b> OK </b> status if set and get values are equal.
133 * The following method tests are to be completed successfully before :
134 * <ul>
135 * <li> <code> getMax </code> </li>
136 * </ul>
138 public void _setMax() {
140 boolean result = true ;
141 oObj.setMax(27856) ;
143 result = oObj.getMax() == 27856 ;
145 tRes.tested("setMax()", result) ;
149 * Gets the current value. <p>
150 * Has <b> OK </b> status if no runtime exceptions occured
152 public void _getMax() {
154 boolean result = true ;
155 oObj.getMax() ;
157 tRes.tested("getMax()", result) ;
161 * Sets a new value and checks if it was correctly set. <p>
162 * Has <b> OK </b> status if set and get values are equal.
163 * The following method tests are to be completed successfully before :
164 * <ul>
165 * <li> <code> getFirst </code> </li>
166 * </ul>
168 public void _setFirst() {
170 boolean result = true ;
171 oObj.setFirst(5118) ;
173 result = oObj.getFirst() == 5118 ;
175 if (!result) {
176 log.println("Set to " + 5118 + " but returned " + oObj.getFirst()) ;
179 tRes.tested("setFirst()", result) ;
183 * Gets the current value. <p>
184 * Has <b> OK </b> status if no runtime exceptions occured
186 public void _getFirst() {
188 boolean result = true ;
189 int val = oObj.getFirst() ;
191 log.println("getFirst() = " + val) ;
193 tRes.tested("getFirst()", result) ;
197 * Sets a new value and checks if it was correctly set. <p>
198 * Has <b> OK </b> status if set and get values are equal.
199 * The following method tests are to be completed successfully before :
200 * <ul>
201 * <li> <code> getLast </code> </li>
202 * </ul>
204 public void _setLast() {
206 boolean result = true ;
207 oObj.setLast(23450) ;
209 result = oObj.getLast() == 23450 ;
211 if (!result) {
212 log.println("Set to " + 23450 + " but returned " + oObj.getLast()) ;
215 tRes.tested("setLast()", result) ;
219 * Gets the current value. <p>
220 * Has <b> OK </b> status if no runtime exceptions occured
222 public void _getLast() {
224 boolean result = true ;
225 int val = oObj.getLast() ;
227 log.println("getLast() = " + val) ;
229 tRes.tested("getLast()", result) ;
233 * Sets the value to empty. <p>
234 * Has <b> OK </b> status if no runtime exceptions occured
235 * The following method tests are to be completed successfully before :
236 * <ul>
237 * <li> <code> setTime </code> : value must be not empty </li>
238 * </ul>
240 public void _setEmpty() {
241 requiredMethod("setTime()") ;
243 boolean result = true ;
244 oObj.setEmpty() ;
246 tRes.tested("setEmpty()", result) ;
250 * Checks if the field is empty. <p>
251 * Has <b> OK </b> status if the value is empty.<p>
252 * The following method tests are to be completed successfully before :
253 * <ul>
254 * <li> <code> setEmpty() </code> </li>
255 * </ul>
257 public void _isEmpty() {
258 requiredMethod("setEmpty()") ;
260 boolean result = true ;
261 result = oObj.isEmpty() ;
263 tRes.tested("isEmpty()", result) ;
267 * Checks strict state. <p>
268 * Has <b> OK </b> status if strict format is set.
269 * The following method tests are to be completed successfully before :
270 * <ul>
271 * <li> <code> isStrictFormat </code> </li>
272 * </ul>
274 public void _setStrictFormat() {
275 requiredMethod("isStrictFormat()") ;
277 boolean result = true ;
278 oObj.setStrictFormat(!strict) ;
280 result = oObj.isStrictFormat() == !strict ;
282 tRes.tested("setStrictFormat()", result) ;
286 * Gets strict state and stores it. <p>
287 * Has <b> OK </b> status if no runtime exceptions occured.
289 public void _isStrictFormat() {
291 boolean result = true ;
292 strict = oObj.isStrictFormat() ;
294 tRes.tested("isStrictFormat()", result) ;