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.ui.dialogs; 29 30 import lib.MultiMethodTest; 31 import lib.StatusException; 32 33 import com.sun.star.ui.dialogs.XFilePreview; 34 35 public class _XFilePreview extends MultiMethodTest { 36 37 public XFilePreview oObj=null; 38 39 /** 40 * _getSupportedImageFormats() gets all formats and 41 * stores them in an Array of short.<br> 42 * Is OK is the resulting Array isn't empty 43 */ 44 public void _getSupportedImageFormats() { 45 short[] formats = oObj.getSupportedImageFormats(); 46 tRes.tested("getSupportedImageFormats()", formats.length > 0); 47 } 48 49 /** 50 * _getTargetColorDepth() gets the color depth 51 * and stores it in an int.<br> 52 * Is OK is the resulting int isn't 1 53 */ 54 public void _getTargetColorDepth() { 55 int CDepth = oObj.getTargetColorDepth(); 56 tRes.tested("getTargetColorDepth()",CDepth != 1); 57 } 58 59 /** 60 * _getAvailableWidth() gets the width 61 * and stores it in an int.<br> 62 * Is OK is the resulting int isn't 1 63 */ 64 public void _getAvailableWidth() { 65 int the_width = oObj.getAvailableWidth(); 66 tRes.tested("getAvailableWidth()", the_width != 1); 67 } 68 69 /** 70 * _getAvailableHeight() gets the width 71 * and stores it in an int.<br> 72 * Is OK is the resulting int isn't 1 73 */ 74 public void _getAvailableHeight() { 75 int the_height = oObj.getAvailableHeight(); 76 tRes.tested("getAvailableHeight()", the_height != 1); 77 } 78 79 /** 80 * sets the empty image. 81 * Is OK if no exception no exceptions were thrown. 82 */ 83 public void _setImage() { 84 boolean bOK = true; 85 try { 86 oObj.setImage 87 (com.sun.star.ui.dialogs.FilePreviewImageFormats.BITMAP,null); 88 } catch(com.sun.star.lang.IllegalArgumentException e) { 89 bOK = false; 90 throw new StatusException( "Can't set empty image", e ); 91 } 92 tRes.tested("setImage()", bOK); 93 } 94 95 boolean prev_state; 96 97 /** 98 * _setShowState() sets the state 99 * to the opposite value returned by getShowState.<br> 100 * Is OK is the returned result is false or if 101 * the value that was set is equal to the value 102 * that was returned by getShowState. 103 */ 104 public void _setShowState() { 105 requiredMethod("getShowState()"); 106 boolean success = oObj.setShowState(!prev_state); 107 boolean res_state = oObj.getShowState(); 108 tRes.tested("setShowState()", !success || res_state != prev_state); 109 } 110 111 /** 112 * _getShowState() gets the state 113 * and sets it to the opposite.<br> 114 * Is OK if no exceptions were thrown 115 */ 116 public void _getShowState() { 117 prev_state = oObj.getShowState(); 118 tRes.tested("getShowState()", true); 119 } 120 121 } 122 123