merge the formfield patch from ooo-build
[ooovba.git] / qadevOOo / tests / java / ifc / document / _XActionLockable.java
blobdb5e2e7d621b7302968802806a973b1ca95188b1
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _XActionLockable.java,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 package ifc.document;
33 import lib.MultiMethodTest;
35 import com.sun.star.document.XActionLockable;
37 /**
38 * Testing <code>com.sun.star.document.XActionLockable</code>
39 * interface methods :
40 * <ul>
41 * <li><code> isActionLocked()</code></li>
42 * <li><code> addActionLock()</code></li>
43 * <li><code> removeActionLock()</code></li>
44 * <li><code> setActionLocks()</code></li>
45 * <li><code> resetActionLocks()</code></li>
46 * </ul> <p>
47 * Test is <b> NOT </b> multithread compilant. <p>
48 * @see com.sun.star.document.XActionLockable
50 public class _XActionLockable extends MultiMethodTest {
51 public XActionLockable oObj = null;
53 /**
54 * Method addActionLock called first and then
55 * checked value returned by isActionLocked().<p>
56 * Has <b> OK </b> status if no runtime exceptions occured
57 * and returned value is true.
59 public void _isActionLocked() {
60 //determines if at least one lock exists
61 oObj.addActionLock();
62 boolean result = oObj.isActionLocked();
63 tRes.tested("isActionLocked()", result);
66 /**
67 * Just calls the method. <p>
68 * Has <b> OK </b> status if no runtime exceptions occured
70 public void _addActionLock() {
71 requiredMethod("resetActionLocks()");
72 oObj.addActionLock();
73 tRes.tested("addActionLock()", true);
76 /**
77 * Calls the method and check value returned by isActionLocked(). <p>
78 * Has <b> OK </b> status if no runtime exceptions occured
79 * and returned value is false.
81 public void _removeActionLock() {
82 requiredMethod("addActionLock()");
83 oObj.removeActionLock();
84 boolean result = ! oObj.isActionLocked();
85 tRes.tested("removeActionLock()", result);
88 /**
89 * Calls the method with specific value. <p>
90 * Has <b> OK </b> status if no runtime exceptions occured
92 public void _setActionLocks() {
93 oObj.setActionLocks( nLock );
94 tRes.tested("setActionLocks()", true);
97 final short nLock = 8;
99 /**
100 * Calls the method and checks returned value.<p>
101 * Has <b> OK </b> status if the component is not currently
102 * locked and returned value is the same as locks number
103 * set by <code>setActionLocks</code> method test.
105 public void _resetActionLocks() {
106 requiredMethod("setActionLocks()");
107 short nLocksBeforeReset = oObj.resetActionLocks();
108 boolean result = !oObj.isActionLocked() && nLocksBeforeReset == nLock;
109 tRes.tested("resetActionLocks()", result);
111 }// finish class _XActionLockable