Update ooo320-m1
[ooovba.git] / qadevOOo / tests / java / ifc / frame / _XLayoutManager.java
bloba8bba295e7d9ade6e7f6bc12bcedee255ffc4d14
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _XLayoutManager.java,v $
10 * $Revision: 1.5 $
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 ************************************************************************/
31 package ifc.frame;
33 import com.sun.star.awt.Point;
34 import com.sun.star.frame.XFrame;
35 import com.sun.star.frame.XLayoutManager;
36 import com.sun.star.awt.Rectangle;
37 import com.sun.star.awt.Size;
38 import com.sun.star.ui.DockingArea;
39 import com.sun.star.ui.XUIElement;
40 import lib.MultiMethodTest;
41 import util.utils;
43 public class _XLayoutManager extends MultiMethodTest {
44 public XLayoutManager oObj = null;
46 private XFrame xFrame = null;
47 private String sElementName = "private:resource/menubar/myMenu";
49 public void before() {
50 xFrame = (XFrame)tEnv.getObjRelation("XLayoutManager.Frame");
53 public void _attachFrame() {
54 oObj.attachFrame(xFrame);
55 tRes.tested("attachFrame()", true);
58 public void _createElement() {
59 requiredMethod("attachFrame()");
60 oObj.createElement(sElementName);
61 tRes.tested("createElement()", true);
64 public void _destroyElement() {
65 requiredMethod("getElement()");
66 requiredMethod("getElements()");
67 oObj.destroyElement(sElementName);
68 tRes.tested("destroyElement()", true);
71 public void _doLayout() {
72 oObj.doLayout();
73 tRes.tested("doLayout()", true);
76 public void _dockWindow() {
77 requiredMethod("createElement()");
78 Point p = new Point();
79 p.X = 0;
80 p.Y = 0;
81 oObj.dockWindow(sElementName, DockingArea.DOCKINGAREA_TOP, p);
82 tRes.tested("dockWindow()", true);
85 public void _floatWindow() {
86 requiredMethod("createElement()");
87 oObj.floatWindow(sElementName);
88 tRes.tested("floatWindow()", true);
91 public void _getCurrentDockingArea() {
92 requiredMethod("attachFrame()");
93 Rectangle rect = oObj.getCurrentDockingArea();
94 tRes.tested("getCurrentDockingArea()", rect != null);
97 public void _getElement() {
98 requiredMethod("createElement()");
99 XUIElement xElement = oObj.getElement(sElementName);
100 tRes.tested("getElement()", true);
103 public void _getElementPos() {
104 Point p = oObj.getElementPos(sElementName);
105 tRes.tested("getElementPos()", p != null);
108 public void _getElementSize() {
109 Size s = oObj.getElementSize(sElementName);
110 tRes.tested("getElementSize()", s != null);
113 public void _getElements() {
114 requiredMethod("createElement()");
115 XUIElement[] xElements = oObj.getElements();
116 for (int i=0; i<xElements.length; i++) {
117 Object o = xElements[i].getRealInterface();
118 log.println("Element " + i + ": " + o.toString() + " " + utils.getImplName(o));
120 tRes.tested("getElements()", xElements != null);
123 public void _hideElement() {
124 boolean hidden = oObj.hideElement(sElementName);
125 tRes.tested("hideElement()", true);
128 public void _isElementDocked() {
129 boolean docked = oObj.isElementDocked(sElementName);
130 tRes.tested("isElementDocked()", true);
133 public void _isElementFloating() {
134 boolean docked = oObj.isElementFloating(sElementName);
135 tRes.tested("isElementFloating()", true);
138 public void _isElementVisible() {
139 boolean docked = oObj.isElementVisible(sElementName);
140 tRes.tested("isElementVisible()", true);
143 public void _lock() {
144 oObj.lock();
145 tRes.tested("lock()", true);
148 public void _reset() {
149 oObj.reset();
150 tRes.tested("reset()", true);
153 public void _setDockingAreaAcceptor() {
154 oObj.setDockingAreaAcceptor(null);
155 tRes.tested("setDockingAreaAcceptor()", true);
158 public void _setElementPos() {
159 requiredMethod("createElement()");
160 Point p = new Point();
161 p.X = 0;
162 p.Y = 150;
163 oObj.setElementPos(sElementName, p);
164 tRes.tested("setElementPos()", true);
167 public void _setElementPosSize() {
168 requiredMethod("createElement()");
169 Point p = new Point();
170 p.X = 150;
171 p.Y = 0;
172 Size size = new Size();
173 size.Height = 50;
174 size.Width = 80;
175 oObj.setElementPosSize(sElementName, p, size);
176 tRes.tested("setElementPosSize()", true);
179 public void _setElementSize() {
180 requiredMethod("createElement()");
181 Size size = new Size();
182 size.Height = 80;
183 size.Width = 50;
184 oObj.setElementSize(sElementName, size);
185 tRes.tested("setElementSize()", true);
188 public void _showElement() {
189 requiredMethod("createElement()");
190 boolean shown = oObj.showElement(sElementName);
191 tRes.tested("showElement()", true);
195 public void _unlock() {
196 requiredMethod("lock()");
197 oObj.unlock();
198 tRes.tested("unlock()", true);