Update ooo320-m1
[ooovba.git] / qadevOOo / tests / java / ifc / container / _XChild.java
blobdd3be909f4dc20478a9d05b53edbe2a04a62f5c1
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: _XChild.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.container;
33 import lib.MultiMethodTest;
34 import lib.Status;
36 import com.sun.star.container.XChild;
37 import com.sun.star.container.XNamed;
38 import com.sun.star.uno.UnoRuntime;
41 * Testing <code>com.sun.star.container.XChild</code>
42 * interface methods :
43 * <ul>
44 * <li><code> getParent()</code></li>
45 * <li><code> setParent()</code></li>
46 * </ul>
47 * @see com.sun.star.container.XChild
49 public class _XChild extends MultiMethodTest {
51 public XChild oObj = null;
52 public Object gotten = null;
55 /**
56 * Test calls the method and checks return value and that
57 * no exceptions were thrown. Parent returned is stored.<p>
58 * Has <b> OK </b> status if the method returns not null value
59 * and no exceptions were thrown. <p>
61 public void _getParent() {
62 gotten = oObj.getParent();
63 XNamed the_name = (XNamed) UnoRuntime.queryInterface(XNamed.class,gotten);
64 if (the_name != null)
65 log.println("Parent:"+the_name.getName());
66 tRes.tested("getParent()",gotten != null);
69 /**
70 * Sets existing parent and checks that
71 * no exceptions were thrown. <p>
72 * Has <b> OK </b> status if no exceptions were thrown. <p>
73 * The following method tests are to be completed successfully before :
74 * <ul>
75 * <li> <code> getParent() </code> : to get the parent. </li>
76 * </ul>
78 public void _setParent() {
79 requiredMethod("getParent()") ;
81 String parentComment = (String) tEnv.getObjRelation("cannotSwitchParent");
83 if (parentComment != null) {
84 log.println(parentComment);
85 tRes.tested("setParent()",Status.skipped(true));
86 return;
89 try {
90 oObj.setParent(gotten);
91 tRes.tested("setParent()",true);
93 catch (com.sun.star.lang.NoSupportException ex) {
94 log.println("Exception occured during setParent()");
95 ex.printStackTrace(log);
96 tRes.tested("setParent()",false);
101 } // finish class _XChild