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