Branch libreoffice-5-0-4
[LibreOffice.git] / qadevOOo / tests / java / ifc / awt / _XUnoControlContainer.java
blobdaf791ede429c6d2785ff4d1a59d1c477791754b
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.awt;
21 import com.sun.star.awt.XTabController;
22 import com.sun.star.awt.XUnoControlContainer;
23 import lib.MultiMethodTest;
25 /**
26 * Testing <code>com.sun.star.awt.XUnoControlContainer</code>
27 * interface methods :
28 * <ul>
29 * <li><code> addTabController()</code></li>
30 * <li><code> removeTabController()</code></li>
31 * <li><code> getTabControllers()</code></li>
32 * <li><code> setTabControllers()</code></li>
33 * </ul> <p>
35 * This test needs the following object relations :
36 * <ul>
37 * <li> <code>'TABCONTROL1'</code> (of type <code>XTabController</code>)</li>
38 * <li> <code>'TABCONTROL2'</code> (of type <code>XTabController</code>)</li>
39 *</ul>
41 * Test is <b> NOT </b> multithread compliant. <p>
44 public class _XUnoControlContainer extends MultiMethodTest {
45 public XUnoControlContainer oObj = null;
46 private XTabController[] TabControllers = new XTabController[2];
47 private XTabController tabControl1 = null;
48 private XTabController tabControl2 = null;
50 /**
51 * This method gets the object relations.
54 @Override
55 protected void before() {
57 tabControl1 = (XTabController) tEnv.getObjRelation("TABCONTROL1");
58 tabControl2 = (XTabController) tEnv.getObjRelation("TABCONTROL2");
59 if ((tabControl1 == null) || (tabControl2 == null)){
60 log.println("ERROR: Needed object relations 'TABCONTROL1' and "
61 + "'TABCONTROL2' are not found.");
63 TabControllers[0] = tabControl1;
64 TabControllers[1] = tabControl2;
70 /**
71 * This tests removes the object relations <code>TABCONTROL1</code> and
72 * <code>TABCONTROL1</code>.
73 * Has <b> OK </b> status if the sequenze of <code>XTabController[]</code>
74 * get before calling method is smaller then sequenze of
75 * <code>XTabController[]</code> get after calling method.<p>
77 * The following method tests are to be completed successfully before :
78 * <ul>
79 * <li> <code> getTabControllers() </code> </li>
80 * <li> <code> removeTabController() </code> </li>
81 * </ul>
83 public void _setTabControllers() {
84 requiredMethod( "getTabControllers()");
85 requiredMethod( "removeTabController()");
87 log.println("removing TABCONTROL1 and TABCONTROL2");
88 oObj.removeTabController(tabControl1);
89 oObj.removeTabController(tabControl2);
91 log.println("get current controllers");
92 XTabController[] myTabControllers = oObj.getTabControllers();
94 log.println("set new controllers");
95 oObj.setTabControllers( TabControllers );
97 log.println("get new current controllers");
98 XTabController[] myNewTabControllers = oObj.getTabControllers();
100 tRes.tested("setTabControllers()",
101 (myTabControllers.length < myNewTabControllers.length ));
106 * Test calls the method, then checks returned value.<p>
107 * Has <b> OK </b> status if method returns a value that greater then zerro.<p>
109 * The following method tests are to be completed successfully before :
110 * <ul>
111 * <li> <code> addTabController() </code></li>
112 * </ul>
114 public void _getTabControllers() {
115 requiredMethod( "addTabController()");
116 XTabController[] myTabControllers = oObj.getTabControllers();
117 tRes.tested("getTabControllers()", ( myTabControllers.length > 0));
121 * Test calls the method with object relation 'TABCONTROL1' as a parameter.<p>
122 * Has <b> OK </b> status if the sequenze of <code>XTabController[]</code>
123 * get before calling method is smaller then sequenze of
124 * <code>XTabController[]</code> get after calling method.<p>
126 public void _addTabController() {
127 log.println("get current controllers");
128 XTabController[] myTabControllers = oObj.getTabControllers();
130 log.println("add TABCONTROL1");
131 oObj.addTabController( tabControl1 );
133 log.println("get new current controllers");
134 XTabController[] myNewTabControllers = oObj.getTabControllers();
136 tRes.tested("addTabController()",
137 (myTabControllers.length < myNewTabControllers.length ));
141 * Test calls the method with object relation 'TABCONTROL2' as a parameter.<p>
142 * Has <b> OK </b> status if the sequenze of <code>XTabController[]</code>
143 * get before calling method is smaller then sequenze of
144 * <code>XTabController[]</code> get after calling method.<p>
146 * The following method tests are to be completed successfully before :
147 * <ul>
148 * <li> <code> getTabControllers() </code></li>
149 * <li> <code> addTabController() </code></li>
150 * </ul>
152 public void _removeTabController() {
153 requiredMethod( "getTabControllers()");
154 requiredMethod( "addTabController()");
156 log.println("add TABCONTROL2");
157 oObj.addTabController( tabControl2 );
159 log.println("get current controllers");
160 XTabController[] myTabControllers = oObj.getTabControllers();
162 log.println("remove TABCONTROL2");
163 oObj.removeTabController(tabControl2);
165 log.println("get new current controllers");
166 XTabController[] myNewTabControllers = oObj.getTabControllers();
168 tRes.tested("removeTabController()",
169 (myTabControllers.length > myNewTabControllers.length ));