1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _XUnoControlContainer.java,v $
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 ************************************************************************/
33 import com
.sun
.star
.awt
.XTabController
;
34 import com
.sun
.star
.awt
.XUnoControlContainer
;
35 import lib
.MultiMethodTest
;
38 * Testing <code>com.sun.star.awt.XUnoControlContainer</code>
41 * <li><code> addTabController()</code></li>
42 * <li><code> removeTabController()</code></li>
43 * <li><code> getTabControllers()</code></li>
44 * <li><code> setTabControllers()</code></li>
47 * This test needs the following object relations :
49 * <li> <code>'TABCONTROL1'</code> (of type <code>XTabController</code>)</li>
50 * <li> <code>'TABCONTROL2'</code> (of type <code>XTabController</code>)</li>
53 * Test is <b> NOT </b> multithread compilant. <p>
56 public class _XUnoControlContainer
extends MultiMethodTest
{
57 public XUnoControlContainer oObj
= null;
58 private XTabController
[] TabControllers
= new XTabController
[2];
59 private XTabController tabControl1
= null;
60 private XTabController tabControl2
= null;
63 * This method gets the object relations.
66 protected void before() {
68 tabControl1
= (XTabController
) tEnv
.getObjRelation("TABCONTROL1");
69 tabControl2
= (XTabController
) tEnv
.getObjRelation("TABCONTROL2");
70 if ((tabControl1
== null) || (tabControl2
== null)){
71 log
.println("ERROR: Needed object realtions 'TABCONTROL1' and "
72 + "'TABCONTROL2' are not found.");
74 TabControllers
[0] = tabControl1
;
75 TabControllers
[1] = tabControl2
;
82 * This tests removes the object relations <code>TABCONTROL1</code> and
83 * <code>TABCONTROL1</code>.
84 * Has <b> OK </b> status if the sequenze of <code>XTabController[]</code>
85 * get before calling method is smaller then sequenze of
86 * <code>XTabController[]</code> get after calling method.<p>
88 * The following method tests are to be completed successfully before :
90 * <li> <code> getTabControllers() </code> </li>
91 * <li> <code> removeTabController() </code> </li>
94 public void _setTabControllers() {
95 requiredMethod( "getTabControllers()");
96 requiredMethod( "removeTabController()");
98 log
.println("removing TABCONTROL1 and TABCONTROL2");
99 oObj
.removeTabController(tabControl1
);
100 oObj
.removeTabController(tabControl2
);
102 log
.println("get current controllers");
103 XTabController
[] myTabControllers
= oObj
.getTabControllers();
105 log
.println("set new controllers");
106 oObj
.setTabControllers( TabControllers
);
108 log
.println("get new current controllers");
109 XTabController
[] myNewTabControllers
= oObj
.getTabControllers();
111 tRes
.tested("setTabControllers()",
112 (myTabControllers
.length
< myNewTabControllers
.length
));
117 * Test calls the method, then checks returned value.<p>
118 * Has <b> OK </b> status if method returns a value that greater then zerro.<p>
120 * The following method tests are to be completed successfully before :
122 * <li> <code> addTabController() </code></li>
125 public void _getTabControllers() {
126 requiredMethod( "addTabController()");
127 XTabController
[] myTabControllers
= oObj
.getTabControllers();
128 tRes
.tested("getTabControllers()", ( myTabControllers
.length
> 0));
132 * Test calls the method with object relation 'TABCONTROL1' as a parameter.<p>
133 * Has <b> OK </b> status if the sequenze of <code>XTabController[]</code>
134 * get before calling method is smaller then sequenze of
135 * <code>XTabController[]</code> get after calling method.<p>
137 public void _addTabController() {
138 log
.println("get current controllers");
139 XTabController
[] myTabControllers
= oObj
.getTabControllers();
141 log
.println("add TABCONTROL1");
142 oObj
.addTabController( tabControl1
);
144 log
.println("get new current controllers");
145 XTabController
[] myNewTabControllers
= oObj
.getTabControllers();
147 tRes
.tested("addTabController()",
148 (myTabControllers
.length
< myNewTabControllers
.length
));
152 * Test calls the method with object relation 'TABCONTROL2' as a parameter.<p>
153 * Has <b> OK </b> status if the sequenze of <code>XTabController[]</code>
154 * get before calling method is smaller then sequenze of
155 * <code>XTabController[]</code> get after calling method.<p>
157 * The following method tests are to be completed successfully before :
159 * <li> <code> getTabControllers() </code></li>
160 * <li> <code> addTabController() </code></li>
163 public void _removeTabController() {
164 requiredMethod( "getTabControllers()");
165 requiredMethod( "addTabController()");
167 log
.println("add TABCONTROL2");
168 oObj
.addTabController( tabControl2
);
170 log
.println("get current controllers");
171 XTabController
[] myTabControllers
= oObj
.getTabControllers();
173 log
.println("remove TABCONTROL2");
174 oObj
.removeTabController(tabControl2
);
176 log
.println("get new current controllers");
177 XTabController
[] myNewTabControllers
= oObj
.getTabControllers();
179 tRes
.tested("removeTabController()",
180 (myTabControllers
.length
> myNewTabControllers
.length
));