1*ef39d40dSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*ef39d40dSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*ef39d40dSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*ef39d40dSAndrew Rist  * distributed with this work for additional information
6*ef39d40dSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*ef39d40dSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*ef39d40dSAndrew Rist  * "License"); you may not use this file except in compliance
9*ef39d40dSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*ef39d40dSAndrew Rist  *
11*ef39d40dSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*ef39d40dSAndrew Rist  *
13*ef39d40dSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*ef39d40dSAndrew Rist  * software distributed under the License is distributed on an
15*ef39d40dSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*ef39d40dSAndrew Rist  * KIND, either express or implied.  See the License for the
17*ef39d40dSAndrew Rist  * specific language governing permissions and limitations
18*ef39d40dSAndrew Rist  * under the License.
19*ef39d40dSAndrew Rist  *
20*ef39d40dSAndrew Rist  *************************************************************/
21*ef39d40dSAndrew Rist 
22*ef39d40dSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir package ifc.ui.dialogs;
25cdf0e10cSrcweir 
26cdf0e10cSrcweir import lib.MultiMethodTest;
27cdf0e10cSrcweir import lib.StatusException;
28cdf0e10cSrcweir 
29cdf0e10cSrcweir import com.sun.star.ui.dialogs.XFilePreview;
30cdf0e10cSrcweir 
31cdf0e10cSrcweir public class _XFilePreview extends MultiMethodTest {
32cdf0e10cSrcweir 
33cdf0e10cSrcweir     public XFilePreview oObj=null;
34cdf0e10cSrcweir 
35cdf0e10cSrcweir     /**
36cdf0e10cSrcweir      * _getSupportedImageFormats() gets all formats and
37cdf0e10cSrcweir      * stores them in an Array of short.<br>
38cdf0e10cSrcweir      * Is OK is the resulting Array isn't empty
39cdf0e10cSrcweir     */
_getSupportedImageFormats()40cdf0e10cSrcweir     public void _getSupportedImageFormats() {
41cdf0e10cSrcweir         short[] formats = oObj.getSupportedImageFormats();
42cdf0e10cSrcweir         tRes.tested("getSupportedImageFormats()", formats.length > 0);
43cdf0e10cSrcweir     }
44cdf0e10cSrcweir 
45cdf0e10cSrcweir     /**
46cdf0e10cSrcweir      * _getTargetColorDepth() gets the color depth
47cdf0e10cSrcweir      * and stores it in an int.<br>
48cdf0e10cSrcweir      * Is OK is the resulting int isn't 1
49cdf0e10cSrcweir     */
_getTargetColorDepth()50cdf0e10cSrcweir     public void _getTargetColorDepth() {
51cdf0e10cSrcweir         int CDepth = oObj.getTargetColorDepth();
52cdf0e10cSrcweir         tRes.tested("getTargetColorDepth()",CDepth != 1);
53cdf0e10cSrcweir     }
54cdf0e10cSrcweir 
55cdf0e10cSrcweir     /**
56cdf0e10cSrcweir      * _getAvailableWidth() gets the width
57cdf0e10cSrcweir      * and stores it in an int.<br>
58cdf0e10cSrcweir      * Is OK is the resulting int isn't 1
59cdf0e10cSrcweir     */
_getAvailableWidth()60cdf0e10cSrcweir     public void _getAvailableWidth() {
61cdf0e10cSrcweir         int the_width = oObj.getAvailableWidth();
62cdf0e10cSrcweir         tRes.tested("getAvailableWidth()", the_width != 1);
63cdf0e10cSrcweir     }
64cdf0e10cSrcweir 
65cdf0e10cSrcweir     /**
66cdf0e10cSrcweir      * _getAvailableHeight() gets the width
67cdf0e10cSrcweir      * and stores it in an int.<br>
68cdf0e10cSrcweir      * Is OK is the resulting int isn't 1
69cdf0e10cSrcweir     */
_getAvailableHeight()70cdf0e10cSrcweir     public void _getAvailableHeight() {
71cdf0e10cSrcweir         int the_height = oObj.getAvailableHeight();
72cdf0e10cSrcweir         tRes.tested("getAvailableHeight()", the_height != 1);
73cdf0e10cSrcweir     }
74cdf0e10cSrcweir 
75cdf0e10cSrcweir     /**
76cdf0e10cSrcweir     * sets the empty image.
77cdf0e10cSrcweir     * Is OK if no exception no exceptions were thrown.
78cdf0e10cSrcweir     */
_setImage()79cdf0e10cSrcweir     public void _setImage() {
80cdf0e10cSrcweir         boolean bOK = true;
81cdf0e10cSrcweir         try {
82cdf0e10cSrcweir             oObj.setImage
83cdf0e10cSrcweir                 (com.sun.star.ui.dialogs.FilePreviewImageFormats.BITMAP,null);
84cdf0e10cSrcweir         } catch(com.sun.star.lang.IllegalArgumentException e) {
85cdf0e10cSrcweir             bOK = false;
86cdf0e10cSrcweir             throw new StatusException( "Can't set empty image", e );
87cdf0e10cSrcweir         }
88cdf0e10cSrcweir         tRes.tested("setImage()", bOK);
89cdf0e10cSrcweir     }
90cdf0e10cSrcweir 
91cdf0e10cSrcweir     boolean prev_state;
92cdf0e10cSrcweir 
93cdf0e10cSrcweir     /**
94cdf0e10cSrcweir      * _setShowState() sets the state
95cdf0e10cSrcweir      * to the opposite value returned by getShowState.<br>
96cdf0e10cSrcweir      * Is OK is the returned result is false or if
97cdf0e10cSrcweir      * the value that was set is equal to the value
98cdf0e10cSrcweir      * that was returned by getShowState.
99cdf0e10cSrcweir     */
_setShowState()100cdf0e10cSrcweir     public void _setShowState() {
101cdf0e10cSrcweir         requiredMethod("getShowState()");
102cdf0e10cSrcweir         boolean success = oObj.setShowState(!prev_state);
103cdf0e10cSrcweir         boolean res_state = oObj.getShowState();
104cdf0e10cSrcweir         tRes.tested("setShowState()", !success || res_state != prev_state);
105cdf0e10cSrcweir     }
106cdf0e10cSrcweir 
107cdf0e10cSrcweir     /**
108cdf0e10cSrcweir      * _getShowState() gets the state
109cdf0e10cSrcweir      * and sets it to the opposite.<br>
110cdf0e10cSrcweir      * Is OK if no exceptions were thrown
111cdf0e10cSrcweir     */
_getShowState()112cdf0e10cSrcweir     public void _getShowState() {
113cdf0e10cSrcweir         prev_state = oObj.getShowState();
114cdf0e10cSrcweir         tRes.tested("getShowState()", true);
115cdf0e10cSrcweir     }
116cdf0e10cSrcweir 
117cdf0e10cSrcweir }
118cdf0e10cSrcweir 
119