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 com
.sun
.star
.ui
.XUIConfiguration
;
22 import com
.sun
.star
.ui
.XUIConfigurationListener
;
23 import lib
.MultiMethodTest
;
26 * Testing <code>com.sun.star.ui.XUIConfiguration</code>
29 * <li><code> addConfigurationListener()</code></li>
30 * <li><code> removeConfigurationListener()</code></li>
32 * Test is <b> NOT </b> multithread compliant. <p>
33 * After test completion object environment has to be recreated.
34 * @see com.sun.star.ui.XUIConfiguration
37 public class _XUIConfiguration
extends MultiMethodTest
{
39 public XUIConfiguration oObj
;
40 XUIConfigurationListenerImpl xListener
= null;
43 * Interface for the Listener of the object relation
44 * <CODE>XUIConfiguration.XUIConfigurationListenerImpl</CODE>
45 * @see com.sun.star.ui.XUIConfigurationListener
47 public interface XUIConfigurationListenerImpl
48 extends XUIConfigurationListener
{
51 boolean actionWasTriggered();
56 * try to get a listener out of the object relation
57 * <CODE>XUIConfiguration.XUIConfigurationListenerImpl</CODE>
60 public void before() {
61 xListener
= (XUIConfigurationListenerImpl
)tEnv
.getObjRelation(
62 "XUIConfiguration.XUIConfigurationListenerImpl");
66 * adds a listener and fires an event
67 * Has <B>OK</B> status if listener was called
69 public void _addConfigurationListener() {
70 oObj
.addConfigurationListener(xListener
);
71 xListener
.fireEvent();
72 tRes
.tested("addConfigurationListener()", xListener
.actionWasTriggered());
76 * removes the listener and calls an event.
77 * Has <B>OK</B> status if listener is not called.
79 public void _removeConfigurationListener() {
80 requiredMethod("addConfigurationListener()");
81 oObj
.removeConfigurationListener(xListener
);
83 xListener
.fireEvent();
84 tRes
.tested("removeConfigurationListener()", !xListener
.actionWasTriggered());
88 * Dispose because the UIConfigurationManager has to be recreated