Branch libreoffice-5-0-4
[LibreOffice.git] / qadevOOo / tests / java / ifc / awt / _XImageConsumer.java
blob7c170fb256373f35db0eb5b2deecc0eea1c7d6dc
1 /*
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 .
19 package ifc.awt;
22 import lib.MultiMethodTest;
24 import com.sun.star.awt.XImageConsumer;
26 /**
27 * Testing <code>com.sun.star.awt.XImageConsumer</code>
28 * interface methods :
29 * <ul>
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>
35 * </ul> <p>
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;
44 /**
45 * Initialize the consumer with size 2x2. <p>
46 * Has <b> OK </b> status if no runtime exceptions occurred
48 public void _init() {
50 boolean result = true ;
51 oObj.init(2, 2) ;
53 tRes.tested("init()", result) ;
56 /**
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 :
60 * <ul>
61 * <li> <code> init </code> </li>
62 * </ul>
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) ;
75 /**
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 :
79 * <ul>
80 * <li> <code> setColorModel </code> </li>
81 * </ul>
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) ;
93 /**
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 :
97 * <ul>
98 * <li> <code> setColorModel </code> </li>
99 * </ul>
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 :
114 * <ul>
115 * <li> <code> init </code> </li>
116 * </ul> <p>
117 * The following method tests are to be executed before :
118 * <ul>
119 * <li> <code> setPixelsByBytes </code> </li>
120 * <li> <code> setPixelsByBytes </code> </li>
121 * </ul>
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) ;