1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _XImageConsumer.java,v $
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 ************************************************************************/
34 import lib
.MultiMethodTest
;
36 import com
.sun
.star
.awt
.XImageConsumer
;
39 * Testing <code>com.sun.star.awt.XImageConsumer</code>
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>
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;
57 * Initialize the consumer with size 2x2. <p>
58 * Has <b> OK </b> status if no runtime exceptions occured
62 boolean result
= true ;
65 tRes
.tested("init()", result
) ;
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 :
73 * <li> <code> init </code> </li>
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
) ;
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 :
92 * <li> <code> setColorModel </code> </li>
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 :
110 * <li> <code> setColorModel </code> </li>
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 :
127 * <li> <code> init </code> </li>
129 * The following method tests are to be executed before :
131 * <li> <code> setPixelsByBytes </code> </li>
132 * <li> <code> setPixelsByBytes </code> </li>
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
) ;