1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 package ifc.awt; 25 26 27 import lib.MultiMethodTest; 28 29 import com.sun.star.awt.XImageConsumer; 30 31 /** 32 * Testing <code>com.sun.star.awt.XImageConsumer</code> 33 * interface methods : 34 * <ul> 35 * <li><code> init()</code></li> 36 * <li><code> setColorModel()</code></li> 37 * <li><code> setPixelsByBytes()</code></li> 38 * <li><code> setPixelsByLongs()</code></li> 39 * <li><code> complete()</code></li> 40 * </ul> <p> 41 * Test is <b> NOT </b> multithread compilant. <p> 42 * @see com.sun.star.awt.XImageConsumer 43 */ 44 45 public class _XImageConsumer extends MultiMethodTest { 46 47 public XImageConsumer oObj = null; 48 49 /** 50 * Initialize the consumer with size 2x2. <p> 51 * Has <b> OK </b> status if no runtime exceptions occurred 52 */ _init()53 public void _init() { 54 55 boolean result = true ; 56 oObj.init(2, 2) ; 57 58 tRes.tested("init()", result) ; 59 } 60 61 /** 62 * Sets color model. <p> 63 * Has <b> OK </b> status if no runtime exceptions occurred 64 * The following method tests are to be completed successfully before : 65 * <ul> 66 * <li> <code> init </code> </li> 67 * </ul> 68 */ _setColorModel()69 public void _setColorModel() { 70 requiredMethod("init()") ; 71 72 boolean result = true ; 73 int[] pal = new int[256] ; 74 for (int i = 0; i < 256; i++) pal[i] = i ; 75 oObj.setColorModel((short)8, pal, 100, 100, 100, 100) ; 76 77 tRes.tested("setColorModel()", result) ; 78 } 79 80 /** 81 * Fill the picture with for pixels. <p> 82 * Has <b> OK </b> status if no runtime exceptions occurred 83 * The following method tests are to be executed before : 84 * <ul> 85 * <li> <code> setColorModel </code> </li> 86 * </ul> 87 */ _setPixelsByBytes()88 public void _setPixelsByBytes() { 89 executeMethod("setColorModel()") ; 90 91 boolean result = true ; 92 oObj.setPixelsByBytes(0, 0, 2, 2, 93 new byte[] {(byte)0, (byte)255, (byte)255, (byte)0}, 0, 2) ; 94 95 tRes.tested("setPixelsByBytes()", result) ; 96 } 97 98 /** 99 * Fill the picture with for pixels. <p> 100 * Has <b> OK </b> status if no runtime exceptions occurred 101 * The following method tests are to be executed before : 102 * <ul> 103 * <li> <code> setColorModel </code> </li> 104 * </ul> 105 */ _setPixelsByLongs()106 public void _setPixelsByLongs() { 107 executeMethod("setColorModel()") ; 108 109 boolean result = true ; 110 oObj.setPixelsByLongs(0, 0, 2, 2, new int[] {0, 255, 255, 0}, 0, 2) ; 111 112 tRes.tested("setPixelsByLongs()", result) ; 113 } 114 115 /** 116 * Just calls the method. <p> 117 * Has <b> OK </b> status if no runtime exceptions occurred 118 * The following method tests are to be completed successfully before : 119 * <ul> 120 * <li> <code> init </code> </li> 121 * </ul> <p> 122 * The following method tests are to be executed before : 123 * <ul> 124 * <li> <code> setPixelsByBytes </code> </li> 125 * <li> <code> setPixelsByBytes </code> </li> 126 * </ul> 127 */ _complete()128 public void _complete() { 129 requiredMethod("init()") ; 130 executeMethod("setPixelsByBytes()") ; 131 executeMethod("setPixelsByBytes()") ; 132 133 boolean result = true ; 134 oObj.complete(0, null) ; 135 136 tRes.tested("complete()", result) ; 137 } 138 } 139 140 141