2 * This file is part of the LibreOffice project.
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/.
8 * This file incorporates work covered by the following license notice:
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 .
19 package ifc
.ui
.dialogs
;
21 import lib
.MultiMethodTest
;
22 import lib
.StatusException
;
24 import com
.sun
.star
.ui
.dialogs
.XFilePreview
;
26 public class _XFilePreview
extends MultiMethodTest
{
28 public XFilePreview oObj
=null;
31 * _getSupportedImageFormats() gets all formats and
32 * stores them in an Array of short.<br>
33 * Is OK is the resulting Array isn't empty
35 public void _getSupportedImageFormats() {
36 short[] formats
= oObj
.getSupportedImageFormats();
37 tRes
.tested("getSupportedImageFormats()", formats
.length
> 0);
41 * _getTargetColorDepth() gets the color depth
42 * and stores it in an int.<br>
43 * Is OK is the resulting int isn't 1
45 public void _getTargetColorDepth() {
46 int CDepth
= oObj
.getTargetColorDepth();
47 tRes
.tested("getTargetColorDepth()",CDepth
!= 1);
51 * _getAvailableWidth() gets the width
52 * and stores it in an int.<br>
53 * Is OK is the resulting int isn't 1
55 public void _getAvailableWidth() {
56 int the_width
= oObj
.getAvailableWidth();
57 tRes
.tested("getAvailableWidth()", the_width
!= 1);
61 * _getAvailableHeight() gets the width
62 * and stores it in an int.<br>
63 * Is OK is the resulting int isn't 1
65 public void _getAvailableHeight() {
66 int the_height
= oObj
.getAvailableHeight();
67 tRes
.tested("getAvailableHeight()", the_height
!= 1);
71 * sets the empty image.
72 * Is OK if no exception no exceptions were thrown.
74 public void _setImage() {
78 (com
.sun
.star
.ui
.dialogs
.FilePreviewImageFormats
.BITMAP
,null);
79 } catch(com
.sun
.star
.lang
.IllegalArgumentException e
) {
81 throw new StatusException( "Can't set empty image", e
);
83 tRes
.tested("setImage()", bOK
);
89 * _setShowState() sets the state
90 * to the opposite value returned by getShowState.<br>
91 * Is OK is the returned result is false or if
92 * the value that was set is equal to the value
93 * that was returned by getShowState.
95 public void _setShowState() {
96 requiredMethod("getShowState()");
97 boolean success
= oObj
.setShowState(!prev_state
);
98 boolean res_state
= oObj
.getShowState();
99 tRes
.tested("setShowState()", !success
|| res_state
!= prev_state
);
103 * _getShowState() gets the state
104 * and sets it to the opposite.<br>
105 * Is OK if no exceptions were thrown
107 public void _getShowState() {
108 prev_state
= oObj
.getShowState();
109 tRes
.tested("getShowState()", true);