1ef39d40dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3ef39d40dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4ef39d40dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5ef39d40dSAndrew Rist  * distributed with this work for additional information
6ef39d40dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7ef39d40dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8ef39d40dSAndrew Rist  * "License"); you may not use this file except in compliance
9ef39d40dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10ef39d40dSAndrew Rist  *
11ef39d40dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12ef39d40dSAndrew Rist  *
13ef39d40dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14ef39d40dSAndrew Rist  * software distributed under the License is distributed on an
15ef39d40dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16ef39d40dSAndrew Rist  * KIND, either express or implied.  See the License for the
17ef39d40dSAndrew Rist  * specific language governing permissions and limitations
18ef39d40dSAndrew Rist  * under the License.
19ef39d40dSAndrew Rist  *
20ef39d40dSAndrew Rist  *************************************************************/
21ef39d40dSAndrew Rist 
22ef39d40dSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir package ifc.document;
25cdf0e10cSrcweir 
26cdf0e10cSrcweir import lib.MultiMethodTest;
27cdf0e10cSrcweir 
28cdf0e10cSrcweir import com.sun.star.document.XActionLockable;
29cdf0e10cSrcweir 
30cdf0e10cSrcweir /**
31cdf0e10cSrcweir * Testing <code>com.sun.star.document.XActionLockable</code>
32cdf0e10cSrcweir * interface methods :
33cdf0e10cSrcweir * <ul>
34cdf0e10cSrcweir *  <li><code> isActionLocked()</code></li>
35cdf0e10cSrcweir *  <li><code> addActionLock()</code></li>
36cdf0e10cSrcweir *  <li><code> removeActionLock()</code></li>
37cdf0e10cSrcweir *  <li><code> setActionLocks()</code></li>
38cdf0e10cSrcweir *  <li><code> resetActionLocks()</code></li>
39cdf0e10cSrcweir * </ul> <p>
40cdf0e10cSrcweir * Test is <b> NOT </b> multithread compilant. <p>
41cdf0e10cSrcweir * @see com.sun.star.document.XActionLockable
42cdf0e10cSrcweir */
43cdf0e10cSrcweir public class _XActionLockable extends MultiMethodTest {
44cdf0e10cSrcweir     public XActionLockable oObj = null;
45cdf0e10cSrcweir 
46cdf0e10cSrcweir     /**
47cdf0e10cSrcweir      * Method addActionLock called first and then
48cdf0e10cSrcweir      * checked value returned by isActionLocked().<p>
49*bb6af6bcSPedro Giffuni      * Has <b> OK </b> status if no runtime exceptions occurred
50cdf0e10cSrcweir      * and returned value is true.
51cdf0e10cSrcweir      */
_isActionLocked()52cdf0e10cSrcweir     public void _isActionLocked() {
53cdf0e10cSrcweir         //determines if at least one lock exists
54cdf0e10cSrcweir         oObj.addActionLock();
55cdf0e10cSrcweir         boolean result = oObj.isActionLocked();
56cdf0e10cSrcweir         tRes.tested("isActionLocked()", result);
57cdf0e10cSrcweir     }
58cdf0e10cSrcweir 
59cdf0e10cSrcweir     /**
60cdf0e10cSrcweir     * Just calls the method. <p>
61*bb6af6bcSPedro Giffuni     * Has <b> OK </b> status if no runtime exceptions occurred
62cdf0e10cSrcweir     */
_addActionLock()63cdf0e10cSrcweir     public void _addActionLock() {
64cdf0e10cSrcweir         requiredMethod("resetActionLocks()");
65cdf0e10cSrcweir         oObj.addActionLock();
66cdf0e10cSrcweir         tRes.tested("addActionLock()", true);
67cdf0e10cSrcweir     }
68cdf0e10cSrcweir 
69cdf0e10cSrcweir     /**
70cdf0e10cSrcweir     * Calls the method and check value returned by isActionLocked(). <p>
71*bb6af6bcSPedro Giffuni     * Has <b> OK </b> status if no runtime exceptions occurred
72cdf0e10cSrcweir     * and returned value is false.
73cdf0e10cSrcweir     */
_removeActionLock()74cdf0e10cSrcweir     public void _removeActionLock() {
75cdf0e10cSrcweir         requiredMethod("addActionLock()");
76cdf0e10cSrcweir         oObj.removeActionLock();
77cdf0e10cSrcweir         boolean result = ! oObj.isActionLocked();
78cdf0e10cSrcweir         tRes.tested("removeActionLock()", result);
79cdf0e10cSrcweir     }
80cdf0e10cSrcweir 
81cdf0e10cSrcweir     /**
82cdf0e10cSrcweir     * Calls the method with specific value. <p>
83*bb6af6bcSPedro Giffuni     * Has <b> OK </b> status if no runtime exceptions occurred
84cdf0e10cSrcweir     */
_setActionLocks()85cdf0e10cSrcweir     public void _setActionLocks() {
86cdf0e10cSrcweir         oObj.setActionLocks( nLock );
87cdf0e10cSrcweir         tRes.tested("setActionLocks()", true);
88cdf0e10cSrcweir     }
89cdf0e10cSrcweir 
90cdf0e10cSrcweir     final short nLock = 8;
91cdf0e10cSrcweir 
92cdf0e10cSrcweir     /**
93cdf0e10cSrcweir     * Calls the method and checks returned value.<p>
94cdf0e10cSrcweir     * Has <b> OK </b> status if the component is not currently
95cdf0e10cSrcweir     * locked and returned value is the same as locks number
96cdf0e10cSrcweir     * set by <code>setActionLocks</code> method test.
97cdf0e10cSrcweir     */
_resetActionLocks()98cdf0e10cSrcweir     public void _resetActionLocks() {
99cdf0e10cSrcweir         requiredMethod("setActionLocks()");
100cdf0e10cSrcweir         short nLocksBeforeReset = oObj.resetActionLocks();
101cdf0e10cSrcweir         boolean result = !oObj.isActionLocked() && nLocksBeforeReset == nLock;
102cdf0e10cSrcweir         tRes.tested("resetActionLocks()", result);
103cdf0e10cSrcweir     }
104cdf0e10cSrcweir }// finish class _XActionLockable
105cdf0e10cSrcweir 
106