2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 import lib
.MultiMethodTest
;
24 import com
.sun
.star
.awt
.XButton
;
27 * Testing <code>com.sun.star.awt.XButton</code>
30 * <li><code> addActionListener()</code></li>
31 * <li><code> removeActionListener()</code></li>
32 * <li><code> setLabel()</code></li>
33 * <li><code> setActionCommand()</code></li>
35 * Test is <b> NOT </b> multithread compliant. <p>
36 * @see com.sun.star.awt.XButton
38 public class _XButton
extends MultiMethodTest
{
40 public XButton oObj
= null;
43 * Listener implementation which sets flags on appropriate method calls
45 protected class TestActionListener
implements com
.sun
.star
.awt
.XActionListener
{
46 public boolean disposingCalled
= false ;
47 public boolean actionPerformedCalled
= false ;
49 public void disposing(com
.sun
.star
.lang
.EventObject e
) {
50 disposingCalled
= true ;
53 public void actionPerformed(com
.sun
.star
.awt
.ActionEvent e
) {
54 actionPerformedCalled
= true ;
59 TestActionListener listener
= new TestActionListener() ;
62 * !!! Can be checked only interactively !!!
64 public void _addActionListener() {
66 boolean result
= true ;
67 oObj
.addActionListener(listener
) ;
69 tRes
.tested("addActionListener()", result
) ;
73 * !!! Can be checked only interactively !!!
75 public void _removeActionListener() {
77 boolean result
= true ;
78 oObj
.removeActionListener(listener
) ;
80 tRes
.tested("removeActionListener()", result
) ;
84 * Just sets some text for label. <p>
85 * Has <b> OK </b> status if no runtime exceptions occurred
87 public void _setLabel() {
89 boolean result
= true ;
90 oObj
.setLabel("XButton Label") ;
92 tRes
.tested("setLabel()", result
) ;
96 * Just sets some command for button. <p>
97 * Has <b> OK </b> status if no runtime exceptions occurred
99 public void _setActionCommand() {
101 boolean result
= true ;
102 oObj
.setActionCommand("XButtonCommand") ;
104 tRes
.tested("setActionCommand()", result
) ;