1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _XButton.java,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
34 import lib
.MultiMethodTest
;
36 import com
.sun
.star
.awt
.XButton
;
39 * Testing <code>com.sun.star.awt.XButton</code>
42 * <li><code> addActionListener()</code></li>
43 * <li><code> removeActionListener()</code></li>
44 * <li><code> setLabel()</code></li>
45 * <li><code> setActionCommand()</code></li>
47 * Test is <b> NOT </b> multithread compilant. <p>
48 * @see com.sun.star.awt.XButton
50 public class _XButton
extends MultiMethodTest
{
52 public XButton oObj
= null;
55 * Listener implementation which sets flags on appropriate method calls
57 protected class TestActionListener
implements com
.sun
.star
.awt
.XActionListener
{
58 public boolean disposingCalled
= false ;
59 public boolean actionPerformedCalled
= false ;
61 public void disposing(com
.sun
.star
.lang
.EventObject e
) {
62 disposingCalled
= true ;
65 public void actionPerformed(com
.sun
.star
.awt
.ActionEvent e
) {
66 actionPerformedCalled
= true ;
71 TestActionListener listener
= new TestActionListener() ;
74 * !!! Can be checked only interactively !!!
76 public void _addActionListener() {
78 boolean result
= true ;
79 oObj
.addActionListener(listener
) ;
81 tRes
.tested("addActionListener()", result
) ;
85 * !!! Can be checked only interactively !!!
87 public void _removeActionListener() {
89 boolean result
= true ;
90 oObj
.removeActionListener(listener
) ;
92 tRes
.tested("removeActionListener()", result
) ;
96 * Just sets some text for label. <p>
97 * Has <b> OK </b> status if no runtime exceptions occured
99 public void _setLabel() {
101 boolean result
= true ;
102 oObj
.setLabel("XButton Label") ;
104 tRes
.tested("setLabel()", result
) ;
108 * Just sets some command for button. <p>
109 * Has <b> OK </b> status if no runtime exceptions occured
111 public void _setActionCommand() {
113 boolean result
= true ;
114 oObj
.setActionCommand("XButtonComand") ;
116 tRes
.tested("setActionCommand()", result
) ;