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.awt;
25 
26 
27 import lib.MultiMethodTest;
28 
29 import com.sun.star.awt.XButton;
30 
31 /**
32 * Testing <code>com.sun.star.awt.XButton</code>
33 * interface methods :
34 * <ul>
35 *  <li><code> addActionListener()</code></li>
36 *  <li><code> removeActionListener()</code></li>
37 *  <li><code> setLabel()</code></li>
38 *  <li><code> setActionCommand()</code></li>
39 * </ul> <p>
40 * Test is <b> NOT </b> multithread compilant. <p>
41 * @see com.sun.star.awt.XButton
42 */
43 public class _XButton extends MultiMethodTest {
44 
45     public XButton oObj = null;
46 
47     /**
48     * Listener implementation which sets flags on appropriate method calls
49     */
50     protected class TestActionListener implements com.sun.star.awt.XActionListener {
51         public boolean disposingCalled = false ;
52         public boolean actionPerformedCalled = false ;
53 
disposing(com.sun.star.lang.EventObject e)54         public void disposing(com.sun.star.lang.EventObject e) {
55             disposingCalled = true ;
56         }
57 
actionPerformed(com.sun.star.awt.ActionEvent e)58         public void actionPerformed(com.sun.star.awt.ActionEvent e) {
59             actionPerformedCalled = true ;
60         }
61 
62     }
63 
64     TestActionListener listener = new TestActionListener() ;
65 
66     /**
67     * !!! Can be checked only interactively !!!
68     */
_addActionListener()69     public void _addActionListener() {
70 
71         boolean result = true ;
72         oObj.addActionListener(listener) ;
73 
74         tRes.tested("addActionListener()", result) ;
75     }
76 
77     /**
78     * !!! Can be checked only interactively !!!
79     */
_removeActionListener()80     public void _removeActionListener() {
81 
82         boolean result = true ;
83         oObj.removeActionListener(listener) ;
84 
85         tRes.tested("removeActionListener()", result) ;
86     }
87 
88     /**
89     * Just sets some text for label. <p>
90     * Has <b> OK </b> status if no runtime exceptions occured
91     */
_setLabel()92     public void _setLabel() {
93 
94         boolean result = true ;
95         oObj.setLabel("XButton Label") ;
96 
97         tRes.tested("setLabel()", result) ;
98     }
99 
100     /**
101     * Just sets some command for button. <p>
102     * Has <b> OK </b> status if no runtime exceptions occured
103     */
_setActionCommand()104     public void _setActionCommand() {
105 
106         boolean result = true ;
107         oObj.setActionCommand("XButtonComand") ;
108 
109         tRes.tested("setActionCommand()", result) ;
110     }
111 
112 }
113 
114 
115