merge the formfield patch from ooo-build
[ooovba.git] / qadevOOo / tests / java / ifc / awt / _XView.java
blob2b7b5ccab8617b47136c16ea7b146d58d30e6b11
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: _XView.java,v $
10 * $Revision: 1.6 $
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.awt;
33 import lib.MultiMethodTest;
35 import com.sun.star.awt.Size;
36 import com.sun.star.awt.XGraphics;
37 import com.sun.star.awt.XView;
39 /**
40 * Testing <code>com.sun.star.awt.XView</code>
41 * interface methods:
42 * <ul>
43 * <li><code> setGraphics() </code></li>
44 * <li><code> getGraphics() </code></li>
45 * <li><code> getSize() </code></li>
46 * <li><code> draw() </code></li>
47 * <li><code> setZoom() </code></li>
48 * </ul><p>
49 * This test needs the following object relations :
50 * <ul>
51 * <li> <code>'GRAPHICS'</code> (of type <code>XGraphics</code>):
52 * used as a parameter to setGraphics() </li>
53 * </ul> <p>
54 * Test is <b> NOT </b> multithread compilant. <p>
55 * @see com.sun.star.awt.XView
57 public class _XView extends MultiMethodTest {
58 public XView oObj = null;
60 /**
61 * After obtaining object relation 'GRAPHICS', test calls the method. <p>
62 * Has <b> OK </b> status if the method returns true.
64 public void _setGraphics() {
65 XGraphics graph = (XGraphics) tEnv.getObjRelation("GRAPHICS");
66 boolean isSet = oObj.setGraphics(graph);
67 if ( !isSet ) {
68 log.println("setGraphics() returns false");
70 tRes.tested("setGraphics()", isSet);
73 /**
74 * Test calls the method. <p>
75 * Has <b> OK </b> status if the method does not return null. <p>
76 * The following method tests are to be completed successfully before :
77 * <ul>
78 * <li> <code> setGraphics() </code> : sets the output device </li>
79 * </ul>
81 public void _getGraphics() {
82 requiredMethod("setGraphics()");
83 XGraphics graph = oObj.getGraphics();
84 if (graph == null) {
85 log.println("getGraphics() returns NULL");
87 tRes.tested("getGraphics()", graph != null);
90 /**
91 * Test calls the method. <p>
92 * Has <b> OK </b> status if the method returns structure with fields that
93 * are not equal to zero. <p>
94 * The following method tests are to be completed successfully before :
95 * <ul>
96 * <li> <code> setGraphics() </code> : sets the output device </li>
97 * </ul>
99 public void _getSize() {
100 requiredMethod("setGraphics()");
101 Size aSize = oObj.getSize();
102 boolean res = (aSize.Height != 0) && (aSize.Width != 0);
103 if ( !res ) {
104 log.println("Height: " + aSize.Height);
105 log.println("Width: " + aSize.Width);
107 tRes.tested("getSize()", res);
111 * Test calls the method. <p>
112 * Has <b> OK </b> status if no exceptions were thrown. <p>
113 * The following method tests are to be completed successfully before :
114 * <ul>
115 * <li> <code> setGraphics() </code> : sets the output device </li>
116 * </ul>
118 public void _draw() {
119 requiredMethod("setGraphics()");
120 oObj.draw(20, 20);
121 tRes.tested("draw()", true);
125 * Test calls the method. <p>
126 * Has <b> OK </b> status if no exceptions were thrown. <p>
127 * The following method tests are to be completed successfully before :
128 * <ul>
129 * <li> <code> setGraphics() </code> : sets the output device </li>
130 * </ul>
132 public void _setZoom() {
133 requiredMethod("setGraphics()");
134 oObj.setZoom(2,2);
135 tRes.tested("setZoom()", true);
139 * Forces environment recreation.
141 protected void after() {
142 disposeEnvironment();