Branch libreoffice-5-0-4
[LibreOffice.git] / qadevOOo / tests / java / ifc / container / _XChild.java
blobfc32dc9c43c3e37c2d096ee7abb755ae535927d3
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.container;
21 import lib.MultiMethodTest;
22 import lib.Status;
24 import com.sun.star.container.XChild;
25 import com.sun.star.container.XNamed;
26 import com.sun.star.uno.UnoRuntime;
29 * Testing <code>com.sun.star.container.XChild</code>
30 * interface methods :
31 * <ul>
32 * <li><code> getParent()</code></li>
33 * <li><code> setParent()</code></li>
34 * </ul>
35 * @see com.sun.star.container.XChild
37 public class _XChild extends MultiMethodTest {
39 public XChild oObj = null;
40 public Object gotten = null;
43 /**
44 * Test calls the method and checks return value and that
45 * no exceptions were thrown. Parent returned is stored.<p>
46 * Has <b> OK </b> status if the method returns not null value
47 * and no exceptions were thrown. <p>
49 public void _getParent() {
50 gotten = oObj.getParent();
51 XNamed the_name = UnoRuntime.queryInterface(XNamed.class,gotten);
52 if (the_name != null)
53 log.println("Parent:"+the_name.getName());
54 tRes.tested("getParent()",gotten != null);
57 /**
58 * Sets existing parent and checks that
59 * no exceptions were thrown. <p>
60 * Has <b> OK </b> status if no exceptions were thrown. <p>
61 * The following method tests are to be completed successfully before :
62 * <ul>
63 * <li> <code> getParent() </code> : to get the parent. </li>
64 * </ul>
66 public void _setParent() {
67 requiredMethod("getParent()") ;
69 String parentComment = (String) tEnv.getObjRelation("cannotSwitchParent");
71 if (parentComment != null) {
72 log.println(parentComment);
73 tRes.tested("setParent()",Status.skipped(true));
74 return;
77 try {
78 oObj.setParent(gotten);
79 tRes.tested("setParent()",true);
81 catch (com.sun.star.lang.NoSupportException ex) {
82 log.println("Exception occurred during setParent()");
83 ex.printStackTrace(log);
84 tRes.tested("setParent()",false);
89 } // finish class _XChild