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.text;
25 
26 import lib.MultiMethodTest;
27 import util.XInstCreator;
28 
29 import com.sun.star.text.XFootnote;
30 import com.sun.star.uno.XInterface;
31 
32 
33 /**
34  * Testing <code>com.sun.star.text.XFootnote</code>
35  * interface methods :
36  * <ul>
37  *  <li><code> getLabel()</code></li>
38  *  <li><code> setLabel()</code></li>
39  * </ul> <p>
40  * Test is <b> NOT </b> multithread compilant. <p>
41  * @see com.sun.star.text.XFootnote
42  */
43 public class _XFootnote extends MultiMethodTest {
44 
45     public XFootnote oObj = null;        // oObj filled by MultiMethodTest
46 
47     XInstCreator info = null;               // instance creator
48     XInterface oInt = null;
49 
50     /**
51      * Test calls the method. <p>
52      * Has <b> OK </b> status if the method returns not
53      * <code>null</code> value.
54      */
_getLabel()55     public void _getLabel(){
56 
57         boolean result;
58 
59         // testing getLabel
60         log.println("Testing getLabel() ... ");
61         String oldLabel = oObj.getLabel();
62         log.println("getLabel: Old Value: " + oldLabel);
63         result = (oldLabel != null);
64         if (result) {
65             log.println(" ... getLabel() - OK");
66         }
67         else {
68             log.println(" ... getLabel() - FAILED");
69         }
70         tRes.tested("getLabel()", result);
71 
72     } // finished getLabel
73 
74 
75     /**
76      * Sets a new label, then using <code>getLabel</code> method
77      * checks if the label was set. <p>
78      *
79      * Has <b>OK</b> status if set and get values are equal.
80      */
_setLabel()81     public void _setLabel(){
82 
83         boolean result;
84         String str = "New XFootnote Label";
85 
86         // testing getLabel
87         log.println("Testing setLabel() ... ");
88         log.println("New label : " + str);
89 
90         String oldLabel = oObj.getLabel();
91         log.println("Old label was: " + oldLabel);
92         oObj.setLabel(str);
93 
94         String res = oObj.getLabel();
95 
96         log.println("verify setLabel result");
97         result = (res.equals(str));
98         if (result) {
99             log.println(" ... setLabel() - OK");
100         }
101         else {
102             log.println(" ... setLabel() - FAILED");
103         }
104         tRes.tested("setLabel()", result);
105 
106         log.println("restoring the old label value");
107         oObj.setLabel(oldLabel);
108     } // finished setLabel
109 
110 }
111 
112 
113