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 package mod._forms;
24 
25 import com.sun.star.beans.NamedValue;
26 import java.io.PrintWriter;
27 
28 import lib.TestEnvironment;
29 import lib.TestParameters;
30 import util.DBTools;
31 
32 
33 
34 /**
35 * Test for object which is represented by service
36 * <code>com.sun.star.form.component.DateField</code>. <p>
37 * Object implements the following interfaces :
38 * <ul>
39 *  <li> <code>com::sun::star::io::XPersistObject</code></li>
40 *  <li> <code>com::sun::star::awt::UnoControlDateFieldModel</code></li>
41 *  <li> <code>com::sun::star::form::XReset</code></li>
42 *  <li> <code>com::sun::star::form::XBoundComponent</code></li>
43 *  <li> <code>com::sun::star::form::FormComponent</code></li>
44 *  <li> <code>com::sun::star::form::component::DateField</code></li>
45 *  <li> <code>com::sun::star::beans::XFastPropertySet</code></li>
46 *  <li> <code>com::sun::star::beans::XMultiPropertySet</code></li>
47 *  <li> <code>com::sun::star::form::XUpdateBroadcaster</code></li>
48 *  <li> <code>com::sun::star::form::DataAwareControlModel</code></li>
49 *  <li> <code>com::sun::star::beans::XPropertyState</code></li>
50 *  <li> <code>com::sun::star::form::FormControlModel</code></li>
51 *  <li> <code>com::sun::star::container::XNamed</code></li>
52 *  <li> <code>com::sun::star::lang::XComponent</code></li>
53 *  <li> <code>com::sun::star::lang::XEventListener</code></li>
54 *  <li> <code>com::sun::star::beans::XPropertyAccess</code></li>
55 *  <li> <code>com::sun::star::beans::XPropertyContainer</code></li>
56 *  <li> <code>com::sun::star::beans::XPropertySet</code></li>
57 *  <li> <code>com::sun::star::form::XLoadListener</code></li>
58 *  <li> <code>com::sun::star::container::XChild</code></li>
59 * </ul>
60 * The following files used by this test :
61 * <ul>
62 *  <li><b> TestDB </b> (directory) : directory with test database </li>
63 *  <li><b> TestDB/TestDB.dbf </b> : table file. See
64 *    {@link util.DBTools DBTools} class for more information.</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.awt.UnoControlDateFieldModel
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.form.component.DateField
74 * @see com.sun.star.beans.XFastPropertySet
75 * @see com.sun.star.beans.XMultiPropertySet
76 * @see com.sun.star.form.XUpdateBroadcaster
77 * @see com.sun.star.form.DataAwareControlModel
78 * @see com.sun.star.beans.XPropertyState
79 * @see com.sun.star.form
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.awt._UnoControlDateFieldModel
90 * @see ifc.form._XReset
91 * @see ifc.form._XBoundComponent
92 * @see ifc.form._FormComponent
93 * @see ifc.form.component._DateField
94 * @see ifc.beans._XFastPropertySet
95 * @see ifc.beans._XMultiPropertySet
96 * @see ifc.form._XUpdateBroadcaster
97 * @see ifc.form._DataAwareControlModel
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 ODateModel extends GenericModelTest {
108 
109     /**
110      * Set some member variable of the super class <CODE>GenericModelTest</CODE>:
111      * <pre>
112      *    super.m_ChangePropertyName = "Date";
113      *    super.m_kindOfControl="DateField";
114      *    super.m_ObjectName = "stardiv.one.form.component.DateField";
115      *
116      *    NamedValue DataField = new NamedValue();
117      *    DataField.Name = "DataField";
118      *    DataField.Value = DBTools.TST_DATE_F;
119      *    super.m_propertiesToSet.add(DataField);
120      *
121      *    NamedValue Date = new NamedValue();
122      *    Date.Name = "Date";
123      *    Date.Value = new Integer(DBTools.TST_DATE);
124      *    super.m_propertiesToSet.add(Date);
125      *    super.m_LCShape_Type = "FixedText";
126      * </pre>
127      * Then <CODE>super.initialize()</CODE> was called.
128      * @param tParam the test parameter
129      * @param log the log writer
130      */
initialize(TestParameters tParam, PrintWriter log)131     protected void initialize(TestParameters tParam, PrintWriter log) {
132 
133         super.initialize(tParam, log);
134 
135         super.m_ChangePropertyName = "Date";
136 
137         super.m_kindOfControl="DateField";
138 
139         super.m_ObjectName = "stardiv.one.form.component.DateField";
140 
141         NamedValue DataField = new NamedValue();
142         DataField.Name = "DataField";
143         DataField.Value = DBTools.TST_DATE_F;
144         super.m_propertiesToSet.add(DataField);
145 
146         NamedValue Date = new NamedValue();
147         Date.Name = "Date";
148         Date.Value = new Integer(DBTools.TST_DATE);
149         super.m_propertiesToSet.add(Date);
150 
151         super.m_LCShape_Type = "FixedText";
152 
153     }
154     /**
155      * calls <CODE>cleanup()</CODE> from it's super class
156      * @param tParam the test parameter
157      * @param log the log writer
158      */
cleanup(TestParameters tParam, PrintWriter log)159     protected void cleanup(TestParameters tParam, PrintWriter log) {
160         super.cleanup(tParam, log);
161     }
162 
163 
164     /**
165      * calls <CODE>createTestEnvironment()</CODE> from it's super class
166      * @param Param the test parameter
167      * @param log the log writer
168      * @return lib.TestEnvironment
169      */
createTestEnvironment(TestParameters Param, PrintWriter log)170     protected synchronized TestEnvironment createTestEnvironment(TestParameters Param,
171                                                                  PrintWriter log) {
172         return super.createTestEnvironment(Param, log);
173     }
174 } // finish class ODateModel
175