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 .
22 import lib
.MultiMethodTest
;
24 import com
.sun
.star
.awt
.XImageConsumer
;
27 * Testing <code>com.sun.star.awt.XImageConsumer</code>
30 * <li><code> init()</code></li>
31 * <li><code> setColorModel()</code></li>
32 * <li><code> setPixelsByBytes()</code></li>
33 * <li><code> setPixelsByLongs()</code></li>
34 * <li><code> complete()</code></li>
36 * Test is <b> NOT </b> multithread compliant. <p>
37 * @see com.sun.star.awt.XImageConsumer
40 public class _XImageConsumer
extends MultiMethodTest
{
42 public XImageConsumer oObj
= null;
45 * Initialize the consumer with size 2x2. <p>
46 * Has <b> OK </b> status if no runtime exceptions occurred
50 boolean result
= true ;
53 tRes
.tested("init()", result
) ;
57 * Sets color model. <p>
58 * Has <b> OK </b> status if no runtime exceptions occurred
59 * The following method tests are to be completed successfully before :
61 * <li> <code> init </code> </li>
64 public void _setColorModel() {
65 requiredMethod("init()") ;
67 boolean result
= true ;
68 int[] pal
= new int[256] ;
69 for (int i
= 0; i
< 256; i
++) pal
[i
] = i
;
70 oObj
.setColorModel((short)8, pal
, 100, 100, 100, 100) ;
72 tRes
.tested("setColorModel()", result
) ;
76 * Fill the picture with for pixels. <p>
77 * Has <b> OK </b> status if no runtime exceptions occurred
78 * The following method tests are to be executed before :
80 * <li> <code> setColorModel </code> </li>
83 public void _setPixelsByBytes() {
84 executeMethod("setColorModel()") ;
86 boolean result
= true ;
87 oObj
.setPixelsByBytes(0, 0, 2, 2,
88 new byte[] {(byte)0, (byte)255, (byte)255, (byte)0}, 0, 2) ;
90 tRes
.tested("setPixelsByBytes()", result
) ;
94 * Fill the picture with for pixels. <p>
95 * Has <b> OK </b> status if no runtime exceptions occurred
96 * The following method tests are to be executed before :
98 * <li> <code> setColorModel </code> </li>
101 public void _setPixelsByLongs() {
102 executeMethod("setColorModel()") ;
104 boolean result
= true ;
105 oObj
.setPixelsByLongs(0, 0, 2, 2, new int[] {0, 255, 255, 0}, 0, 2) ;
107 tRes
.tested("setPixelsByLongs()", result
) ;
111 * Just calls the method. <p>
112 * Has <b> OK </b> status if no runtime exceptions occurred
113 * The following method tests are to be completed successfully before :
115 * <li> <code> init </code> </li>
117 * The following method tests are to be executed before :
119 * <li> <code> setPixelsByBytes </code> </li>
120 * <li> <code> setPixelsByBytes </code> </li>
123 public void _complete() {
124 requiredMethod("init()") ;
125 executeMethod("setPixelsByBytes()") ;
126 executeMethod("setPixelsByBytes()") ;
128 boolean result
= true ;
129 oObj
.complete(0, null) ;
131 tRes
.tested("complete()", result
) ;