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 com
.sun
.star
.document
.XActionLockable
;
26 * Testing <code>com.sun.star.document.XActionLockable</code>
29 * <li><code> isActionLocked()</code></li>
30 * <li><code> addActionLock()</code></li>
31 * <li><code> removeActionLock()</code></li>
32 * <li><code> setActionLocks()</code></li>
33 * <li><code> resetActionLocks()</code></li>
35 * Test is <b> NOT </b> multithread compliant. <p>
36 * @see com.sun.star.document.XActionLockable
38 public class _XActionLockable
extends MultiMethodTest
{
39 public XActionLockable oObj
= null;
42 * Method addActionLock called first and then
43 * checked value returned by isActionLocked().<p>
44 * Has <b> OK </b> status if no runtime exceptions occurred
45 * and returned value is true.
47 public void _isActionLocked() {
48 //determines if at least one lock exists
50 boolean result
= oObj
.isActionLocked();
51 tRes
.tested("isActionLocked()", result
);
55 * Just calls the method. <p>
56 * Has <b> OK </b> status if no runtime exceptions occurred
58 public void _addActionLock() {
59 requiredMethod("resetActionLocks()");
61 tRes
.tested("addActionLock()", true);
65 * Calls the method and check value returned by isActionLocked(). <p>
66 * Has <b> OK </b> status if no runtime exceptions occurred
67 * and returned value is false.
69 public void _removeActionLock() {
70 requiredMethod("addActionLock()");
71 oObj
.removeActionLock();
72 boolean result
= ! oObj
.isActionLocked();
73 tRes
.tested("removeActionLock()", result
);
77 * Calls the method with specific value. <p>
78 * Has <b> OK </b> status if no runtime exceptions occurred
80 public void _setActionLocks() {
81 oObj
.setActionLocks( nLock
);
82 tRes
.tested("setActionLocks()", true);
85 static final short nLock
= 8;
88 * Calls the method and checks returned value.<p>
89 * Has <b> OK </b> status if the component is not currently
90 * locked and returned value is the same as locks number
91 * set by <code>setActionLocks</code> method test.
93 public void _resetActionLocks() {
94 requiredMethod("setActionLocks()");
95 short nLocksBeforeReset
= oObj
.resetActionLocks();
96 boolean result
= !oObj
.isActionLocked() && nLocksBeforeReset
== nLock
;
97 tRes
.tested("resetActionLocks()", result
);
99 }// finish class _XActionLockable