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.UnoControlComboBoxModel</code>
31 * service properties :
32 * <ul>
33 *  <li><code> Autocomplete</code></li>
34 *  <li><code> BackgroundColor</code></li>
35 *  <li><code> Border</code></li>
36 *  <li><code> DefaultControl</code></li>
37 *  <li><code> Dropdown</code></li>
38 *  <li><code> Enabled</code></li>
39 *  <li><code> FontDescriptor</code></li>
40 *  <li><code> LineCount</code></li>
41 *  <li><code> MaxTextLen</code></li>
42 *  <li><code> Printable</code></li>
43 *  <li><code> ReadOnly</code></li>
44 *  <li><code> StringItemList</code></li>
45 *  <li><code> Tabstop</code></li>
46 *  <li><code> Text</code></li>
47 *  <li><code> TextColor</code></li>
48 * </ul>
49 * @see com.sun.star.awt.UnoControlComboBoxModel
50 */
51 public class _UnoControlComboBoxModel extends MultiPropertyTest {
52 
53     /**
54     * This property can be VOID, and in case if it is so new
55     * value must defined.
56     */
_BackgroundColor()57     public void _BackgroundColor() {
58         testProperty("BackgroundColor", new PropertyTester() {
59             protected Object getNewValue(String p, Object old) {
60                 return utils.isVoid(old) ? new Integer(1234) : null ;
61             }
62         }) ;
63     }
64 
65     /**
66     * This property can be VOID, and in case if it is so new
67     * value must defined.
68     */
_BorderColor()69     public void _BorderColor() {
70         testProperty("BorderColor", new PropertyTester() {
71             protected Object getNewValue(String p, Object old) {
72                 return utils.isVoid(old) ? new Integer(1234) : null ;
73             }
74         }) ;
75     }
76 
77     /**
78     * This property can be VOID, and in case if it is so new
79     * value must defined.
80     */
_TextColor()81     public void _TextColor() {
82         testProperty("TextColor", new PropertyTester() {
83             protected Object getNewValue(String p, Object old) {
84                 return utils.isVoid(old) ? new Integer(4321) : null ;
85             }
86         }) ;
87     }
88 
89     /**
90     * This property can be VOID, and in case if it is so new
91     * value must defined.
92     */
_Tabstop()93     public void _Tabstop() {
94         testProperty("Tabstop", new PropertyTester() {
95             protected Object getNewValue(String p, Object old) {
96                 return utils.isVoid(old) ? new Boolean(true) : null ;
97             }
98         }) ;
99     }
100 
_Text()101     public void _Text() {
102         try {
103             oObj.setPropertyValue("MaxTextLen",new Short((short)0));
104         } catch (com.sun.star.beans.UnknownPropertyException ue) {
105         } catch (com.sun.star.beans.PropertyVetoException pe) {
106         } catch (com.sun.star.lang.IllegalArgumentException ie) {
107         } catch (com.sun.star.lang.WrappedTargetException we) {
108         }
109         testProperty("Text");
110     }
111 
112     /**
113     * Redefined method returns value, that differs from property value.
114     */
115     protected PropertyTester ColorTester = new PropertyTester() {
116         protected Object getNewValue(String propName, Object oldValue) {
117             if (util.ValueComparer.equalValue(oldValue, new Integer(17)))
118                 return new Integer(25);
119             else
120                 return new Integer(17);
121         }
122     };
123 
124     /**
125     * This property can be void, so if old value is <code> null </code>
126     * new value must be specified.
127     */
_TextLineColor()128     public void _TextLineColor() {
129         log.println("Testing with custom Property tester") ;
130         testProperty("TextLineColor", ColorTester) ;
131     }
132 
133 } //EOF UnoControlComboBoxModel
134 
135