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