tdf#130857 qt weld: Support mail merge "Server Auth" dialog
[LibreOffice.git] / ucb / qa / complex / tdoc / _XChild.java
blobad23bf180152750d8c597f358396a63cfd2173d1
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 complex.tdoc;
21 import com.sun.star.container.XChild;
22 import com.sun.star.container.XNamed;
23 import com.sun.star.uno.UnoRuntime;
24 import share.LogWriter;
27 * Testing <code>com.sun.star.container.XChild</code>
28 * interface methods :
29 * <ul>
30 * <li><code> getParent()</code></li>
31 * <li><code> setParent()</code></li>
32 * </ul>
33 * @see com.sun.star.container.XChild
35 public class _XChild {
37 public XChild oObj = null;
38 private Object gotten = null;
39 private final LogWriter log = null;
42 /**
43 * Test calls the method and checks return value and that
44 * no exceptions were thrown. Parent returned is stored.<p>
45 * Has <b> OK </b> status if the method returns not null value
46 * and no exceptions were thrown. <p>
48 public boolean _getParent(boolean hasParent) {
49 gotten = oObj.getParent();
50 if (!hasParent)
51 return gotten == null;
52 XNamed the_name = UnoRuntime.queryInterface(XNamed.class,gotten);
53 if (the_name != null)
54 log.println("Parent:"+the_name.getName());
55 return gotten != null;
58 /**
59 * Sets existing parent and checks that
60 * no exceptions were thrown. <p>
61 * Has <b> OK </b> status if no exceptions were thrown. <p>
62 * The following method tests are to be completed successfully before :
63 * <ul>
64 * <li> <code> getParent() </code> : to get the parent. </li>
65 * </ul>
67 public boolean _setParent(boolean supported) {
68 String parentComment = null;//String) tEnv.getObjRelation("cannotSwitchParent");
70 if (parentComment != null) {
71 log.println(parentComment);
72 return true;
75 try {
76 oObj.setParent(gotten);
78 catch (com.sun.star.lang.NoSupportException ex) {
79 log.println("Exception occurred during setParent() - " + (supported?"FAILED":"OK"));
80 if (supported) {
81 ex.printStackTrace((java.io.PrintWriter)log);
82 return false;
85 return true;
88 } // finish class _XChild