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 package mod._forms;
28 
29 import com.sun.star.beans.NamedValue;
30 import com.sun.star.beans.PropertyValue;
31 import java.io.PrintWriter;
32 
33 import lib.TestEnvironment;
34 import lib.TestParameters;
35 import util.DBTools;
36 
37 
38 
39 /**
40 * Test for object which is represented by service
41 * <code>com.sun.star.form.component.RadioButton</code>. <p>
42 *
43 * Object implements the following interfaces :
44 * <ul>
45 *  <li> <code>com::sun::star::io::XPersistObject</code></li>
46 *  <li> <code>com::sun::star::form::component::RadioButton</code></li>
47 *  <li> <code>com::sun::star::form::XReset</code></li>
48 *  <li> <code>com::sun::star::form::XBoundComponent</code></li>
49 *  <li> <code>com::sun::star::form::FormComponent</code></li>
50 *  <li> <code>com::sun::star::beans::XFastPropertySet</code></li>
51 *  <li> <code>com::sun::star::beans::XMultiPropertySet</code></li>
52 *  <li> <code>com::sun::star::form::XUpdateBroadcaster</code></li>
53 *  <li> <code>com::sun::star::form::DataAwareControlModel</code></li>
54 *  <li> <code>com::sun::star::awt::UnoControlRadioButtonModel</code></li>
55 *  <li> <code>com::sun::star::beans::XPropertyState</code></li>
56 *  <li> <code>com::sun::star::form::FormControlModel</code></li>
57 *  <li> <code>com::sun::star::container::XNamed</code></li>
58 *  <li> <code>com::sun::star::lang::XComponent</code></li>
59 *  <li> <code>com::sun::star::lang::XEventListener</code></li>
60 *  <li> <code>com::sun::star::beans::XPropertyAccess</code></li>
61 *  <li> <code>com::sun::star::beans::XPropertyContainer</code></li>
62 *  <li> <code>com::sun::star::beans::XPropertySet</code></li>
63 *  <li> <code>com::sun::star::form::XLoadListener</code></li>
64 *  <li> <code>com::sun::star::container::XChild</code></li>
65 * </ul> <p>
66 * This object test <b> is NOT </b> designed to be run in several
67 * threads concurently.
68 * @see com.sun.star.io.XPersistObject
69 * @see com.sun.star.form.component.RadioButton
70 * @see com.sun.star.form.XReset
71 * @see com.sun.star.form.XBoundComponent
72 * @see com.sun.star.form.FormComponent
73 * @see com.sun.star.beans.XFastPropertySet
74 * @see com.sun.star.beans.XMultiPropertySet
75 * @see com.sun.star.form.XUpdateBroadcaster
76 * @see com.sun.star.form.DataAwareControlModel
77 * @see com.sun.star.awt.UnoControlRadioButtonModel
78 * @see com.sun.star.beans.XPropertyState
79 * @see com.sun.star.form.FormControlModel
80 * @see com.sun.star.container.XNamed
81 * @see com.sun.star.lang.XComponent
82 * @see com.sun.star.lang.XEventListener
83 * @see com.sun.star.beans.XPropertyAccess
84 * @see com.sun.star.beans.XPropertyContainer
85 * @see com.sun.star.beans.XPropertySet
86 * @see com.sun.star.form.XLoadListener
87 * @see com.sun.star.container.XChild
88 * @see ifc.io._XPersistObject
89 * @see ifc.form.component._RadioButton
90 * @see ifc.form._XReset
91 * @see ifc.form._XBoundComponent
92 * @see ifc.form._FormComponent
93 * @see ifc.beans._XFastPropertySet
94 * @see ifc.beans._XMultiPropertySet
95 * @see ifc.form._XUpdateBroadcaster
96 * @see ifc.form._DataAwareControlModel
97 * @see ifc.awt._UnoControlRadioButtonModel
98 * @see ifc.beans._XPropertyState
99 * @see ifc.form._FormControlModel
100 * @see ifc.container._XNamed
101 * @see ifc.lang._XComponent
102 * @see ifc.lang._XEventListener
103 * @see ifc.beans._XPropertySet
104 * @see ifc.form._XLoadListener
105 * @see ifc.container._XChild
106 */
107 public class ORadioButtonModel extends GenericModelTest {
108 
109     /**
110      * Set some member variable of the super class <CODE>GenericModelTest</CODE>:
111      * <pre>
112      *    super.m_ChangePropertyName</CODE> = "State";
113      *    super.m_kindOfControl</CODE>="RadioButton";
114      *    super.m_ObjectName</CODE> = "RadioButton";
115      *    NamedValue myProp = new NamedValue();
116      *        myProp.Name = "DataField";
117      *        myProp.Value = DBTools.TST_STRING_F;
118      *        super.m_propertiesToSet.add(myProp);
119      *    super.m_LCShape_Type = "GroupBox";
120      * </pre>
121      * Then <CODE>super.initialize()</CODE> was called.
122      * @param tParam the test parameter
123      * @param log the log writer
124      */
125 
126     protected void initialize(TestParameters tParam, PrintWriter log) {
127 
128         super.initialize(tParam, log);
129         super.m_ChangePropertyName = "State";
130 
131         super.m_kindOfControl="RadioButton";
132 
133         super.m_ObjectName = "stardiv.one.form.component.RadioButton";
134 
135         NamedValue myProp = new NamedValue();
136         myProp.Name = "DataField";
137         myProp.Value = DBTools.TST_STRING_F;
138         super.m_propertiesToSet.add(myProp);
139 
140         super.m_LCShape_Type = "GroupBox";
141 
142     }
143     /**
144      * calls <CODE>cleanup()</CODE> from it's super class
145      * @param tParam the test parameter
146      * @param log the log writer
147      */
148     protected void cleanup(TestParameters tParam, PrintWriter log) {
149         super.cleanup(tParam, log);
150     }
151 
152 
153     /**
154      * calls <CODE>createTestEnvironment()</CODE> from it's super class
155      * @param Param the test parameter
156      * @param log the log writer
157      * @return lib.TestEnvironment
158      */
159     protected synchronized TestEnvironment createTestEnvironment(TestParameters Param,
160                                                                  PrintWriter log) {
161         TestEnvironment tEnv = super.createTestEnvironment(Param, log);
162         tEnv.addObjRelation("DataAwareControlModel.NewFieldName",
163                             DBTools.TST_INT_F);
164         PropertyValue prop = new PropertyValue();
165         prop.Name = "HelpText";
166         prop.Value = "new Help Text since XPropertyAccess";
167         tEnv.addObjRelation("XPropertyAccess.propertyToChange", prop);
168         tEnv.addObjRelation("XPropertyContainer.propertyNotRemovable", "HelpText");
169 
170         return tEnv;
171     }
172 
173 } // finish class ORadioButtonModel
174