Branch libreoffice-5-0-4
[LibreOffice.git] / qadevOOo / tests / java / ifc / document / _XActionLockable.java
blob8276eb62ad8d9f93b97647d66e942fbcc596f06c
1 /*
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 .
19 package ifc.document;
21 import lib.MultiMethodTest;
23 import com.sun.star.document.XActionLockable;
25 /**
26 * Testing <code>com.sun.star.document.XActionLockable</code>
27 * interface methods :
28 * <ul>
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>
34 * </ul> <p>
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;
41 /**
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
49 oObj.addActionLock();
50 boolean result = oObj.isActionLocked();
51 tRes.tested("isActionLocked()", result);
54 /**
55 * Just calls the method. <p>
56 * Has <b> OK </b> status if no runtime exceptions occurred
58 public void _addActionLock() {
59 requiredMethod("resetActionLocks()");
60 oObj.addActionLock();
61 tRes.tested("addActionLock()", true);
64 /**
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);
76 /**
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;
87 /**
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