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 
24 package ifc.form.component;
25 
26 import lib.MultiPropertyTest;
27 import util.dbg;
28 
29 import com.sun.star.form.TabulatorCycle;
30 import com.sun.star.uno.Enum;
31 
32 /**
33 * Testing <code>com.sun.star.form.component.DatabaseForm</code>
34 * service properties:
35 * <ul>
36 *  <li><code> MasterFields</code></li>
37 *  <li><code> DetailFields</code></li>
38 *  <li><code> Cycle</code></li>
39 *  <li><code> NavigationBarMode</code></li>
40 *  <li><code> AllowInserts</code></li>
41 *  <li><code> AllowUpdates</code></li>
42 *  <li><code> AllowDeletes</code></li>
43 * </ul> <p>
44 * Properties testing is automated by <code>lib.MultiPropertyTest</code>.
45 * @see com.sun.star.form.component.DatabaseForm
46 */
47 public class _DatabaseForm extends MultiPropertyTest {
48 
49     /**
50     * In this property test only debugging information output
51     * is customized.
52     */
_NavigationBarMode()53     public void _NavigationBarMode() {
54         dbg.printPropertyInfo(oObj, "NavigationBarMode");
55         testProperty("NavigationBarMode", new PropertyTester() {
56             public String toString(Object obj) {
57                 if (obj == null) {
58                     return "null";
59                 } else {
60                     return "(" + obj.getClass().toString() + ")"
61                             + ((Enum)obj).getValue();
62                 }
63             }
64         });
65     }
66 
67     /**
68     * This property new value is always fixed and debugging
69     * information output is customized.
70     */
_Cycle()71     public void _Cycle() {
72         dbg.printPropertyInfo(oObj, "Cycle");
73         testProperty("Cycle", new PropertyTester() {
74             public Object getNewValue(String propName, Object oldValue) {
75                 return TabulatorCycle.CURRENT;
76             }
77 
78             public String toString(Object obj) {
79                 if (obj == null) {
80                     return "null";
81                 } else {
82                     return "(" + obj.getClass().toString() + ")"
83                             + ((Enum)obj).getValue();
84                 }
85             }
86         });
87     }
88 }
89 
90