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: _XFolderPicker.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
;
35 import com
.sun
.star
.lang
.XMultiServiceFactory
;
36 import com
.sun
.star
.ui
.dialogs
.XFolderPicker
;
39 * Testing <code>com.sun.star.ui.XFolderPicker</code>
42 * <li><code> setDisplayDirectory()</code></li>
43 * <li><code> getDisplayDirectory()</code></li>
45 * Test is <b> NOT </b> multithread compilant. <p>
46 * @see com.sun.star.ui.XFolderPicker
48 public class _XFolderPicker
extends MultiMethodTest
{
50 public XFolderPicker oObj
= null;
51 private String dir
= null ;
54 * Sets the current directory to SOffice temp dir. <p>
55 * Has <b>OK</b> status if no exceptions occured.
57 public void _setDisplayDirectory() {
58 boolean result
= true ;
59 dir
= util
.utils
.getOfficeTemp((XMultiServiceFactory
)tParam
.getMSF()) ;
61 log
.println("Trying to set dir '" + dir
+ "'") ;
63 oObj
.setDisplayDirectory(dir
) ;
64 } catch (com
.sun
.star
.lang
.IllegalArgumentException e
) {
65 log
.println("Directory '" + dir
+ "' not found :" + e
) ;
69 tRes
.tested("setDisplayDirectory()", result
) ;
73 * Gets the current directory. <p>
74 * Has <b>OK</b> status if get value is equal to set value
75 * passed to <code>setDisplayDirectory</code> <p>
76 * The following method tests are to be completed successfully before :
78 * <li> <code> setDisplayDirectory </code> </li>
81 public void _getDisplayDirectory() {
82 requiredMethod("setDisplayDirectory()") ;
84 String gDir
= oObj
.getDisplayDirectory() ;
86 log
.println("Get dir '" + gDir
+ "'") ;
88 tRes
.tested("getDisplayDirectory()", dir
.equals(gDir
)) ;
92 * Gets the directory chosen by the user. <p>
93 * Has <b>OK</b> status if get value is not NULL <p>
95 public void _getDirectory() {
97 String gDir
= oObj
.getDirectory() ;
99 log
.println("Get dir '" + gDir
+ "'") ;
101 tRes
.tested("getDirectory()", gDir
!= null) ;
105 * Sets the Description for the dialog. <p>
106 * Has <b>OK</b> status if no error occurs <p>
108 public void _setDescription() {
110 oObj
.setDescription("XFolderPicker") ;
111 //to visually check if the method works
113 tRes
.tested("setDescription()", true) ;