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 .
21 import lib
.MultiMethodTest
;
23 import lib
.StatusException
;
25 import com
.sun
.star
.form
.XApproveActionBroadcaster
;
26 import com
.sun
.star
.form
.XApproveActionListener
;
27 import com
.sun
.star
.lang
.EventObject
;
30 * Testing <code>com.sun.star.form.XApproveActionBroadcaster</code>
33 * <li><code> addApproveActionListener() </code></li>
34 * <li><code> removeApproveActionListener() </code></li>
36 * Test is <b> NOT </b> multithread compliant. <p>
37 * @see com.sun.star.form.XApproveActionBroadcaster
39 public class _XApproveActionBroadcaster
extends MultiMethodTest
{
40 public XApproveActionBroadcaster oObj
= null;
43 * Class we need to test methods.
45 protected class TestListener
implements XApproveActionListener
{
46 public boolean approve
= false ;
51 public void disposing(EventObject ev
) {}
52 public boolean approveAction(EventObject ev
) {
53 log
.println("XApproveActionListener: ActionListener was called");
59 private final TestListener listener
= new TestListener();
62 * Test calls the method. <p>
63 * Has <b> OK </b> status if the method successfully returns
64 * and no exceptions were thrown.
66 public void _addApproveActionListener() {
67 oObj
.addApproveActionListener(listener
) ;
68 tRes
.tested("addApproveActionListener()", true);
72 * Test calls the method. <p>
73 * Has <b> OK </b> status if the method successfully returns
74 * and no exceptions were thrown. <p>
75 * The following method tests are to be completed successfully before :
77 * <li> <code> addApproveActionListener() </code> : adds listener to an
81 public void _removeApproveActionListener() {
82 requiredMethod("addApproveActionListener()");
84 listener
.approve
= true ;
85 oObj
.removeApproveActionListener(listener
);
86 tRes
.tested("removeApproveActionListener()", true);
94 protected void after() {
95 log
.println("Skipping all XApproveActionBroadcaster methods, since they"
96 + " need user interaction");
97 throw new StatusException(Status
.skipped(true));