1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
30 import lib
.MultiMethodTest
;
32 import com
.sun
.star
.document
.XActionLockable
;
35 * Testing <code>com.sun.star.document.XActionLockable</code>
38 * <li><code> isActionLocked()</code></li>
39 * <li><code> addActionLock()</code></li>
40 * <li><code> removeActionLock()</code></li>
41 * <li><code> setActionLocks()</code></li>
42 * <li><code> resetActionLocks()</code></li>
44 * Test is <b> NOT </b> multithread compilant. <p>
45 * @see com.sun.star.document.XActionLockable
47 public class _XActionLockable
extends MultiMethodTest
{
48 public XActionLockable oObj
= null;
51 * Method addActionLock called first and then
52 * checked value returned by isActionLocked().<p>
53 * Has <b> OK </b> status if no runtime exceptions occurred
54 * and returned value is true.
56 public void _isActionLocked() {
57 //determines if at least one lock exists
59 boolean result
= oObj
.isActionLocked();
60 tRes
.tested("isActionLocked()", result
);
64 * Just calls the method. <p>
65 * Has <b> OK </b> status if no runtime exceptions occurred
67 public void _addActionLock() {
68 requiredMethod("resetActionLocks()");
70 tRes
.tested("addActionLock()", true);
74 * Calls the method and check value returned by isActionLocked(). <p>
75 * Has <b> OK </b> status if no runtime exceptions occurred
76 * and returned value is false.
78 public void _removeActionLock() {
79 requiredMethod("addActionLock()");
80 oObj
.removeActionLock();
81 boolean result
= ! oObj
.isActionLocked();
82 tRes
.tested("removeActionLock()", result
);
86 * Calls the method with specific value. <p>
87 * Has <b> OK </b> status if no runtime exceptions occurred
89 public void _setActionLocks() {
90 oObj
.setActionLocks( nLock
);
91 tRes
.tested("setActionLocks()", true);
94 final short nLock
= 8;
97 * Calls the method and checks returned value.<p>
98 * Has <b> OK </b> status if the component is not currently
99 * locked and returned value is the same as locks number
100 * set by <code>setActionLocks</code> method test.
102 public void _resetActionLocks() {
103 requiredMethod("setActionLocks()");
104 short nLocksBeforeReset
= oObj
.resetActionLocks();
105 boolean result
= !oObj
.isActionLocked() && nLocksBeforeReset
== nLock
;
106 tRes
.tested("resetActionLocks()", result
);
108 }// finish class _XActionLockable