1ef39d40dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3ef39d40dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4ef39d40dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5ef39d40dSAndrew Rist  * distributed with this work for additional information
6ef39d40dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7ef39d40dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8ef39d40dSAndrew Rist  * "License"); you may not use this file except in compliance
9ef39d40dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10ef39d40dSAndrew Rist  *
11ef39d40dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12ef39d40dSAndrew Rist  *
13ef39d40dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14ef39d40dSAndrew Rist  * software distributed under the License is distributed on an
15ef39d40dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16ef39d40dSAndrew Rist  * KIND, either express or implied.  See the License for the
17ef39d40dSAndrew Rist  * specific language governing permissions and limitations
18ef39d40dSAndrew Rist  * under the License.
19ef39d40dSAndrew Rist  *
20ef39d40dSAndrew Rist  *************************************************************/
21ef39d40dSAndrew Rist 
22ef39d40dSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir package ifc.awt;
25cdf0e10cSrcweir 
26cdf0e10cSrcweir 
27cdf0e10cSrcweir import lib.MultiMethodTest;
28cdf0e10cSrcweir 
29cdf0e10cSrcweir import com.sun.star.awt.XTimeField;
30cdf0e10cSrcweir 
31cdf0e10cSrcweir /**
32cdf0e10cSrcweir * Testing <code>com.sun.star.awt.XTimeField</code>
33cdf0e10cSrcweir * interface methods :
34cdf0e10cSrcweir * <ul>
35cdf0e10cSrcweir *  <li><code> setTime()</code></li>
36cdf0e10cSrcweir *  <li><code> getTime()</code></li>
37cdf0e10cSrcweir *  <li><code> setMin()</code></li>
38cdf0e10cSrcweir *  <li><code> getMin()</code></li>
39cdf0e10cSrcweir *  <li><code> setMax()</code></li>
40cdf0e10cSrcweir *  <li><code> getMax()</code></li>
41cdf0e10cSrcweir *  <li><code> setFirst()</code></li>
42cdf0e10cSrcweir *  <li><code> getFirst()</code></li>
43cdf0e10cSrcweir *  <li><code> setLast()</code></li>
44cdf0e10cSrcweir *  <li><code> getLast()</code></li>
45cdf0e10cSrcweir *  <li><code> setEmpty()</code></li>
46cdf0e10cSrcweir *  <li><code> isEmpty()</code></li>
47cdf0e10cSrcweir *  <li><code> setStrictFormat()</code></li>
48cdf0e10cSrcweir *  <li><code> isStrictFormat()</code></li>
49cdf0e10cSrcweir * </ul> <p>
50cdf0e10cSrcweir * Test is <b> NOT </b> multithread compilant. <p>
51cdf0e10cSrcweir * @see com.sun.star.awt.XTimeField
52cdf0e10cSrcweir */
53cdf0e10cSrcweir public class _XTimeField extends MultiMethodTest {
54cdf0e10cSrcweir 
55cdf0e10cSrcweir     public XTimeField oObj = null;
56cdf0e10cSrcweir     private boolean strict = false ;
57cdf0e10cSrcweir 
58cdf0e10cSrcweir     /**
59cdf0e10cSrcweir     * Sets a new value and checks if it was correctly set. <p>
60cdf0e10cSrcweir     * Has <b> OK </b> status if set and get values are equal.
61cdf0e10cSrcweir     * The following method tests are to be completed successfully before :
62cdf0e10cSrcweir     * <ul>
63cdf0e10cSrcweir     *  <li> <code> getTime </code> </li>
64cdf0e10cSrcweir     * </ul>
65cdf0e10cSrcweir     */
_setTime()66cdf0e10cSrcweir     public void _setTime() {
67cdf0e10cSrcweir         requiredMethod("getTime()") ;
68cdf0e10cSrcweir 
69cdf0e10cSrcweir         boolean result = true ;
70cdf0e10cSrcweir         oObj.setTime(11150000) ;
71cdf0e10cSrcweir 
72cdf0e10cSrcweir         result = oObj.getTime() == 11150000 ;
73cdf0e10cSrcweir 
74cdf0e10cSrcweir         if (! result ) {
75cdf0e10cSrcweir             System.out.println("Getting "+oObj.getTime()+ " expected 11150000");
76cdf0e10cSrcweir         }
77cdf0e10cSrcweir 
78cdf0e10cSrcweir         tRes.tested("setTime()", result) ;
79cdf0e10cSrcweir     }
80cdf0e10cSrcweir 
81cdf0e10cSrcweir     /**
82cdf0e10cSrcweir     * Gets the current value. <p>
83*bb6af6bcSPedro Giffuni     * Has <b> OK </b> status if no runtime exceptions occurred
84cdf0e10cSrcweir     */
_getTime()85cdf0e10cSrcweir     public void _getTime() {
86cdf0e10cSrcweir 
87cdf0e10cSrcweir         boolean result = true ;
88cdf0e10cSrcweir         oObj.getTime() ;
89cdf0e10cSrcweir 
90cdf0e10cSrcweir         tRes.tested("getTime()", result) ;
91cdf0e10cSrcweir     }
92cdf0e10cSrcweir 
93cdf0e10cSrcweir     /**
94cdf0e10cSrcweir     * Sets a new value and checks if it was correctly set. <p>
95cdf0e10cSrcweir     * Has <b> OK </b> status if set and get values are equal.
96cdf0e10cSrcweir     * The following method tests are to be completed successfully before :
97cdf0e10cSrcweir     * <ul>
98cdf0e10cSrcweir     *  <li> <code> getMin </code> </li>
99cdf0e10cSrcweir     * </ul>
100cdf0e10cSrcweir     */
_setMin()101cdf0e10cSrcweir     public void _setMin() {
102cdf0e10cSrcweir 
103cdf0e10cSrcweir         boolean result = true ;
104cdf0e10cSrcweir         oObj.setMin(4978) ;
105cdf0e10cSrcweir 
106cdf0e10cSrcweir         result = oObj.getMin() == 4978 ;
107cdf0e10cSrcweir 
108cdf0e10cSrcweir         tRes.tested("setMin()", result) ;
109cdf0e10cSrcweir     }
110cdf0e10cSrcweir 
111cdf0e10cSrcweir     /**
112cdf0e10cSrcweir     * Gets the current value. <p>
113*bb6af6bcSPedro Giffuni     * Has <b> OK </b> status if no runtime exceptions occurred
114cdf0e10cSrcweir     */
_getMin()115cdf0e10cSrcweir     public void _getMin() {
116cdf0e10cSrcweir 
117cdf0e10cSrcweir         boolean result = true ;
118cdf0e10cSrcweir         oObj.getMin() ;
119cdf0e10cSrcweir 
120cdf0e10cSrcweir         tRes.tested("getMin()", result) ;
121cdf0e10cSrcweir     }
122cdf0e10cSrcweir 
123cdf0e10cSrcweir     /**
124cdf0e10cSrcweir     * Sets a new value and checks if it was correctly set. <p>
125cdf0e10cSrcweir     * Has <b> OK </b> status if set and get values are equal.
126cdf0e10cSrcweir     * The following method tests are to be completed successfully before :
127cdf0e10cSrcweir     * <ul>
128cdf0e10cSrcweir     *  <li> <code> getMax </code> </li>
129cdf0e10cSrcweir     * </ul>
130cdf0e10cSrcweir     */
_setMax()131cdf0e10cSrcweir     public void _setMax() {
132cdf0e10cSrcweir 
133cdf0e10cSrcweir         boolean result = true ;
134cdf0e10cSrcweir         oObj.setMax(27856) ;
135cdf0e10cSrcweir 
136cdf0e10cSrcweir         result = oObj.getMax() == 27856 ;
137cdf0e10cSrcweir 
138cdf0e10cSrcweir         tRes.tested("setMax()", result) ;
139cdf0e10cSrcweir     }
140cdf0e10cSrcweir 
141cdf0e10cSrcweir     /**
142cdf0e10cSrcweir     * Gets the current value. <p>
143*bb6af6bcSPedro Giffuni     * Has <b> OK </b> status if no runtime exceptions occurred
144cdf0e10cSrcweir     */
_getMax()145cdf0e10cSrcweir     public void _getMax() {
146cdf0e10cSrcweir 
147cdf0e10cSrcweir         boolean result = true ;
148cdf0e10cSrcweir         oObj.getMax() ;
149cdf0e10cSrcweir 
150cdf0e10cSrcweir         tRes.tested("getMax()", result) ;
151cdf0e10cSrcweir     }
152cdf0e10cSrcweir 
153cdf0e10cSrcweir     /**
154cdf0e10cSrcweir     * Sets a new value and checks if it was correctly set. <p>
155cdf0e10cSrcweir     * Has <b> OK </b> status if set and get values are equal.
156cdf0e10cSrcweir     * The following method tests are to be completed successfully before :
157cdf0e10cSrcweir     * <ul>
158cdf0e10cSrcweir     *  <li> <code> getFirst </code> </li>
159cdf0e10cSrcweir     * </ul>
160cdf0e10cSrcweir     */
_setFirst()161cdf0e10cSrcweir     public void _setFirst() {
162cdf0e10cSrcweir 
163cdf0e10cSrcweir         boolean result = true ;
164cdf0e10cSrcweir         oObj.setFirst(5118) ;
165cdf0e10cSrcweir 
166cdf0e10cSrcweir         result = oObj.getFirst() == 5118 ;
167cdf0e10cSrcweir 
168cdf0e10cSrcweir         if (!result) {
169cdf0e10cSrcweir             log.println("Set to " + 5118 + " but returned " + oObj.getFirst()) ;
170cdf0e10cSrcweir         }
171cdf0e10cSrcweir 
172cdf0e10cSrcweir         tRes.tested("setFirst()", result) ;
173cdf0e10cSrcweir     }
174cdf0e10cSrcweir 
175cdf0e10cSrcweir     /**
176cdf0e10cSrcweir     * Gets the current value. <p>
177*bb6af6bcSPedro Giffuni     * Has <b> OK </b> status if no runtime exceptions occurred
178cdf0e10cSrcweir     */
_getFirst()179cdf0e10cSrcweir     public void _getFirst() {
180cdf0e10cSrcweir 
181cdf0e10cSrcweir         boolean result = true ;
182cdf0e10cSrcweir         int val = oObj.getFirst() ;
183cdf0e10cSrcweir 
184cdf0e10cSrcweir         log.println("getFirst() = " + val) ;
185cdf0e10cSrcweir 
186cdf0e10cSrcweir         tRes.tested("getFirst()", result) ;
187cdf0e10cSrcweir     }
188cdf0e10cSrcweir 
189cdf0e10cSrcweir     /**
190cdf0e10cSrcweir     * Sets a new value and checks if it was correctly set. <p>
191cdf0e10cSrcweir     * Has <b> OK </b> status if set and get values are equal.
192cdf0e10cSrcweir     * The following method tests are to be completed successfully before :
193cdf0e10cSrcweir     * <ul>
194cdf0e10cSrcweir     *  <li> <code> getLast </code> </li>
195cdf0e10cSrcweir     * </ul>
196cdf0e10cSrcweir     */
_setLast()197cdf0e10cSrcweir     public void _setLast() {
198cdf0e10cSrcweir 
199cdf0e10cSrcweir         boolean result = true ;
200cdf0e10cSrcweir         oObj.setLast(23450) ;
201cdf0e10cSrcweir 
202cdf0e10cSrcweir         result = oObj.getLast() == 23450 ;
203cdf0e10cSrcweir 
204cdf0e10cSrcweir         if (!result) {
205cdf0e10cSrcweir             log.println("Set to " + 23450 + " but returned " + oObj.getLast()) ;
206cdf0e10cSrcweir         }
207cdf0e10cSrcweir 
208cdf0e10cSrcweir         tRes.tested("setLast()", result) ;
209cdf0e10cSrcweir     }
210cdf0e10cSrcweir 
211cdf0e10cSrcweir     /**
212cdf0e10cSrcweir     * Gets the current value. <p>
213*bb6af6bcSPedro Giffuni     * Has <b> OK </b> status if no runtime exceptions occurred
214cdf0e10cSrcweir     */
_getLast()215cdf0e10cSrcweir     public void _getLast() {
216cdf0e10cSrcweir 
217cdf0e10cSrcweir         boolean result = true ;
218cdf0e10cSrcweir         int val = oObj.getLast() ;
219cdf0e10cSrcweir 
220cdf0e10cSrcweir         log.println("getLast() = " + val) ;
221cdf0e10cSrcweir 
222cdf0e10cSrcweir         tRes.tested("getLast()", result) ;
223cdf0e10cSrcweir     }
224cdf0e10cSrcweir 
225cdf0e10cSrcweir     /**
226cdf0e10cSrcweir     * Sets the value to empty. <p>
227*bb6af6bcSPedro Giffuni     * Has <b> OK </b> status if no runtime exceptions occurred
228cdf0e10cSrcweir     * The following method tests are to be completed successfully before :
229cdf0e10cSrcweir     * <ul>
230cdf0e10cSrcweir     *  <li> <code> setTime </code> : value must be not empty </li>
231cdf0e10cSrcweir     * </ul>
232cdf0e10cSrcweir     */
_setEmpty()233cdf0e10cSrcweir     public void _setEmpty() {
234cdf0e10cSrcweir         requiredMethod("setTime()") ;
235cdf0e10cSrcweir 
236cdf0e10cSrcweir         boolean result = true ;
237cdf0e10cSrcweir         oObj.setEmpty() ;
238cdf0e10cSrcweir 
239cdf0e10cSrcweir         tRes.tested("setEmpty()", result) ;
240cdf0e10cSrcweir     }
241cdf0e10cSrcweir 
242cdf0e10cSrcweir     /**
243cdf0e10cSrcweir     * Checks if the field is empty. <p>
244cdf0e10cSrcweir     * Has <b> OK </b> status if the value is empty.<p>
245cdf0e10cSrcweir     * The following method tests are to be completed successfully before :
246cdf0e10cSrcweir     * <ul>
247cdf0e10cSrcweir     *  <li> <code> setEmpty() </code>  </li>
248cdf0e10cSrcweir     * </ul>
249cdf0e10cSrcweir     */
_isEmpty()250cdf0e10cSrcweir     public void _isEmpty() {
251cdf0e10cSrcweir         requiredMethod("setEmpty()") ;
252cdf0e10cSrcweir 
253cdf0e10cSrcweir         boolean result = true ;
254cdf0e10cSrcweir         result = oObj.isEmpty() ;
255cdf0e10cSrcweir 
256cdf0e10cSrcweir         tRes.tested("isEmpty()", result) ;
257cdf0e10cSrcweir     }
258cdf0e10cSrcweir 
259cdf0e10cSrcweir     /**
260cdf0e10cSrcweir     * Checks strict state. <p>
261cdf0e10cSrcweir     * Has <b> OK </b> status if strict format is set.
262cdf0e10cSrcweir     * The following method tests are to be completed successfully before :
263cdf0e10cSrcweir     * <ul>
264cdf0e10cSrcweir     *  <li> <code> isStrictFormat </code> </li>
265cdf0e10cSrcweir     * </ul>
266cdf0e10cSrcweir     */
_setStrictFormat()267cdf0e10cSrcweir     public void _setStrictFormat() {
268cdf0e10cSrcweir         requiredMethod("isStrictFormat()") ;
269cdf0e10cSrcweir 
270cdf0e10cSrcweir         boolean result = true ;
271cdf0e10cSrcweir         oObj.setStrictFormat(!strict) ;
272cdf0e10cSrcweir 
273cdf0e10cSrcweir         result = oObj.isStrictFormat() == !strict ;
274cdf0e10cSrcweir 
275cdf0e10cSrcweir         tRes.tested("setStrictFormat()", result) ;
276cdf0e10cSrcweir     }
277cdf0e10cSrcweir 
278cdf0e10cSrcweir     /**
279cdf0e10cSrcweir     * Gets strict state and stores it. <p>
280*bb6af6bcSPedro Giffuni     * Has <b> OK </b> status if no runtime exceptions occurred.
281cdf0e10cSrcweir     */
_isStrictFormat()282cdf0e10cSrcweir     public void _isStrictFormat() {
283cdf0e10cSrcweir 
284cdf0e10cSrcweir         boolean result = true ;
285cdf0e10cSrcweir         strict = oObj.isStrictFormat() ;
286cdf0e10cSrcweir 
287cdf0e10cSrcweir         tRes.tested("isStrictFormat()", result) ;
288cdf0e10cSrcweir     }
289cdf0e10cSrcweir }
290cdf0e10cSrcweir 
291cdf0e10cSrcweir 
292