1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 package ifc.awt; 25 26 import com.sun.star.awt.XTabController; 27 import com.sun.star.awt.XUnoControlContainer; 28 import lib.MultiMethodTest; 29 30 /** 31 * Testing <code>com.sun.star.awt.XUnoControlContainer</code> 32 * interface methods : 33 * <ul> 34 * <li><code> addTabController()</code></li> 35 * <li><code> removeTabController()</code></li> 36 * <li><code> getTabControllers()</code></li> 37 * <li><code> setTabControllers()</code></li> 38 * </ul> <p> 39 * 40 * This test needs the following object relations : 41 * <ul> 42 * <li> <code>'TABCONTROL1'</code> (of type <code>XTabController</code>)</li> 43 * <li> <code>'TABCONTROL2'</code> (of type <code>XTabController</code>)</li> 44 *</ul> 45 * 46 * Test is <b> NOT </b> multithread compilant. <p> 47 */ 48 49 public class _XUnoControlContainer extends MultiMethodTest { 50 public XUnoControlContainer oObj = null; 51 private XTabController[] TabControllers = new XTabController[2]; 52 private XTabController tabControl1 = null; 53 private XTabController tabControl2 = null; 54 55 /** 56 * This method gets the object relations. 57 * 58 */ before()59 protected void before() { 60 61 tabControl1 = (XTabController) tEnv.getObjRelation("TABCONTROL1"); 62 tabControl2 = (XTabController) tEnv.getObjRelation("TABCONTROL2"); 63 if ((tabControl1 == null) || (tabControl2 == null)){ 64 log.println("ERROR: Needed object realtions 'TABCONTROL1' and " 65 + "'TABCONTROL2' are not found."); 66 } 67 TabControllers[0] = tabControl1; 68 TabControllers[1] = tabControl2; 69 70 } 71 72 73 74 /** 75 * This tests removes the object relations <code>TABCONTROL1</code> and 76 * <code>TABCONTROL1</code>. 77 * Has <b> OK </b> status if the sequenze of <code>XTabController[]</code> 78 * get before calling method is smaller then sequenze of 79 * <code>XTabController[]</code> get after calling method.<p> 80 * 81 * The following method tests are to be completed successfully before : 82 * <ul> 83 * <li> <code> getTabControllers() </code> </li> 84 * <li> <code> removeTabController() </code> </li> 85 * </ul> 86 */ _setTabControllers()87 public void _setTabControllers() { 88 requiredMethod( "getTabControllers()"); 89 requiredMethod( "removeTabController()"); 90 91 log.println("removing TABCONTROL1 and TABCONTROL2"); 92 oObj.removeTabController(tabControl1); 93 oObj.removeTabController(tabControl2); 94 95 log.println("get current controllers"); 96 XTabController[] myTabControllers = oObj.getTabControllers(); 97 98 log.println("set new controllers"); 99 oObj.setTabControllers( TabControllers ); 100 101 log.println("get new current controllers"); 102 XTabController[] myNewTabControllers = oObj.getTabControllers(); 103 104 tRes.tested("setTabControllers()", 105 (myTabControllers.length < myNewTabControllers.length )); 106 107 } 108 109 /** 110 * Test calls the method, then checks returned value.<p> 111 * Has <b> OK </b> status if method returns a value that greater then zerro.<p> 112 * 113 * The following method tests are to be completed successfully before : 114 * <ul> 115 * <li> <code> addTabController() </code></li> 116 * </ul> 117 */ _getTabControllers()118 public void _getTabControllers() { 119 requiredMethod( "addTabController()"); 120 XTabController[] myTabControllers = oObj.getTabControllers(); 121 tRes.tested("getTabControllers()", ( myTabControllers.length > 0)); 122 } 123 124 /** 125 * Test calls the method with object relation 'TABCONTROL1' as a parameter.<p> 126 * Has <b> OK </b> status if the sequenze of <code>XTabController[]</code> 127 * get before calling method is smaller then sequenze of 128 * <code>XTabController[]</code> get after calling method.<p> 129 */ _addTabController()130 public void _addTabController() { 131 log.println("get current controllers"); 132 XTabController[] myTabControllers = oObj.getTabControllers(); 133 134 log.println("add TABCONTROL1"); 135 oObj.addTabController( tabControl1 ); 136 137 log.println("get new current controllers"); 138 XTabController[] myNewTabControllers = oObj.getTabControllers(); 139 140 tRes.tested("addTabController()", 141 (myTabControllers.length < myNewTabControllers.length )); 142 } 143 144 /** 145 * Test calls the method with object relation 'TABCONTROL2' as a parameter.<p> 146 * Has <b> OK </b> status if the sequenze of <code>XTabController[]</code> 147 * get before calling method is smaller then sequenze of 148 * <code>XTabController[]</code> get after calling method.<p> 149 * 150 * The following method tests are to be completed successfully before : 151 * <ul> 152 * <li> <code> getTabControllers() </code></li> 153 * <li> <code> addTabController() </code></li> 154 * </ul> 155 */ _removeTabController()156 public void _removeTabController() { 157 requiredMethod( "getTabControllers()"); 158 requiredMethod( "addTabController()"); 159 160 log.println("add TABCONTROL2"); 161 oObj.addTabController( tabControl2 ); 162 163 log.println("get current controllers"); 164 XTabController[] myTabControllers = oObj.getTabControllers(); 165 166 log.println("remove TABCONTROL2"); 167 oObj.removeTabController(tabControl2); 168 169 log.println("get new current controllers"); 170 XTabController[] myNewTabControllers = oObj.getTabControllers(); 171 172 tRes.tested("removeTabController()", 173 (myTabControllers.length > myNewTabControllers.length )); 174 } 175 176 } 177 178