1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 package ifc.awt; 29 30 31 import lib.MultiMethodTest; 32 33 import com.sun.star.awt.XImageConsumer; 34 35 /** 36 * Testing <code>com.sun.star.awt.XImageConsumer</code> 37 * interface methods : 38 * <ul> 39 * <li><code> init()</code></li> 40 * <li><code> setColorModel()</code></li> 41 * <li><code> setPixelsByBytes()</code></li> 42 * <li><code> setPixelsByLongs()</code></li> 43 * <li><code> complete()</code></li> 44 * </ul> <p> 45 * Test is <b> NOT </b> multithread compilant. <p> 46 * @see com.sun.star.awt.XImageConsumer 47 */ 48 49 public class _XImageConsumer extends MultiMethodTest { 50 51 public XImageConsumer oObj = null; 52 53 /** 54 * Initialize the consumer with size 2x2. <p> 55 * Has <b> OK </b> status if no runtime exceptions occured 56 */ 57 public void _init() { 58 59 boolean result = true ; 60 oObj.init(2, 2) ; 61 62 tRes.tested("init()", result) ; 63 } 64 65 /** 66 * Sets color model. <p> 67 * Has <b> OK </b> status if no runtime exceptions occured 68 * The following method tests are to be completed successfully before : 69 * <ul> 70 * <li> <code> init </code> </li> 71 * </ul> 72 */ 73 public void _setColorModel() { 74 requiredMethod("init()") ; 75 76 boolean result = true ; 77 int[] pal = new int[256] ; 78 for (int i = 0; i < 256; i++) pal[i] = i ; 79 oObj.setColorModel((short)8, pal, 100, 100, 100, 100) ; 80 81 tRes.tested("setColorModel()", result) ; 82 } 83 84 /** 85 * Fill the picture with for pixels. <p> 86 * Has <b> OK </b> status if no runtime exceptions occured 87 * The following method tests are to be executed before : 88 * <ul> 89 * <li> <code> setColorModel </code> </li> 90 * </ul> 91 */ 92 public void _setPixelsByBytes() { 93 executeMethod("setColorModel()") ; 94 95 boolean result = true ; 96 oObj.setPixelsByBytes(0, 0, 2, 2, 97 new byte[] {(byte)0, (byte)255, (byte)255, (byte)0}, 0, 2) ; 98 99 tRes.tested("setPixelsByBytes()", result) ; 100 } 101 102 /** 103 * Fill the picture with for pixels. <p> 104 * Has <b> OK </b> status if no runtime exceptions occured 105 * The following method tests are to be executed before : 106 * <ul> 107 * <li> <code> setColorModel </code> </li> 108 * </ul> 109 */ 110 public void _setPixelsByLongs() { 111 executeMethod("setColorModel()") ; 112 113 boolean result = true ; 114 oObj.setPixelsByLongs(0, 0, 2, 2, new int[] {0, 255, 255, 0}, 0, 2) ; 115 116 tRes.tested("setPixelsByLongs()", result) ; 117 } 118 119 /** 120 * Just calls the method. <p> 121 * Has <b> OK </b> status if no runtime exceptions occured 122 * The following method tests are to be completed successfully before : 123 * <ul> 124 * <li> <code> init </code> </li> 125 * </ul> <p> 126 * The following method tests are to be executed before : 127 * <ul> 128 * <li> <code> setPixelsByBytes </code> </li> 129 * <li> <code> setPixelsByBytes </code> </li> 130 * </ul> 131 */ 132 public void _complete() { 133 requiredMethod("init()") ; 134 executeMethod("setPixelsByBytes()") ; 135 executeMethod("setPixelsByBytes()") ; 136 137 boolean result = true ; 138 oObj.complete(0, null) ; 139 140 tRes.tested("complete()", result) ; 141 } 142 } 143 144 145