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 lib
.MultiMethodTest
;
23 import com
.sun
.star
.awt
.Size
;
24 import com
.sun
.star
.awt
.XGraphics
;
25 import com
.sun
.star
.awt
.XView
;
28 * Testing <code>com.sun.star.awt.XView</code>
31 * <li><code> setGraphics() </code></li>
32 * <li><code> getGraphics() </code></li>
33 * <li><code> getSize() </code></li>
34 * <li><code> draw() </code></li>
35 * <li><code> setZoom() </code></li>
37 * This test needs the following object relations :
39 * <li> <code>'GRAPHICS'</code> (of type <code>XGraphics</code>):
40 * used as a parameter to setGraphics() </li>
42 * Test is <b> NOT </b> multithread compliant. <p>
43 * @see com.sun.star.awt.XView
45 public class _XView
extends MultiMethodTest
{
46 public XView oObj
= null;
49 * After obtaining object relation 'GRAPHICS', test calls the method. <p>
50 * Has <b> OK </b> status if the method returns true.
52 public void _setGraphics() {
53 XGraphics graph
= (XGraphics
) tEnv
.getObjRelation("GRAPHICS");
54 boolean isSet
= oObj
.setGraphics(graph
);
56 log
.println("setGraphics() returns false");
58 tRes
.tested("setGraphics()", isSet
);
62 * Test calls the method. <p>
63 * Has <b> OK </b> status if the method does not return null. <p>
64 * The following method tests are to be completed successfully before :
66 * <li> <code> setGraphics() </code> : sets the output device </li>
69 public void _getGraphics() {
70 requiredMethod("setGraphics()");
71 XGraphics graph
= oObj
.getGraphics();
73 log
.println("getGraphics() returns NULL");
75 tRes
.tested("getGraphics()", graph
!= null);
79 * Test calls the method. <p>
80 * Has <b> OK </b> status if the method returns structure with fields that
81 * are not equal to zero. <p>
82 * The following method tests are to be completed successfully before :
84 * <li> <code> setGraphics() </code> : sets the output device </li>
87 public void _getSize() {
88 requiredMethod("setGraphics()");
89 Size aSize
= oObj
.getSize();
90 boolean res
= (aSize
.Height
!= 0) && (aSize
.Width
!= 0);
92 log
.println("Height: " + aSize
.Height
);
93 log
.println("Width: " + aSize
.Width
);
95 tRes
.tested("getSize()", res
);
99 * Test calls the method. <p>
100 * Has <b> OK </b> status if no exceptions were thrown. <p>
101 * The following method tests are to be completed successfully before :
103 * <li> <code> setGraphics() </code> : sets the output device </li>
106 public void _draw() {
107 requiredMethod("setGraphics()");
109 tRes
.tested("draw()", true);
113 * Test calls the method. <p>
114 * Has <b> OK </b> status if no exceptions were thrown. <p>
115 * The following method tests are to be completed successfully before :
117 * <li> <code> setGraphics() </code> : sets the output device </li>
120 public void _setZoom() {
121 requiredMethod("setGraphics()");
123 tRes
.tested("setZoom()", true);
127 * Forces environment recreation.
130 protected void after() {
131 disposeEnvironment();