Branch libreoffice-5-0-4
[LibreOffice.git] / qadevOOo / tests / java / ifc / frame / _XLayoutManager.java
blobce2641498da8342bf8267805e73b3ca9ed6722bf
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.frame;
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;
29 import util.utils;
31 public class _XLayoutManager extends MultiMethodTest {
32 public XLayoutManager oObj = null;
34 private XFrame xFrame = null;
35 private static final String sElementName = "private:resource/menubar/myMenu";
37 @Override
38 public void before() {
39 xFrame = (XFrame)tEnv.getObjRelation("XLayoutManager.Frame");
42 public void _attachFrame() {
43 oObj.attachFrame(xFrame);
44 tRes.tested("attachFrame()", true);
47 public void _createElement() {
48 requiredMethod("attachFrame()");
49 oObj.createElement(sElementName);
50 tRes.tested("createElement()", true);
53 public void _destroyElement() {
54 requiredMethod("getElement()");
55 requiredMethod("getElements()");
56 oObj.destroyElement(sElementName);
57 tRes.tested("destroyElement()", true);
60 public void _doLayout() {
61 oObj.doLayout();
62 tRes.tested("doLayout()", true);
65 public void _dockWindow() {
66 requiredMethod("createElement()");
67 Point p = new Point();
68 p.X = 0;
69 p.Y = 0;
70 oObj.dockWindow(sElementName, DockingArea.DOCKINGAREA_TOP, p);
71 tRes.tested("dockWindow()", true);
74 public void _floatWindow() {
75 requiredMethod("createElement()");
76 oObj.floatWindow(sElementName);
77 tRes.tested("floatWindow()", true);
80 public void _getCurrentDockingArea() {
81 requiredMethod("attachFrame()");
82 Rectangle rect = oObj.getCurrentDockingArea();
83 tRes.tested("getCurrentDockingArea()", rect != null);
86 public void _getElement() {
87 requiredMethod("createElement()");
88 oObj.getElement(sElementName);
89 tRes.tested("getElement()", true);
92 public void _getElementPos() {
93 Point p = oObj.getElementPos(sElementName);
94 tRes.tested("getElementPos()", p != null);
97 public void _getElementSize() {
98 Size s = oObj.getElementSize(sElementName);
99 tRes.tested("getElementSize()", s != null);
102 public void _getElements() {
103 requiredMethod("createElement()");
104 XUIElement[] xElements = oObj.getElements();
105 for (int i=0; i<xElements.length; i++) {
106 Object o = xElements[i].getRealInterface();
107 log.println("Element " + i + ": " + o.toString() + " " + utils.getImplName(o));
109 tRes.tested("getElements()", xElements != null);
112 public void _hideElement() {
113 oObj.hideElement(sElementName);
114 tRes.tested("hideElement()", true);
117 public void _isElementDocked() {
118 oObj.isElementDocked(sElementName);
119 tRes.tested("isElementDocked()", true);
122 public void _isElementFloating() {
123 oObj.isElementFloating(sElementName);
124 tRes.tested("isElementFloating()", true);
127 public void _isElementVisible() {
128 oObj.isElementVisible(sElementName);
129 tRes.tested("isElementVisible()", true);
132 public void _lock() {
133 oObj.lock();
134 tRes.tested("lock()", true);
137 public void _reset() {
138 oObj.reset();
139 tRes.tested("reset()", true);
142 public void _setDockingAreaAcceptor() {
143 oObj.setDockingAreaAcceptor(null);
144 tRes.tested("setDockingAreaAcceptor()", true);
147 public void _setElementPos() {
148 requiredMethod("createElement()");
149 Point p = new Point();
150 p.X = 0;
151 p.Y = 150;
152 oObj.setElementPos(sElementName, p);
153 tRes.tested("setElementPos()", true);
156 public void _setElementPosSize() {
157 requiredMethod("createElement()");
158 Point p = new Point();
159 p.X = 150;
160 p.Y = 0;
161 Size size = new Size();
162 size.Height = 50;
163 size.Width = 80;
164 oObj.setElementPosSize(sElementName, p, size);
165 tRes.tested("setElementPosSize()", true);
168 public void _setElementSize() {
169 requiredMethod("createElement()");
170 Size size = new Size();
171 size.Height = 80;
172 size.Width = 50;
173 oObj.setElementSize(sElementName, size);
174 tRes.tested("setElementSize()", true);
177 public void _showElement() {
178 requiredMethod("createElement()");
179 oObj.showElement(sElementName);
180 tRes.tested("showElement()", true);
184 public void _unlock() {
185 requiredMethod("lock()");
186 oObj.unlock();
187 tRes.tested("unlock()", true);