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.UnoControlImageControlModel</code>
31 * service properties :
32 * <ul>
33 *  <li><code> BackgroundColor </code></li>
34 *  <li><code> Border </code></li>
35 *  <li><code> DefaultControl </code></li>
36 *  <li><code> Enabled </code></li>
37 *  <li><code> ImageURL </code></li>
38 *  <li><code> Printable </code></li>
39 * </ul>
40 * Almost all properties testing is automated by
41 * <code>lib.MultiPropertyTest</code>.
42 * @see com.sun.star.awt.UnoControlImageControlModel
43 */
44 public class _UnoControlImageControlModel extends MultiPropertyTest {
45 
46     /**
47     * Custom <code>PropertyTester</code> used in <code>ImageURL</code> test.
48     */
49     protected PropertyTester URLTester = new PropertyTester() {
50         protected Object getNewValue(String propName, Object oldValue)
51                 throws java.lang.IllegalArgumentException {
52             if (oldValue.equals(util.utils.getFullTestURL("space-metal.jpg")))
53                 return util.utils.getFullTestURL("crazy-blue.jpg");
54             else
55                 return util.utils.getFullTestURL("space-metal.jpg");
56         }
57     } ;
58 
59     /**
60     * Test changes one image URL onto another.
61     */
_ImageURL()62     public void _ImageURL() {
63         testProperty("ImageURL", URLTester) ;
64     }
65 
66     /**
67     * This property can be VOID, and in case if it is so new
68     * value must defined.
69     */
_BackgroundColor()70     public void _BackgroundColor() {
71         testProperty("BackgroundColor", new PropertyTester() {
72             protected Object getNewValue(String propName, Object oldValue) {
73                 return utils.isVoid(oldValue) ? new Integer(8945) :
74                     super.getNewValue(propName, oldValue) ;
75             }
76         }) ;
77     }
78 
79    /**
80     * This property can be VOID, and in case if it is so new
81     * value must defined.
82     */
_BorderColor()83     public void _BorderColor() {
84         testProperty("BorderColor", new PropertyTester() {
85             protected Object getNewValue(String p, Object old) {
86                 return utils.isVoid(old) ? new Integer(1234) : null ;
87             }
88         }) ;
89     }
90 
91     /**
92     * This property can be void, so if old value is <code> null </code>
93     * new value must be specified.
94     */
_Tabstop()95     public void _Tabstop() {
96         testProperty("Tabstop", new PropertyTester() {
97             protected Object getNewValue(String p, Object v) {
98                 return utils.isVoid(v) ? new Boolean(true) :
99                     null ;
100             }
101         }) ;
102     }
103 
104 }
105 
106