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 .
21 import lib
.MultiMethodTest
;
23 import lib
.StatusException
;
25 import com
.sun
.star
.beans
.XPropertySet
;
26 import com
.sun
.star
.util
.XIndent
;
29 * Testing <code>com.sun.star.util.XCancellable</code>
32 * <li><code> decrementIndent()</code></li>
33 * <li><code> incrementIndent()</code></li>
35 * @see com.sun.star.util.XIndent
37 public class _XIndent
extends MultiMethodTest
{
39 // oObj filled by MultiMethodTest
40 public XIndent oObj
= null ;
42 protected XPropertySet PropSet
= null;
45 * Ensures that the ObjRelation PropSet is given.
48 public void before() {
49 PropSet
= (XPropertySet
) tEnv
.getObjRelation("PropSet");
50 if (PropSet
== null) {
51 throw new StatusException(Status
.failed("No PropertySet given"));
56 * Calls the method. <p>
57 * Has <b>OK</b> status if the property 'ParaIndent' is incremented afterwards<p>
59 public void _incrementIndent() {
60 int oldValue
= getIndent();
61 oObj
.incrementIndent();
62 int newValue
= getIndent();
63 tRes
.tested("incrementIndent()", oldValue
< newValue
) ;
67 * Calls the method. <p>
68 * Has <b>OK</b> status if the property 'ParaIndent' is decremented afterwards<p>
69 * requires 'incrementIndent()' to be executed first.
71 public void _decrementIndent() {
72 requiredMethod("incrementIndent()");
73 int oldValue
= getIndent();
74 oObj
.decrementIndent();
75 int newValue
= getIndent();
76 tRes
.tested("decrementIndent()", oldValue
> newValue
) ;
79 public short getIndent() {
82 ret
= ((Short
) PropSet
.getPropertyValue("ParaIndent")).shortValue();
83 } catch (com
.sun
.star
.beans
.UnknownPropertyException upe
) {
84 } catch (com
.sun
.star
.lang
.WrappedTargetException wte
) {
89 } // finish class _XCancellable