1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 package ifc.awt;
25 
26 import lib.MultiPropertyTest;
27 import util.utils;
28 
29 /**
30 * Testing <code>com.sun.star.awt.UnoControlEditModel</code>
31 * service properties :
32 * <ul>
33 *  <li><code> Align</code></li>
34 *  <li><code> BackgroundColor</code></li>
35 *  <li><code> Border</code></li>
36 *  <li><code> DefaultControl</code></li>
37 *  <li><code> EchoChar</code></li>
38 *  <li><code> Enabled</code></li>
39 *  <li><code> FontDescriptor</code></li>
40 *  <li><code> HardLineBreaks</code></li>
41 *  <li><code> HScroll</code></li>
42 *  <li><code> MaxTextLen</code></li>
43 *  <li><code> MultiLine</code></li>
44 *  <li><code> Printable</code></li>
45 *  <li><code> ReadOnly</code></li>
46 *  <li><code> Tabstop</code></li>
47 *  <li><code> Text</code></li>
48 *  <li><code> TextColor</code></li>
49 *  <li><code> VScroll</code></li>
50 * </ul>
51 * Almost all properties testing is automated by
52 * <code>lib.MultiPropertyTest</code>.
53 * @see com.sun.star.awt.UnoControlEditModel
54 */
55 public class _UnoControlEditModel extends MultiPropertyTest {
56 
57     /**
58     * This property can be VOID, and in case if it is so new
59     * value must defined.
60     */
_BackgroundColor()61     public void _BackgroundColor() {
62         testProperty("BackgroundColor", new PropertyTester() {
63             protected Object getNewValue(String p, Object old) {
64                 return utils.isVoid(old) ? new Integer(1234) : null ;
65             }
66         }) ;
67     }
68 
69     /**
70     * This property can be VOID, and in case if it is so new
71     * value must defined.
72     */
_BorderColor()73     public void _BorderColor() {
74         testProperty("BorderColor", new PropertyTester() {
75             protected Object getNewValue(String p, Object old) {
76                 return utils.isVoid(old) ? new Integer(1234) : null ;
77             }
78         }) ;
79     }
80 
81     /**
82     * This property can be VOID, and in case if it is so new
83     * value must defined.
84     */
_TextColor()85     public void _TextColor() {
86         testProperty("TextColor", new PropertyTester() {
87             protected Object getNewValue(String p, Object old) {
88                 return utils.isVoid(old) ? new Integer(4321) : null ;
89             }
90         }) ;
91     }
92 
93     /**
94     * This property can be VOID, and in case if it is so new
95     * value must defined.
96     */
_Tabstop()97     public void _Tabstop() {
98         testProperty("Tabstop", new PropertyTester() {
99             protected Object getNewValue(String p, Object old) {
100                 return utils.isVoid(old) ? new Boolean(true) : null ;
101             }
102         }) ;
103     }
104 
105     /**
106     * Redefined method returns value, that differs from property value.
107     */
108     protected PropertyTester ColorTester = new PropertyTester() {
109         protected Object getNewValue(String propName, Object oldValue) {
110             if (util.ValueComparer.equalValue(oldValue, new Integer(17)))
111                 return new Integer(25);
112             else
113                 return new Integer(17);
114         }
115     };
116 
117     /**
118     * This property can be void, so if old value is <code> null </code>
119     * new value must be specified.
120     */
_TextLineColor()121     public void _TextLineColor() {
122         log.println("Testing with custom Property tester") ;
123         testProperty("TextLineColor", ColorTester) ;
124     }
125 }
126 
127