xref: /AOO41X/main/qadevOOo/tests/java/ifc/awt/_UnoControlImageControlModel.java (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 package ifc.awt;
29 
30 import lib.MultiPropertyTest;
31 import util.utils;
32 
33 /**
34 * Testing <code>com.sun.star.awt.UnoControlImageControlModel</code>
35 * service properties :
36 * <ul>
37 *  <li><code> BackgroundColor </code></li>
38 *  <li><code> Border </code></li>
39 *  <li><code> DefaultControl </code></li>
40 *  <li><code> Enabled </code></li>
41 *  <li><code> ImageURL </code></li>
42 *  <li><code> Printable </code></li>
43 * </ul>
44 * Almost all properties testing is automated by
45 * <code>lib.MultiPropertyTest</code>.
46 * @see com.sun.star.awt.UnoControlImageControlModel
47 */
48 public class _UnoControlImageControlModel extends MultiPropertyTest {
49 
50     /**
51     * Custom <code>PropertyTester</code> used in <code>ImageURL</code> test.
52     */
53     protected PropertyTester URLTester = new PropertyTester() {
54         protected Object getNewValue(String propName, Object oldValue)
55                 throws java.lang.IllegalArgumentException {
56             if (oldValue.equals(util.utils.getFullTestURL("space-metal.jpg")))
57                 return util.utils.getFullTestURL("crazy-blue.jpg");
58             else
59                 return util.utils.getFullTestURL("space-metal.jpg");
60         }
61     } ;
62 
63     /**
64     * Test changes one image URL onto another.
65     */
66     public void _ImageURL() {
67         testProperty("ImageURL", URLTester) ;
68     }
69 
70     /**
71     * This property can be VOID, and in case if it is so new
72     * value must defined.
73     */
74     public void _BackgroundColor() {
75         testProperty("BackgroundColor", new PropertyTester() {
76             protected Object getNewValue(String propName, Object oldValue) {
77                 return utils.isVoid(oldValue) ? new Integer(8945) :
78                     super.getNewValue(propName, oldValue) ;
79             }
80         }) ;
81     }
82 
83    /**
84     * This property can be VOID, and in case if it is so new
85     * value must defined.
86     */
87     public void _BorderColor() {
88         testProperty("BorderColor", new PropertyTester() {
89             protected Object getNewValue(String p, Object old) {
90                 return utils.isVoid(old) ? new Integer(1234) : null ;
91             }
92         }) ;
93     }
94 
95     /**
96     * This property can be void, so if old value is <code> null </code>
97     * new value must be specified.
98     */
99     public void _Tabstop() {
100         testProperty("Tabstop", new PropertyTester() {
101             protected Object getNewValue(String p, Object v) {
102                 return utils.isVoid(v) ? new Boolean(true) :
103                     null ;
104             }
105         }) ;
106     }
107 
108 }
109 
110