1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
3<script:module xmlns:script="http://openoffice.org/2000/script" script:name="ui_dialogs_XFilePicker" script:language="StarBasic">
4
5
6'*************************************************************************
7'
8' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9'
10' Copyright 2000, 2010 Oracle and/or its affiliates.
11'
12' OpenOffice.org - a multi-platform office productivity suite
13'
14' This file is part of OpenOffice.org.
15'
16' OpenOffice.org is free software: you can redistribute it and/or modify
17' it under the terms of the GNU Lesser General Public License version 3
18' only, as published by the Free Software Foundation.
19'
20' OpenOffice.org is distributed in the hope that it will be useful,
21' but WITHOUT ANY WARRANTY; without even the implied warranty of
22' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23' GNU Lesser General Public License version 3 for more details
24' (a copy is included in the LICENSE file that accompanied this code).
25'
26' You should have received a copy of the GNU Lesser General Public License
27' version 3 along with OpenOffice.org.  If not, see
28' <http://www.openoffice.org/license.html>
29' for a copy of the LGPLv3 License.
30'
31'*************************************************************************
32*****
33'*************************************************************************
34
35
36
37' Be sure that all variables are dimensioned:
38option explicit
39
40
41
42Sub RunTest()
43
44'*************************************************************************
45' INTERFACE:
46' com.sun.star.ui.dialogs.XFilePicker
47'*************************************************************************
48On Error Goto ErrHndl
49    Dim bOK As Boolean
50    Dim fileName As String, getDir As String
51    Dim getFiles As Variant, tempURL As String
52
53    tempURL = utils.Path2URL(cTestDocsDir)
54
55    Test.StartMethod("setMultiSelectionMode()")
56    bOK = true
57    oObj.setMultiSelectionMode(true)
58    oObj.setMultiSelectionMode(false)
59    Test.MethodTested("setMultiSelectionMode()", bOK)
60
61    Test.StartMethod("setDisplayDirectory()")
62    Out.Log("Trying to set dir : '" + tempURL + "'")
63    oObj.setDisplayDirectory(tempURL)
64
65    Test.StartMethod("getDisplayDirectory()")
66    bOK = true
67    getDir = oObj.getDisplayDirectory()
68    Out.Log("Returned directory : '" + getDir + "'")
69    bOK = bOK AND (getDir = tempURL)
70    Test.MethodTested("setDisplayDirectory()", bOK)
71    Test.MethodTested("getDisplayDirectory()", bOK)
72
73    Test.StartMethod("setDefaultName()")
74    bOK = true
75    fileName = "BasicBridge.sxw"
76    oObj.setDefaultName(fileName)
77    Test.MethodTested("setDefaultName()", bOK)
78
79    Test.StartMethod("getFiles()")
80    bOK = true
81    getFiles = oObj.getFiles()
82    Out.Log("Returned files count : " + ubound(getFiles()))
83    Out.Log("To have any files returned the FilePicker dialog must be executed, but this")
84    Out.Log("requires interactivity. Thus the fact that no files are selected is OK")
85    bOK = bOK AND (ubound(getFiles()) = -1)
86    Test.MethodTested("getFiles()", bOK)
87
88Exit Sub
89ErrHndl:
90    Test.Exception()
91    bOK = false
92    resume next
93End Sub
94</script:module>
95