1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _XTimeField.java,v $
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 ************************************************************************/
34 import lib
.MultiMethodTest
;
36 import com
.sun
.star
.awt
.XTimeField
;
39 * Testing <code>com.sun.star.awt.XTimeField</code>
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>
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 ;
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 :
70 * <li> <code> getTime </code> </li>
73 public void _setTime() {
74 requiredMethod("getTime()") ;
76 boolean result
= true ;
77 oObj
.setTime(11150000) ;
79 result
= oObj
.getTime() == 11150000 ;
82 System
.out
.println("Getting "+oObj
.getTime()+ " expected 11150000");
85 tRes
.tested("setTime()", result
) ;
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 ;
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 :
105 * <li> <code> getMin </code> </li>
108 public void _setMin() {
110 boolean result
= true ;
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 ;
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 :
135 * <li> <code> getMax </code> </li>
138 public void _setMax() {
140 boolean result
= true ;
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 ;
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 :
165 * <li> <code> getFirst </code> </li>
168 public void _setFirst() {
170 boolean result
= true ;
171 oObj
.setFirst(5118) ;
173 result
= oObj
.getFirst() == 5118 ;
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 :
201 * <li> <code> getLast </code> </li>
204 public void _setLast() {
206 boolean result
= true ;
207 oObj
.setLast(23450) ;
209 result
= oObj
.getLast() == 23450 ;
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 :
237 * <li> <code> setTime </code> : value must be not empty </li>
240 public void _setEmpty() {
241 requiredMethod("setTime()") ;
243 boolean result
= true ;
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 :
254 * <li> <code> setEmpty() </code> </li>
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 :
271 * <li> <code> isStrictFormat </code> </li>
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
) ;