Version 3.6.0.4, tag libreoffice-3.6.0.4
[LibreOffice.git] / qadevOOo / tests / java / ifc / style / _XStyle.java
blob9cb43e19346fa23f98e9103c95dcc7a2df29892d
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 package ifc.style;
30 import lib.MultiMethodTest;
31 import lib.Status;
32 import lib.StatusException;
34 import com.sun.star.style.XStyle;
36 /**
37 * Testing <code>com.sun.star.style.XStyle</code>
38 * interface methods :
39 * <ul>
40 * <li><code> isUserDefined()</code></li>
41 * <li><code> isInUse()</code></li>
42 * <li><code> getParentStyle()</code></li>
43 * <li><code> setParentStyle()</code></li>
44 * </ul> <p>
45 * This test needs the following object relations :
46 * <ul>
47 * <li> <code>'PoolStyle'</code> (of type <code>XStyle</code>):
48 * some style from the SOffice collection (not user defined) </li>
49 * <ul> <p>
50 * Test is <b> NOT </b> multithread compilant. <p>
51 * @see com.sun.star.style.XStyle
53 public class _XStyle extends MultiMethodTest {
55 public XStyle oObj = null;
56 XStyle oMyStyle = null;
58 /**
59 * Retrieves object relations.
60 * @throws StatusException If one of relations not found.
62 public void before() {
63 oMyStyle = (XStyle) tEnv.getObjRelation("PoolStyle");
64 if (oMyStyle == null) throw new StatusException
65 (Status.failed("Relation not found")) ;
68 /**
69 * Gets the parent style . <p>
70 * Has <b> OK </b> status if the name of style returned is
71 * equal to the name of style which was set before. <p>
72 * The following method tests are to be completed successfully before :
73 * <ul>
74 * <li> <code> setParentStyle() </code> : to set the parent style </li>
75 * </ul>
77 public void _getParentStyle() {
78 requiredMethod("setParentStyle()");
79 tRes.tested("getParentStyle()",
80 oObj.getParentStyle().equals(oMyStyle.getName()));
83 /**
84 * Test calls the method. <p>
85 * Has <b> OK </b> status if the method sreturns <code>true</code>. <p>
87 public void _isInUse() {
88 tRes.tested("isInUse()",oObj.isInUse());
91 /**
92 * Test calls the method. <p>
93 * Has <b> OK </b> status if the method returns <code>true</code>. <p>
95 public void _isUserDefined() {
96 tRes.tested("isUserDefined()",
97 oObj.isUserDefined() && !oMyStyle.isUserDefined() );
101 * Sets the style name which was passed as relation. <p>
102 * Has <b> OK </b> status if the method successfully returns
103 * and no exceptions were thrown. <p>
105 public void _setParentStyle() {
106 boolean result = true ;
107 try {
108 oObj.setParentStyle(oMyStyle.getName());
109 } catch (com.sun.star.container.NoSuchElementException e) {
110 log.println("Exception occurred while method call: " + e);
111 result = false ;
114 tRes.tested("setParentStyle()",result);
116 } //finish class _XStyle