tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / qadevOOo / tests / java / ifc / util / _XRefreshable.java
blob1edfae0d5579e35ba76fe81f26888179f4c6d6fc
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.util;
21 import lib.MultiMethodTest;
23 import com.sun.star.util.XRefreshListener;
24 import com.sun.star.util.XRefreshable;
26 /**
27 * Testing <code>com.sun.star.util.XRefreshable</code>
28 * interface methods :
29 * <ul>
30 * <li><code> refresh()</code></li>
31 * <li><code> addRefreshListener()</code></li>
32 * <li><code> removeRefreshListener()</code></li>
33 * </ul> <p>
34 * Test is <b> NOT </b> multithread compliant. <p>
35 * @see com.sun.star.util.XRefreshable
37 public class _XRefreshable extends MultiMethodTest {
39 public XRefreshable oObj = null;
41 final boolean listenerCalled[] = new boolean[1];
44 /**
45 * <code>XRefreshListener</code> implementation which
46 * sets a flag when <code>refreshed</code> method is
47 * called.
49 public class MyRefreshListener implements XRefreshListener {
50 public void refreshed (com.sun.star.lang.EventObject e) {
51 listenerCalled[0] = true;
54 public void disposing (com.sun.star.lang.EventObject obj) {}
57 XRefreshListener listener = new MyRefreshListener();
59 /**
60 * Just adds a listener. <p>
61 * Always has <b>OK</b> status.
63 public void _addRefreshListener() {
65 oObj.addRefreshListener(listener) ;
66 tRes.tested("addRefreshListener()", true);
69 /**
70 * Calls the method and checks if the listener was called. <p>
71 * Has <b>OK</b> status if listener's flag is set after call.
72 * The following method tests are to be completed successfully before :
73 * <ul>
74 * <li> <code> addRefreshListener </code> : to have a listener added.</li>
75 * </ul>
77 public void _refresh() {
79 requiredMethod("addRefreshListener()");
81 oObj.refresh();
83 tRes.tested("refresh()", listenerCalled[0]);
84 if (!listenerCalled[0])
85 log.println("RefreshListener wasn't called after refresh");
89 /**
90 * Removes the listener added before and calls <code>refresh</code>
91 * method. Listener must not be called. <p>
92 * Has <b>OK</b> status if listener's flag isn't changed.
93 * <ul>
94 * <li> <code> refresh </code> : listener added must be already
95 * tested.</li>
96 * </ul>
98 public void _removeRefreshListener() {
99 requiredMethod("refresh()");
100 listenerCalled[0] = false;
102 oObj.removeRefreshListener(listener) ;
103 oObj.refresh();
105 tRes.tested("removeRefreshListener()", !listenerCalled[0]);
106 if (listenerCalled[0])
107 log.println("RefreshListener was called after removing");
109 } // finish class _XRefreshable