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.UnoControlCheckBoxModel</code>
31 * service properties :
32 * <ul>
33 *  <li><code> DefaultControl</code></li>
34 *  <li><code> Enabled</code></li>
35 *  <li><code> FontDescriptor</code></li>
36 *  <li><code> Label</code></li>
37 *  <li><code> Printable</code></li>
38 *  <li><code> State</code></li>
39 *  <li><code> Tabstop</code></li>
40 *  <li><code> TextColor</code></li>
41 *  <li><code> TriState</code></li>
42 * </ul>
43 * @see com.sun.star.awt.UnoControlCheckBoxModel
44 */
45 public class _UnoControlCheckBoxModel extends MultiPropertyTest {
46 
47     /**
48     * Redefined method returns value, that differs from property value.
49     */
50     protected PropertyTester ColorTester = new PropertyTester() {
51         protected Object getNewValue(String propName, Object oldValue) {
52             if (util.ValueComparer.equalValue(oldValue, new Integer(17)))
53                 return new Integer(25);
54             else
55                 return new Integer(17);
56         }
57     };
58 
59     /**
60     * This property can be VOID, and in case if it is so new
61     * value must defined.
62     */
_BackgroundColor()63     public void _BackgroundColor() {
64         testProperty("BackgroundColor", new PropertyTester() {
65             protected Object getNewValue(String p, Object old) {
66                 return utils.isVoid(old) ? new Integer(1234) : null ;
67             }
68         }) ;
69     }
70 
71     /**
72     * This property can be void, so if old value is <code> null </code>
73     * new value must be specified.
74     */
_Tabstop()75     public void _Tabstop() {
76         testProperty("Tabstop", new PropertyTester() {
77             protected Object getNewValue(String p, Object old) {
78                 if (utils.isVoid(old)) return new Boolean(true) ;
79                 else return null ;
80             }
81         }) ;
82     }
83 
84     /**
85     * This property can be void, so if old value is <code> null </code>
86     * new value must be specified.
87     */
_TextColor()88     public void _TextColor() {
89         testProperty("TextColor", new PropertyTester() {
90             protected Object getNewValue(String p, Object old) {
91                 if (utils.isVoid(old)) return new Integer(12345) ;
92                 else return null ;
93             }
94         }) ;
95     }
96     /**
97     * This property can be void, so if old value is <code> null </code>
98     * new value must be specified.
99     */
_TextLineColor()100     public void _TextLineColor() {
101         log.println("Testing with custom Property tester") ;
102         testProperty("TextLineColor", ColorTester) ;
103     }
104 }
105 
106