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