Branch libreoffice-5-0-4
[LibreOffice.git] / qadevOOo / tests / java / ifc / form / _XApproveActionBroadcaster.java
blobf02f0251629ebb09b1a3f27721d81d87e07979f9
1 /*
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 .
19 package ifc.form;
21 import lib.MultiMethodTest;
22 import lib.Status;
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;
29 /**
30 * Testing <code>com.sun.star.form.XApproveActionBroadcaster</code>
31 * interface methods:
32 * <ul>
33 * <li><code> addApproveActionListener() </code></li>
34 * <li><code> removeApproveActionListener() </code></li>
35 * </ul><p>
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;
42 /**
43 * Class we need to test methods.
45 protected class TestListener implements XApproveActionListener {
46 public boolean approve = false ;
48 public void init() {
49 approve = false ;
51 public void disposing(EventObject ev) {}
52 public boolean approveAction(EventObject ev) {
53 log.println("XApproveActionListener: ActionListener was called");
54 return approve ;
59 private final TestListener listener = new TestListener();
61 /**
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);
71 /**
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 :
76 * <ul>
77 * <li> <code> addApproveActionListener() </code> : adds listener to an
78 * object </li>
79 * </ul>
81 public void _removeApproveActionListener() {
82 requiredMethod("addApproveActionListener()");
83 listener.init() ;
84 listener.approve = true ;
85 oObj.removeApproveActionListener(listener);
86 tRes.tested("removeApproveActionListener()", true);
90 /**
91 * Just log output
93 @Override
94 protected void after() {
95 log.println("Skipping all XApproveActionBroadcaster methods, since they"
96 + " need user interaction");
97 throw new StatusException(Status.skipped(true));