Update ooo320-m1
[ooovba.git] / qadevOOo / tests / java / ifc / ui / dialogs / _XFilePreview.java
blob5d2c6a090394185ba37bae7d23f4b6fb36267f06
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _XFilePreview.java,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 package ifc.ui.dialogs;
33 import lib.MultiMethodTest;
34 import lib.StatusException;
36 import com.sun.star.ui.dialogs.XFilePreview;
38 public class _XFilePreview extends MultiMethodTest {
40 public XFilePreview oObj=null;
42 /**
43 * _getSupportedImageFormats() gets all formats and
44 * stores them in an Array of short.<br>
45 * Is OK is the resulting Array isn't empty
47 public void _getSupportedImageFormats() {
48 short[] formats = oObj.getSupportedImageFormats();
49 tRes.tested("getSupportedImageFormats()", formats.length > 0);
52 /**
53 * _getTargetColorDepth() gets the color depth
54 * and stores it in an int.<br>
55 * Is OK is the resulting int isn't 1
57 public void _getTargetColorDepth() {
58 int CDepth = oObj.getTargetColorDepth();
59 tRes.tested("getTargetColorDepth()",CDepth != 1);
62 /**
63 * _getAvailableWidth() gets the width
64 * and stores it in an int.<br>
65 * Is OK is the resulting int isn't 1
67 public void _getAvailableWidth() {
68 int the_width = oObj.getAvailableWidth();
69 tRes.tested("getAvailableWidth()", the_width != 1);
72 /**
73 * _getAvailableHeight() gets the width
74 * and stores it in an int.<br>
75 * Is OK is the resulting int isn't 1
77 public void _getAvailableHeight() {
78 int the_height = oObj.getAvailableHeight();
79 tRes.tested("getAvailableHeight()", the_height != 1);
82 /**
83 * sets the empty image.
84 * Is OK if no exception no exceptions were thrown.
86 public void _setImage() {
87 boolean bOK = true;
88 try {
89 oObj.setImage
90 (com.sun.star.ui.dialogs.FilePreviewImageFormats.BITMAP,null);
91 } catch(com.sun.star.lang.IllegalArgumentException e) {
92 bOK = false;
93 throw new StatusException( "Can't set empty image", e );
95 tRes.tested("setImage()", bOK);
98 boolean prev_state;
101 * _setShowState() sets the state
102 * to the opposite value returned by getShowState.<br>
103 * Is OK is the returned result is false or if
104 * the value that was set is equal to the value
105 * that was returned by getShowState.
107 public void _setShowState() {
108 requiredMethod("getShowState()");
109 boolean success = oObj.setShowState(!prev_state);
110 boolean res_state = oObj.getShowState();
111 tRes.tested("setShowState()", !success || res_state != prev_state);
115 * _getShowState() gets the state
116 * and sets it to the opposite.<br>
117 * Is OK if no exceptions were thrown
119 public void _getShowState() {
120 prev_state = oObj.getShowState();
121 tRes.tested("getShowState()", true);