tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / qadevOOo / tests / java / ifc / awt / _XTimeField.java
blobcee4e51d6c1c2d37f7858cec556a05c0799c0001
1 /*
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 .
19 package ifc.awt;
22 import lib.MultiMethodTest;
24 import com.sun.star.awt.XTimeField;
25 import com.sun.star.util.Time;
27 /**
28 * Testing <code>com.sun.star.awt.XTimeField</code>
29 * interface methods :
30 * <ul>
31 * <li><code> setTime()</code></li>
32 * <li><code> getTime()</code></li>
33 * <li><code> setMin()</code></li>
34 * <li><code> getMin()</code></li>
35 * <li><code> setMax()</code></li>
36 * <li><code> getMax()</code></li>
37 * <li><code> setFirst()</code></li>
38 * <li><code> getFirst()</code></li>
39 * <li><code> setLast()</code></li>
40 * <li><code> getLast()</code></li>
41 * <li><code> setEmpty()</code></li>
42 * <li><code> isEmpty()</code></li>
43 * <li><code> setStrictFormat()</code></li>
44 * <li><code> isStrictFormat()</code></li>
45 * </ul> <p>
46 * Test is <b> NOT </b> multithread compliant. <p>
47 * @see com.sun.star.awt.XTimeField
49 public class _XTimeField extends MultiMethodTest {
51 public XTimeField oObj = null;
52 private boolean strict = false ;
54 /**
55 * Sets a new value and checks if it was correctly set. <p>
56 * Has <b> OK </b> status if set and get values are equal.
57 * The following method tests are to be completed successfully before :
58 * <ul>
59 * <li> <code> getTime </code> </li>
60 * </ul>
62 public void _setTime() {
63 requiredMethod("getTime()") ;
65 boolean result = true ;
66 oObj.setTime(new Time(0, (short)0, (short)15, (short)11, false));
67 Time time = oObj.getTime();
68 result = time.NanoSeconds == 0 && time.Seconds == 0 && time.Minutes == 15 && time.Hours == 11 && !time.IsUTC;
70 if (! result ) {
71 System.out.println("Getting " + oObj.getTime() + " expected 11:15");
74 tRes.tested("setTime()", result) ;
77 /**
78 * Gets the current value. <p>
79 * Has <b> OK </b> status if no runtime exceptions occurred
81 public void _getTime() {
83 boolean result = true ;
84 oObj.getTime() ;
86 tRes.tested("getTime()", result) ;
89 /**
90 * Sets a new value and checks if it was correctly set. <p>
91 * Has <b> OK </b> status if set and get values are equal.
92 * The following method tests are to be completed successfully before :
93 * <ul>
94 * <li> <code> getMin </code> </li>
95 * </ul>
97 public void _setMin() {
99 boolean result = true ;
100 oObj.setMin(new Time(0, (short)14, (short)18, (short)6, false));
101 Time time = oObj.getMin();
102 result = time.NanoSeconds == 0 && time.Seconds == 14 && time.Minutes == 18 && time.Hours == 6 && !time.IsUTC;
104 tRes.tested("setMin()", result) ;
108 * Gets the current value. <p>
109 * Has <b> OK </b> status if no runtime exceptions occurred
111 public void _getMin() {
113 boolean result = true ;
114 oObj.getMin() ;
116 tRes.tested("getMin()", result) ;
120 * Sets a new value and checks if it was correctly set. <p>
121 * Has <b> OK </b> status if set and get values are equal.
122 * The following method tests are to be completed successfully before :
123 * <ul>
124 * <li> <code> getMax </code> </li>
125 * </ul>
127 public void _setMax() {
129 boolean result = true ;
130 oObj.setMax(new Time(855447, (short)31, (short)23, (short)22, false)) ;
131 Time time = oObj.getMax();
132 result = time.NanoSeconds == 855447 && time.Seconds == 31 && time.Minutes == 23 && time.Hours == 22 && !time.IsUTC;
134 tRes.tested("setMax()", result) ;
138 * Gets the current value. <p>
139 * Has <b> OK </b> status if no runtime exceptions occurred
141 public void _getMax() {
143 boolean result = true ;
144 oObj.getMax() ;
146 tRes.tested("getMax()", result) ;
150 * Sets a new value and checks if it was correctly set. <p>
151 * Has <b> OK </b> status if set and get values are equal.
152 * The following method tests are to be completed successfully before :
153 * <ul>
154 * <li> <code> getFirst </code> </li>
155 * </ul>
157 public void _setFirst() {
159 boolean result = true ;
160 oObj.setFirst(new Time(0, (short)0, (short)30, (short)7, false)) ;
161 Time time = oObj.getFirst();
162 result = time.NanoSeconds == 0 && time.Seconds == 0 && time.Minutes == 30 && time.Hours == 7 && !time.IsUTC;
164 if (!result) {
165 log.println("Set to 07:30 but returned " + oObj.getFirst()) ;
168 tRes.tested("setFirst()", result) ;
172 * Gets the current value. <p>
173 * Has <b> OK </b> status if no runtime exceptions occurred
175 public void _getFirst() {
177 boolean result = true ;
178 com.sun.star.util.Time val = oObj.getFirst() ;
180 log.println("getFirst() = " + val) ;
182 tRes.tested("getFirst()", result) ;
186 * Sets a new value and checks if it was correctly set. <p>
187 * Has <b> OK </b> status if set and get values are equal.
188 * The following method tests are to be completed successfully before :
189 * <ul>
190 * <li> <code> getLast </code> </li>
191 * </ul>
193 public void _setLast() {
195 boolean result = true ;
196 oObj.setLast(new Time(500000, (short)31, (short)30, (short)18, false)) ;
197 Time time = oObj.getLast();
198 result = time.NanoSeconds == 500000 && time.Seconds == 31 && time.Minutes == 30 && time.Hours == 18 && !time.IsUTC;
200 if (!result) {
201 log.println("Set to 18:30:31.5 but returned " + oObj.getLast()) ;
204 tRes.tested("setLast()", result) ;
208 * Gets the current value. <p>
209 * Has <b> OK </b> status if no runtime exceptions occurred
211 public void _getLast() {
213 boolean result = true ;
214 com.sun.star.util.Time val = oObj.getLast() ;
216 log.println("getLast() = " + val) ;
218 tRes.tested("getLast()", result) ;
222 * Sets the value to empty. <p>
223 * Has <b> OK </b> status if no runtime exceptions occurred
224 * The following method tests are to be completed successfully before :
225 * <ul>
226 * <li> <code> setTime </code> : value must be not empty </li>
227 * </ul>
229 public void _setEmpty() {
230 requiredMethod("setTime()") ;
232 boolean result = true ;
233 oObj.setEmpty() ;
235 tRes.tested("setEmpty()", result) ;
239 * Checks if the field is empty. <p>
240 * Has <b> OK </b> status if the value is empty.<p>
241 * The following method tests are to be completed successfully before :
242 * <ul>
243 * <li> <code> setEmpty() </code> </li>
244 * </ul>
246 public void _isEmpty() {
247 requiredMethod("setEmpty()") ;
249 boolean result = true ;
250 result = oObj.isEmpty() ;
252 tRes.tested("isEmpty()", result) ;
256 * Checks strict state. <p>
257 * Has <b> OK </b> status if strict format is set.
258 * The following method tests are to be completed successfully before :
259 * <ul>
260 * <li> <code> isStrictFormat </code> </li>
261 * </ul>
263 public void _setStrictFormat() {
264 requiredMethod("isStrictFormat()") ;
266 boolean result = true ;
267 oObj.setStrictFormat(!strict) ;
269 result = oObj.isStrictFormat() == !strict ;
271 tRes.tested("setStrictFormat()", result) ;
275 * Gets strict state and stores it. <p>
276 * Has <b> OK </b> status if no runtime exceptions occurred.
278 public void _isStrictFormat() {
280 boolean result = true ;
281 strict = oObj.isStrictFormat() ;
283 tRes.tested("isStrictFormat()", result) ;