Update ooo320-m1
[ooovba.git] / qadevOOo / tests / java / ifc / util / _XIndent.java
blob48eda34201099933ed8853b360c6b75f453f67d3
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: _XIndent.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.util;
33 import lib.MultiMethodTest;
34 import lib.Status;
35 import lib.StatusException;
37 import com.sun.star.beans.XPropertySet;
38 import com.sun.star.util.XIndent;
40 /**
41 * Testing <code>com.sun.star.util.XCancellable</code>
42 * interface methods :
43 * <ul>
44 * <li><code> decrementIndent()</code></li>
45 * <li><code> incrementIndent()</code></li>
46 * </ul> <p>
47 * @see com.sun.star.util.XIndent
49 public class _XIndent extends MultiMethodTest {
51 // oObj filled by MultiMethodTest
52 public XIndent oObj = null ;
54 protected XPropertySet PropSet = null;
56 /**
57 * Ensures that the ObjRelation PropSet is given.
59 public void before() {
60 PropSet = (XPropertySet) tEnv.getObjRelation("PropSet");
61 if (PropSet == null) {
62 throw new StatusException(Status.failed("No PropertySet given"));
66 /**
67 * Calls the method. <p>
68 * Has <b>OK</b> status if the property 'ParaIndent' is incremented afterwards<p>
70 public void _incrementIndent() {
71 int oldValue = getIndent();
72 oObj.incrementIndent();
73 int newValue = getIndent();
74 tRes.tested("incrementIndent()", oldValue < newValue) ;
77 /**
78 * Calls the method. <p>
79 * Has <b>OK</b> status if the property 'ParaIndent' is decremented afterwards<p>
80 * requires 'incrementIndent()' to be executed first.
82 public void _decrementIndent() {
83 requiredMethod("incrementIndent()");
84 int oldValue = getIndent();
85 oObj.decrementIndent();
86 int newValue = getIndent();
87 tRes.tested("decrementIndent()", oldValue > newValue) ;
90 public short getIndent() {
91 short ret = 0;
92 try {
93 ret = ((Short) PropSet.getPropertyValue("ParaIndent")).shortValue();
94 } catch (com.sun.star.beans.UnknownPropertyException upe) {
95 } catch (com.sun.star.lang.WrappedTargetException wte) {
97 return ret;
100 } // finish class _XCancellable