1 /* 2 * This file is part of the LibreOffice project. 3 * 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/. 7 * 8 * This file incorporates work covered by the following license notice: 9 * 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 . 17 */ 18 19 package ifc.awt; 20 21 22 import lib.MultiMethodTest; 23 24 import com.sun.star.awt.XButton; 25 26 /** 27 * Testing <code>com.sun.star.awt.XButton</code> 28 * interface methods : 29 * <ul> 30 * <li><code> addActionListener()</code></li> 31 * <li><code> removeActionListener()</code></li> 32 * <li><code> setLabel()</code></li> 33 * <li><code> setActionCommand()</code></li> 34 * </ul> <p> 35 * Test is <b> NOT </b> multithread compliant. <p> 36 * @see com.sun.star.awt.XButton 37 */ 38 public class _XButton extends MultiMethodTest { 39 40 public XButton oObj = null; 41 42 /** 43 * Listener implementation which sets flags on appropriate method calls 44 */ 45 protected static class TestActionListener implements com.sun.star.awt.XActionListener { 46 disposing(com.sun.star.lang.EventObject e)47 public void disposing(com.sun.star.lang.EventObject e) { 48 } 49 actionPerformed(com.sun.star.awt.ActionEvent e)50 public void actionPerformed(com.sun.star.awt.ActionEvent e) {} 51 } 52 53 TestActionListener listener = new TestActionListener() ; 54 55 /** 56 * !!! Can be checked only interactively !!! 57 */ _addActionListener()58 public void _addActionListener() { 59 60 boolean result = true ; 61 oObj.addActionListener(listener) ; 62 63 tRes.tested("addActionListener()", result) ; 64 } 65 66 /** 67 * !!! Can be checked only interactively !!! 68 */ _removeActionListener()69 public void _removeActionListener() { 70 71 boolean result = true ; 72 oObj.removeActionListener(listener) ; 73 74 tRes.tested("removeActionListener()", result) ; 75 } 76 77 /** 78 * Just sets some text for label. <p> 79 * Has <b> OK </b> status if no runtime exceptions occurred 80 */ _setLabel()81 public void _setLabel() { 82 83 boolean result = true ; 84 oObj.setLabel("XButton Label") ; 85 86 tRes.tested("setLabel()", result) ; 87 } 88 89 /** 90 * Just sets some command for button. <p> 91 * Has <b> OK </b> status if no runtime exceptions occurred 92 */ _setActionCommand()93 public void _setActionCommand() { 94 95 boolean result = true ; 96 oObj.setActionCommand("XButtonCommand") ; 97 98 tRes.tested("setActionCommand()", result) ; 99 } 100 101 } 102 103 104