Avoid potential negative array index access to cached text.
[LibreOffice.git] / qadevOOo / tests / java / ifc / ui / dialogs / _XFolderPicker.java
blob07c6e014f4254811c74ebae0bc00ca819870181e
1 /*
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;
23 import com.sun.star.ui.dialogs.XFolderPicker;
25 /**
26 * Testing <code>com.sun.star.ui.XFolderPicker</code>
27 * interface methods :
28 * <ul>
29 * <li><code> setDisplayDirectory()</code></li>
30 * <li><code> getDisplayDirectory()</code></li>
31 * </ul> <p>
32 * Test is <b> NOT </b> multithread compliant. <p>
33 * @see com.sun.star.ui.XFolderPicker
35 public class _XFolderPicker extends MultiMethodTest {
37 public XFolderPicker oObj = null;
38 private String dir = null ;
40 /**
41 * Sets the current directory to SOffice temp dir. <p>
42 * Has <b>OK</b> status if no exceptions occurred.
44 public void _setDisplayDirectory() {
45 boolean result = true ;
46 dir = util.utils.getOfficeTemp(tParam.getMSF()) ;
48 log.println("Trying to set dir '" + dir + "'") ;
49 try {
50 oObj.setDisplayDirectory(dir) ;
51 } catch (com.sun.star.lang.IllegalArgumentException e) {
52 log.println("Directory '" + dir + "' not found :" + e) ;
53 result = false ;
56 tRes.tested("setDisplayDirectory()", result) ;
59 /**
60 * Gets the current directory. <p>
61 * Has <b>OK</b> status if get value is equal to set value
62 * passed to <code>setDisplayDirectory</code> <p>
63 * The following method tests are to be completed successfully before :
64 * <ul>
65 * <li> <code> setDisplayDirectory </code> </li>
66 * </ul>
68 public void _getDisplayDirectory() {
69 requiredMethod("setDisplayDirectory()") ;
71 String gDir = oObj.getDisplayDirectory() ;
73 log.println("Get dir '" + gDir + "'") ;
75 tRes.tested("getDisplayDirectory()", dir.equals(gDir)) ;
78 /**
79 * Gets the directory chosen by the user. <p>
80 * Has <b>OK</b> status if get value is not NULL <p>
82 public void _getDirectory() {
84 String gDir = oObj.getDirectory() ;
86 log.println("Get dir '" + gDir + "'") ;
88 tRes.tested("getDirectory()", gDir != null) ;
91 /**
92 * Sets the Description for the dialog. <p>
93 * Has <b>OK</b> status if no error occurs <p>
95 public void _setDescription() {
97 oObj.setDescription("XFolderPicker") ;
98 //to visually check if the method works
99 //oObj.execute();
100 tRes.tested("setDescription()", true) ;