1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
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.
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).
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.
26 ************************************************************************/
30 import lib
.MultiMethodTest
;
32 import lib
.StatusException
;
34 import com
.sun
.star
.form
.XApproveActionBroadcaster
;
35 import com
.sun
.star
.form
.XApproveActionListener
;
36 import com
.sun
.star
.lang
.EventObject
;
39 * Testing <code>com.sun.star.form.XApproveActionBroadcaster</code>
42 * <li><code> addApproveActionListener() </code></li>
43 * <li><code> removeApproveActionListener() </code></li>
45 * Test is <b> NOT </b> multithread compilant. <p>
46 * @see com.sun.star.form.XApproveActionBroadcaster
48 public class _XApproveActionBroadcaster
extends MultiMethodTest
{
49 public XApproveActionBroadcaster oObj
= null;
52 * Class we need to test methods.
54 protected class TestListener
implements XApproveActionListener
{
55 public boolean approve
= false ;
60 public void disposing(EventObject ev
) {}
61 public boolean approveAction(EventObject ev
) {
62 log
.println("XApproveActionListener: ActionListener was called");
68 private TestListener listener
= new TestListener();
71 * Test calls the method. <p>
72 * Has <b> OK </b> status if the method successfully returns
73 * and no exceptions were thrown.
75 public void _addApproveActionListener() {
76 oObj
.addApproveActionListener(listener
) ;
77 tRes
.tested("addApproveActionListener()", true);
81 * Test calls the method. <p>
82 * Has <b> OK </b> status if the method successfully returns
83 * and no exceptions were thrown. <p>
84 * The following method tests are to be completed successfully before :
86 * <li> <code> addApproveActionListener() </code> : adds listener to an
90 public void _removeApproveActionListener() {
91 requiredMethod("addApproveActionListener()");
93 listener
.approve
= true ;
94 oObj
.removeApproveActionListener(listener
);
95 tRes
.tested("removeApproveActionListener()", true);
102 protected void after() {
103 log
.println("Skipping all XApproveActionBroadcaster methods, since they"
104 + " need user interaction");
105 throw new StatusException(Status
.skipped(true));