Update ooo320-m1
[ooovba.git] / qadevOOo / tests / java / ifc / awt / _XImageConsumer.java
blobb788b7fbd0f96f94823b53cfd47581b3e57213d2
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: _XImageConsumer.java,v $
10 * $Revision: 1.4 $
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;
34 import lib.MultiMethodTest;
36 import com.sun.star.awt.XImageConsumer;
38 /**
39 * Testing <code>com.sun.star.awt.XImageConsumer</code>
40 * interface methods :
41 * <ul>
42 * <li><code> init()</code></li>
43 * <li><code> setColorModel()</code></li>
44 * <li><code> setPixelsByBytes()</code></li>
45 * <li><code> setPixelsByLongs()</code></li>
46 * <li><code> complete()</code></li>
47 * </ul> <p>
48 * Test is <b> NOT </b> multithread compilant. <p>
49 * @see com.sun.star.awt.XImageConsumer
52 public class _XImageConsumer extends MultiMethodTest {
54 public XImageConsumer oObj = null;
56 /**
57 * Initialize the consumer with size 2x2. <p>
58 * Has <b> OK </b> status if no runtime exceptions occured
60 public void _init() {
62 boolean result = true ;
63 oObj.init(2, 2) ;
65 tRes.tested("init()", result) ;
68 /**
69 * Sets color model. <p>
70 * Has <b> OK </b> status if no runtime exceptions occured
71 * The following method tests are to be completed successfully before :
72 * <ul>
73 * <li> <code> init </code> </li>
74 * </ul>
76 public void _setColorModel() {
77 requiredMethod("init()") ;
79 boolean result = true ;
80 int[] pal = new int[256] ;
81 for (int i = 0; i < 256; i++) pal[i] = i ;
82 oObj.setColorModel((short)8, pal, 100, 100, 100, 100) ;
84 tRes.tested("setColorModel()", result) ;
87 /**
88 * Fill the picture with for pixels. <p>
89 * Has <b> OK </b> status if no runtime exceptions occured
90 * The following method tests are to be executed before :
91 * <ul>
92 * <li> <code> setColorModel </code> </li>
93 * </ul>
95 public void _setPixelsByBytes() {
96 executeMethod("setColorModel()") ;
98 boolean result = true ;
99 oObj.setPixelsByBytes(0, 0, 2, 2,
100 new byte[] {(byte)0, (byte)255, (byte)255, (byte)0}, 0, 2) ;
102 tRes.tested("setPixelsByBytes()", result) ;
106 * Fill the picture with for pixels. <p>
107 * Has <b> OK </b> status if no runtime exceptions occured
108 * The following method tests are to be executed before :
109 * <ul>
110 * <li> <code> setColorModel </code> </li>
111 * </ul>
113 public void _setPixelsByLongs() {
114 executeMethod("setColorModel()") ;
116 boolean result = true ;
117 oObj.setPixelsByLongs(0, 0, 2, 2, new int[] {0, 255, 255, 0}, 0, 2) ;
119 tRes.tested("setPixelsByLongs()", result) ;
123 * Just calls the method. <p>
124 * Has <b> OK </b> status if no runtime exceptions occured
125 * The following method tests are to be completed successfully before :
126 * <ul>
127 * <li> <code> init </code> </li>
128 * </ul> <p>
129 * The following method tests are to be executed before :
130 * <ul>
131 * <li> <code> setPixelsByBytes </code> </li>
132 * <li> <code> setPixelsByBytes </code> </li>
133 * </ul>
135 public void _complete() {
136 requiredMethod("init()") ;
137 executeMethod("setPixelsByBytes()") ;
138 executeMethod("setPixelsByBytes()") ;
140 boolean result = true ;
141 oObj.complete(0, null) ;
143 tRes.tested("complete()", result) ;