1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 package ifc.linguistic2;
25 
26 import lib.MultiMethodTest;
27 
28 import com.sun.star.lang.EventObject;
29 import com.sun.star.linguistic2.LinguServiceEvent;
30 import com.sun.star.linguistic2.XLinguServiceEventBroadcaster;
31 import com.sun.star.linguistic2.XLinguServiceEventListener;
32 
33 /**
34 * Testing <code>com.sun.star.linguistic2.XLinguServiceEventBroadcaster</code>
35 * interface methods:
36 * <ul>
37 *   <li><code>addLinguServiceEventListener()</code></li>
38 *   <li><code>removeLinguServiceEventListener()</code></li>
39 * </ul><p>
40 * @see com.sun.star.linguistic2.XLinguServiceEventBroadcaster
41 */
42 public class _XLinguServiceEventBroadcaster extends MultiMethodTest {
43 
44     public XLinguServiceEventBroadcaster oObj = null;
45 
46     /**
47     * Class implements interface <code>XLinguServiceEventListener</code>
48     * for test method <code>addLinguServiceEventListener</code>.
49     * @see com.sun.star.linguistic2.XLinguServiceEventListener
50     */
51     public class MyLinguServiceEventListener implements
52             XLinguServiceEventListener {
disposing( EventObject oEvent )53         public void disposing ( EventObject oEvent ) {
54             log.println("Listener has been disposed");
55         }
processLinguServiceEvent(LinguServiceEvent aServiceEvent)56         public void processLinguServiceEvent(LinguServiceEvent aServiceEvent) {
57             log.println("Listener called");
58         }
59 
60     }
61 
62     XLinguServiceEventListener listener = new MyLinguServiceEventListener();
63 
64     /**
65     * Test calls the method and checks returned value. <p>
66     * Has <b> OK </b> status if returned value is true. <p>
67     */
_addLinguServiceEventListener()68     public void _addLinguServiceEventListener() {
69         boolean res = true;
70 
71         res = oObj.addLinguServiceEventListener(listener);
72 
73         tRes.tested("addLinguServiceEventListener()",res);
74     }
75 
76     /**
77     * Test calls the method and checks returned value. <p>
78     * Has <b> OK </b> status if returned value is true. <p>
79     */
_removeLinguServiceEventListener()80     public void _removeLinguServiceEventListener() {
81         boolean res = true;
82 
83         res = oObj.removeLinguServiceEventListener(listener);
84 
85         tRes.tested("removeLinguServiceEventListener()",res);
86     }
87 
88 }  // finish class XLinguServiceEventBroadcaster
89 
90 
91