1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _XFilePreview.java,v $
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;
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);
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);
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);
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);
83 * sets the empty image.
84 * Is OK if no exception no exceptions were thrown.
86 public void _setImage() {
90 (com
.sun
.star
.ui
.dialogs
.FilePreviewImageFormats
.BITMAP
,null);
91 } catch(com
.sun
.star
.lang
.IllegalArgumentException e
) {
93 throw new StatusException( "Can't set empty image", e
);
95 tRes
.tested("setImage()", bOK
);
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);