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 .
21 import com
.sun
.star
.awt
.Point
;
22 import com
.sun
.star
.frame
.XFrame
;
23 import com
.sun
.star
.frame
.XLayoutManager
;
24 import com
.sun
.star
.awt
.Rectangle
;
25 import com
.sun
.star
.awt
.Size
;
26 import com
.sun
.star
.ui
.DockingArea
;
27 import com
.sun
.star
.ui
.XUIElement
;
28 import lib
.MultiMethodTest
;
31 public class _XLayoutManager
extends MultiMethodTest
{
32 public XLayoutManager oObj
= null;
34 private XFrame xFrame
= null;
35 private String sElementName
= "private:resource/menubar/myMenu";
37 public void before() {
38 xFrame
= (XFrame
)tEnv
.getObjRelation("XLayoutManager.Frame");
41 public void _attachFrame() {
42 oObj
.attachFrame(xFrame
);
43 tRes
.tested("attachFrame()", true);
46 public void _createElement() {
47 requiredMethod("attachFrame()");
48 oObj
.createElement(sElementName
);
49 tRes
.tested("createElement()", true);
52 public void _destroyElement() {
53 requiredMethod("getElement()");
54 requiredMethod("getElements()");
55 oObj
.destroyElement(sElementName
);
56 tRes
.tested("destroyElement()", true);
59 public void _doLayout() {
61 tRes
.tested("doLayout()", true);
64 public void _dockWindow() {
65 requiredMethod("createElement()");
66 Point p
= new Point();
69 oObj
.dockWindow(sElementName
, DockingArea
.DOCKINGAREA_TOP
, p
);
70 tRes
.tested("dockWindow()", true);
73 public void _floatWindow() {
74 requiredMethod("createElement()");
75 oObj
.floatWindow(sElementName
);
76 tRes
.tested("floatWindow()", true);
79 public void _getCurrentDockingArea() {
80 requiredMethod("attachFrame()");
81 Rectangle rect
= oObj
.getCurrentDockingArea();
82 tRes
.tested("getCurrentDockingArea()", rect
!= null);
85 public void _getElement() {
86 requiredMethod("createElement()");
87 oObj
.getElement(sElementName
);
88 tRes
.tested("getElement()", true);
91 public void _getElementPos() {
92 Point p
= oObj
.getElementPos(sElementName
);
93 tRes
.tested("getElementPos()", p
!= null);
96 public void _getElementSize() {
97 Size s
= oObj
.getElementSize(sElementName
);
98 tRes
.tested("getElementSize()", s
!= null);
101 public void _getElements() {
102 requiredMethod("createElement()");
103 XUIElement
[] xElements
= oObj
.getElements();
104 for (int i
=0; i
<xElements
.length
; i
++) {
105 Object o
= xElements
[i
].getRealInterface();
106 log
.println("Element " + i
+ ": " + o
.toString() + " " + utils
.getImplName(o
));
108 tRes
.tested("getElements()", xElements
!= null);
111 public void _hideElement() {
112 oObj
.hideElement(sElementName
);
113 tRes
.tested("hideElement()", true);
116 public void _isElementDocked() {
117 oObj
.isElementDocked(sElementName
);
118 tRes
.tested("isElementDocked()", true);
121 public void _isElementFloating() {
122 oObj
.isElementFloating(sElementName
);
123 tRes
.tested("isElementFloating()", true);
126 public void _isElementVisible() {
127 oObj
.isElementVisible(sElementName
);
128 tRes
.tested("isElementVisible()", true);
131 public void _lock() {
133 tRes
.tested("lock()", true);
136 public void _reset() {
138 tRes
.tested("reset()", true);
141 public void _setDockingAreaAcceptor() {
142 oObj
.setDockingAreaAcceptor(null);
143 tRes
.tested("setDockingAreaAcceptor()", true);
146 public void _setElementPos() {
147 requiredMethod("createElement()");
148 Point p
= new Point();
151 oObj
.setElementPos(sElementName
, p
);
152 tRes
.tested("setElementPos()", true);
155 public void _setElementPosSize() {
156 requiredMethod("createElement()");
157 Point p
= new Point();
160 Size size
= new Size();
163 oObj
.setElementPosSize(sElementName
, p
, size
);
164 tRes
.tested("setElementPosSize()", true);
167 public void _setElementSize() {
168 requiredMethod("createElement()");
169 Size size
= new Size();
172 oObj
.setElementSize(sElementName
, size
);
173 tRes
.tested("setElementSize()", true);
176 public void _showElement() {
177 requiredMethod("createElement()");
178 oObj
.showElement(sElementName
);
179 tRes
.tested("showElement()", true);
183 public void _unlock() {
184 requiredMethod("lock()");
186 tRes
.tested("unlock()", true);