1 /* 2 * This file is part of the LibreOffice project. 3 * 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/. 7 * 8 * This file incorporates work covered by the following license notice: 9 * 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 . 17 */ 18 19 package ifc.awt; 20 21 22 import lib.MultiMethodTest; 23 24 import com.sun.star.awt.XImageConsumer; 25 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 38 */ 39 40 public class _XImageConsumer extends MultiMethodTest { 41 42 public XImageConsumer oObj = null; 43 44 /** 45 * Initialize the consumer with size 2x2. <p> 46 * Has <b> OK </b> status if no runtime exceptions occurred 47 */ _init()48 public void _init() { 49 50 boolean result = true ; 51 oObj.init(2, 2) ; 52 53 tRes.tested("init()", result) ; 54 } 55 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> 63 */ _setColorModel()64 public void _setColorModel() { 65 requiredMethod("init()") ; 66 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) ; 71 72 tRes.tested("setColorModel()", result) ; 73 } 74 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> 82 */ _setPixelsByBytes()83 public void _setPixelsByBytes() { 84 executeMethod("setColorModel()") ; 85 86 boolean result = true ; 87 oObj.setPixelsByBytes(0, 0, 2, 2, 88 new byte[] {(byte)0, (byte)255, (byte)255, (byte)0}, 0, 2) ; 89 90 tRes.tested("setPixelsByBytes()", result) ; 91 } 92 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> 100 */ _setPixelsByLongs()101 public void _setPixelsByLongs() { 102 executeMethod("setColorModel()") ; 103 104 boolean result = true ; 105 oObj.setPixelsByLongs(0, 0, 2, 2, new int[] {0, 255, 255, 0}, 0, 2) ; 106 107 tRes.tested("setPixelsByLongs()", result) ; 108 } 109 110 /** 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> 122 */ _complete()123 public void _complete() { 124 requiredMethod("init()") ; 125 executeMethod("setPixelsByBytes()") ; 126 executeMethod("setPixelsByBytes()") ; 127 128 boolean result = true ; 129 oObj.complete(0, null) ; 130 131 tRes.tested("complete()", result) ; 132 } 133 } 134 135 136