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