bump product version to 4.2.0.1
[LibreOffice.git] / qadevOOo / tests / java / ifc / awt / _UnoControlFormattedFieldModel.java
blob1358e7c3d0a6ab7be361649dc32ab8abc96bcc81
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;
21 import lib.MultiPropertyTest;
22 import util.utils;
24 import com.sun.star.lang.XMultiServiceFactory;
26 /**
27 * Testing <code>com.sun.star.awt.UnoControlFormattedFieldModel</code>
28 * service properties :
29 * <ul>
30 * <li><code> Align</code></li>
31 * <li><code> BackgroundColor</code></li>
32 * <li><code> Border</code></li>
33 * <li><code> DefaultControl</code></li>
34 * <li><code> EffectiveDefault</code></li>
35 * <li><code> EffectiveMax</code></li>
36 * <li><code> EffectiveMin</code></li>
37 * <li><code> EffectiveValue</code></li>
38 * <li><code> Enabled</code></li>
39 * <li><code> FontDescriptor</code></li>
40 * <li><code> FormatKey</code></li>
41 * <li><code> FormatsSupplier</code></li>
42 * <li><code> MaxTextLen</code></li>
43 * <li><code> Printable</code></li>
44 * <li><code> ReadOnly</code></li>
45 * <li><code> Spin</code></li>
46 * <li><code> StrictFormat</code></li>
47 * <li><code> Tabstop</code></li>
48 * <li><code> Text</code></li>
49 * <li><code> TextColor</code></li>
50 * <li><code> HelpText</code></li>
51 * <li><code> HelpURL</code></li>
52 * </ul> <p>
53 * Properties testing is automated by <code>lib.MultiPropertyTest</code>.
54 * @see com.sun.star.awt.UnoControlFormattedFieldModel
56 public class _UnoControlFormattedFieldModel extends MultiPropertyTest {
58 /**
59 * Redefined method must return a valid service name, that differs from
60 * name exists.
63 protected PropertyTester ControlTester = new PropertyTester() {
64 protected Object getNewValue(String propName, Object oldValue) {
65 if (util.ValueComparer.equalValue(oldValue,
66 "com.sun.star.form.control.FormattedField"))
67 return "com.sun.star.awt.UnoControlFormattedField";
68 else
69 return "com.sun.star.form.control.FormattedField";
73 /**
74 * This property must contain a valid service name.
76 public void _DefaultControl() {
77 log.println("Testing with custom Property tester") ;
78 testProperty("DefaultControl", ControlTester) ;
81 /**
82 * This property can be VOID, and in case if it is so new
83 * value must defined.
85 public void _BorderColor() {
86 testProperty("BorderColor", new PropertyTester() {
87 protected Object getNewValue(String p, Object old) {
88 return utils.isVoid(old) ? new Integer(1234) : null ;
90 }) ;
93 /**
94 * This property can be void, so if old value is <code> null </code>
95 * new value must be specified.
97 public void _TextColor() {
98 testProperty("TextColor", new PropertyTester() {
99 protected Object getNewValue(String p, Object v) {
100 return utils.isVoid(v) ? new Integer(123) :
101 super.getNewValue(p,v) ;
103 }) ;
107 * This property can be void, so if old value is <code> null </code>
108 * new value must be specified.
110 public void _TextLineColor() {
111 testProperty("TextLineColor", new PropertyTester() {
112 protected Object getNewValue(String p, Object v) {
113 return utils.isVoid(v) ? new Integer(123) :
114 super.getNewValue(p,v) ;
116 }) ;
120 * This property can be void, so if old value is <code> null </code>
121 * new value must be specified.
123 public void _BackgroundColor() {
124 testProperty("BackgroundColor", new PropertyTester() {
125 protected Object getNewValue(String p, Object v) {
126 return utils.isVoid(v) ? new Integer(123) :
127 super.getNewValue(p,v) ;
129 }) ;
133 * This property can be void, so if old value is <code> null </code>
134 * new value must be specified.
136 public void _EffectiveDefault() {
137 testProperty("EffectiveDefault", new Double(5.8),new Double(2.3)) ;
141 * This property can be void, so if old value is <code> null </code>
142 * new value must be specified.
144 public void _EffectiveValue() {
145 testProperty("EffectiveValue", new Double(5.8),new Double(2.3)) ;
149 * This property can be void, so if old value is <code> null </code>
150 * new value must be specified.
152 public void _EffectiveMax() {
153 testProperty("EffectiveMax", new PropertyTester() {
154 protected Object getNewValue(String p, Object v) {
155 return utils.isVoid(v) ? new Double(123.8) :
156 super.getNewValue(p,v) ;
158 }) ;
162 * This property can be void, so if old value is <code> null </code>
163 * new value must be specified.
165 public void _FormatsSupplier() {
166 testProperty("FormatsSupplier", new PropertyTester() {
167 protected Object getNewValue(String p, Object v) {
168 Object newValue = null;
169 try {
170 newValue = ((XMultiServiceFactory)tParam.getMSF()).createInstance(
171 "com.sun.star.util.NumberFormatsSupplier");
172 } catch (com.sun.star.uno.Exception e) {}
173 return newValue;
175 }) ;
179 * This property can be void, so if old value is <code> null </code>
180 * new value must be specified.
182 public void _EffectiveMin() {
183 testProperty("EffectiveMin", new PropertyTester() {
184 protected Object getNewValue(String p, Object v) {
185 return utils.isVoid(v) ? new Double(0.1) :
186 super.getNewValue(p,v) ;
188 }) ;
192 * This property can be void, so if old value is <code> null </code>
193 * new value must be specified.
195 public void _FormatKey() {
196 testProperty("FormatKey", new PropertyTester() {
197 protected Object getNewValue(String p, Object v) {
198 return utils.isVoid(v) ? new Integer(0) :
199 super.getNewValue(p,v) ;
201 }) ;
205 * This property can be void, so if old value is <code> null </code>
206 * new value must be specified.
208 public void _StrictFromat() {
209 testProperty("StrictFromat", new PropertyTester() {
210 protected Object getNewValue(String p, Object v) {
211 return utils.isVoid(v) ? new Boolean(true) :
212 super.getNewValue(p,v) ;
214 }) ;
218 * This property can be void, so if old value is <code> null </code>
219 * new value must be specified.
221 public void _Tabstop() {
222 testProperty("Tabstop", new PropertyTester() {
223 protected Object getNewValue(String p, Object v) {
224 return utils.isVoid(v) ? new Boolean(true) :
225 null ;
227 }) ;
231 * This property can be void, so if old value is <code> null </code>
232 * new value must be specified.
234 public void _Text() {
235 testProperty("Text", new PropertyTester() {
236 protected Object getNewValue(String p, Object v) {
237 return utils.isVoid(v) ? "UnoControlFormattedFieldModel" :
238 super.getNewValue(p,v) ;
240 }) ;