1 /*
2  * This file is part of the LibreOffice project.
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  *
8  * This file incorporates work covered by the following license notice:
9  *
10  *   Licensed to the Apache Software Foundation (ASF) under one or more
11  *   contributor license agreements. See the NOTICE file distributed
12  *   with this work for additional information regarding copyright
13  *   ownership. The ASF licenses this file to you under the Apache
14  *   License, Version 2.0 (the "License"); you may not use this file
15  *   except in compliance with the License. You may obtain a copy of
16  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
17  */
18 package mod._forms;
19 
20 import com.sun.star.beans.NamedValue;
21 import java.io.PrintWriter;
22 
23 import lib.TestParameters;
24 import util.DBTools;
25 
26 
27 
28 /**
29 * Test for object which is represented by service
30 * <code>com.sun.star.form.component.DateField</code>. <p>
31 * Object implements the following interfaces :
32 * <ul>
33 *  <li> <code>com::sun::star::io::XPersistObject</code></li>
34 *  <li> <code>com::sun::star::awt::UnoControlDateFieldModel</code></li>
35 *  <li> <code>com::sun::star::form::XReset</code></li>
36 *  <li> <code>com::sun::star::form::XBoundComponent</code></li>
37 *  <li> <code>com::sun::star::form::FormComponent</code></li>
38 *  <li> <code>com::sun::star::form::component::DateField</code></li>
39 *  <li> <code>com::sun::star::beans::XFastPropertySet</code></li>
40 *  <li> <code>com::sun::star::beans::XMultiPropertySet</code></li>
41 *  <li> <code>com::sun::star::form::XUpdateBroadcaster</code></li>
42 *  <li> <code>com::sun::star::form::DataAwareControlModel</code></li>
43 *  <li> <code>com::sun::star::beans::XPropertyState</code></li>
44 *  <li> <code>com::sun::star::form::FormControlModel</code></li>
45 *  <li> <code>com::sun::star::container::XNamed</code></li>
46 *  <li> <code>com::sun::star::lang::XComponent</code></li>
47 *  <li> <code>com::sun::star::lang::XEventListener</code></li>
48 *  <li> <code>com::sun::star::beans::XPropertyAccess</code></li>
49 *  <li> <code>com::sun::star::beans::XPropertyContainer</code></li>
50 *  <li> <code>com::sun::star::beans::XPropertySet</code></li>
51 *  <li> <code>com::sun::star::form::XLoadListener</code></li>
52 *  <li> <code>com::sun::star::container::XChild</code></li>
53 * </ul>
54 * The following files used by this test :
55 * <ul>
56 *  <li><b> TestDB </b> (directory) : directory with test database </li>
57 *  <li><b> TestDB/TestDB.dbf </b> : table file. See
58 *    {@link util.DBTools DBTools} class for more information.</li>
59 * </ul> <p>
60 * This object test <b> is NOT </b> designed to be run in several
61 * threads concurrently.
62 * @see com.sun.star.io.XPersistObject
63 * @see com.sun.star.awt.UnoControlDateFieldModel
64 * @see com.sun.star.form.XReset
65 * @see com.sun.star.form.XBoundComponent
66 * @see com.sun.star.form.FormComponent
67 * @see com.sun.star.form.component.DateField
68 * @see com.sun.star.beans.XFastPropertySet
69 * @see com.sun.star.beans.XMultiPropertySet
70 * @see com.sun.star.form.XUpdateBroadcaster
71 * @see com.sun.star.form.DataAwareControlModel
72 * @see com.sun.star.beans.XPropertyState
73 * @see com.sun.star.form
74 * @see com.sun.star.container.XNamed
75 * @see com.sun.star.lang.XComponent
76 * @see com.sun.star.lang.XEventListener
77 * @see com.sun.star.beans.XPropertyAccess
78 * @see com.sun.star.beans.XPropertyContainer
79 * @see com.sun.star.beans.XPropertySet
80 * @see com.sun.star.form.XLoadListener
81 * @see com.sun.star.container.XChild
82 * @see ifc.io._XPersistObject
83 * @see ifc.awt._UnoControlDateFieldModel
84 * @see ifc.form._XReset
85 * @see ifc.form._XBoundComponent
86 * @see ifc.form._FormComponent
87 * @see ifc.form.component._DateField
88 * @see ifc.beans._XFastPropertySet
89 * @see ifc.beans._XMultiPropertySet
90 * @see ifc.form._XUpdateBroadcaster
91 * @see ifc.form._DataAwareControlModel
92 * @see ifc.beans._XPropertyState
93 * @see ifc.form._FormControlModel
94 * @see ifc.container._XNamed
95 * @see ifc.lang._XComponent
96 * @see ifc.lang._XEventListener
97 * @see ifc.beans._XPropertySet
98 * @see ifc.form._XLoadListener
99 * @see ifc.container._XChild
100 */
101 public class ODateModel extends GenericModelTest {
102 
103     /**
104      * Set some member variable of the super class <CODE>GenericModelTest</CODE>:
105      * <pre>
106      *    super.m_ChangePropertyName = "Date";
107      *    super.m_kindOfControl="DateField";
108      *    super.m_ObjectName = "stardiv.one.form.component.DateField";
109      *
110      *    NamedValue DataField = new NamedValue();
111      *    DataField.Name = "DataField";
112      *    DataField.Value = DBTools.TST_DATE_F;
113      *    super.m_propertiesToSet.add(DataField);
114      *
115      *    NamedValue Date = new NamedValue();
116      *    Date.Name = "Date";
117      *    Date.Value = Integer.valueOf(DBTools.TST_DATE);
118      *    super.m_propertiesToSet.add(Date);
119      *    super.m_LCShape_Type = "FixedText";
120      * </pre>
121      * Then <CODE>super.initialize()</CODE> was called.
122      * @param tParam the test parameter
123      * @param log the log writer
124      */
125     @Override
initialize(TestParameters tParam, PrintWriter log)126     protected void initialize(TestParameters tParam, PrintWriter log) throws Exception {
127 
128         super.initialize(tParam, log);
129 
130         super.m_ChangePropertyName = "Date";
131 
132         super.m_kindOfControl="DateField";
133 
134         super.m_ObjectName = "stardiv.one.form.component.DateField";
135 
136         NamedValue DataField = new NamedValue();
137         DataField.Name = "DataField";
138         DataField.Value = DBTools.TST_DATE_F;
139         super.m_propertiesToSet.add(DataField);
140 
141         NamedValue Date = new NamedValue();
142         Date.Name = "Date";
143         Date.Value = new com.sun.star.util.Date();
144         super.m_propertiesToSet.add(Date);
145 
146         super.m_LCShape_Type = "FixedText";
147 
148     }
149 
150 } // finish class ODateModel
151