1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
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.
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).
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.
26 ************************************************************************/
28 package ifc
.ui
.dialogs
;
30 import lib
.MultiMethodTest
;
31 import lib
.StatusException
;
33 import com
.sun
.star
.ui
.dialogs
.XFilePreview
;
35 public class _XFilePreview
extends MultiMethodTest
{
37 public XFilePreview oObj
=null;
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
44 public void _getSupportedImageFormats() {
45 short[] formats
= oObj
.getSupportedImageFormats();
46 tRes
.tested("getSupportedImageFormats()", formats
.length
> 0);
50 * _getTargetColorDepth() gets the color depth
51 * and stores it in an int.<br>
52 * Is OK is the resulting int isn't 1
54 public void _getTargetColorDepth() {
55 int CDepth
= oObj
.getTargetColorDepth();
56 tRes
.tested("getTargetColorDepth()",CDepth
!= 1);
60 * _getAvailableWidth() gets the width
61 * and stores it in an int.<br>
62 * Is OK is the resulting int isn't 1
64 public void _getAvailableWidth() {
65 int the_width
= oObj
.getAvailableWidth();
66 tRes
.tested("getAvailableWidth()", the_width
!= 1);
70 * _getAvailableHeight() gets the width
71 * and stores it in an int.<br>
72 * Is OK is the resulting int isn't 1
74 public void _getAvailableHeight() {
75 int the_height
= oObj
.getAvailableHeight();
76 tRes
.tested("getAvailableHeight()", the_height
!= 1);
80 * sets the empty image.
81 * Is OK if no exception no exceptions were thrown.
83 public void _setImage() {
87 (com
.sun
.star
.ui
.dialogs
.FilePreviewImageFormats
.BITMAP
,null);
88 } catch(com
.sun
.star
.lang
.IllegalArgumentException e
) {
90 throw new StatusException( "Can't set empty image", e
);
92 tRes
.tested("setImage()", bOK
);
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.
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
);
112 * _getShowState() gets the state
113 * and sets it to the opposite.<br>
114 * Is OK if no exceptions were thrown
116 public void _getShowState() {
117 prev_state
= oObj
.getShowState();
118 tRes
.tested("getShowState()", true);