1 'encoding UTF-8 Do not remove or change this line!
2 '**************************************************************************
3 ' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 ' Copyright 2000, 2010 Oracle and/or its affiliates.
7 ' OpenOffice.org - a multi-platform office productivity suite
9 ' This file is part of OpenOffice.org.
11 ' OpenOffice.org is free software: you can redistribute it and/or modify
12 ' it under the terms of the GNU Lesser General Public License version 3
13 ' only, as published by the Free Software Foundation.
15 ' OpenOffice.org is distributed in the hope that it will be useful,
16 ' but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ' GNU Lesser General Public License version 3 for more details
19 ' (a copy is included in the LICENSE file that accompanied this code).
21 ' You should have received a copy of the GNU Lesser General Public License
22 ' version 3 along with OpenOffice.org. If not, see
23 ' <http://www.openoffice.org/license.html>
24 ' for a copy of the LGPLv3 License.
26 '/************************************************************************
28 '* owner : gregor.hartmann@oracle.com
30 '* short description : check the internal file dialog
32 '\*****************************************************************************
37 ' We always want to start in a fixed directory structure so the first few dirnames are
38 ' known an can be used for verification
39 dim cStartDir as string
40 cStartDir = gTesttoolPath & "framework\optional\input\filetest\level1\level2\level3"
41 cStartDir = convertpath( cStartDir )
42 printlog( "Start-Directory is: " & cStartDir )
44 ' Find out how many items the array for pathnames must hold (do not use gTesttoolPath here)
45 dim iDirLevels as integer
46 iDirLevels = hGetDirTreeLevel( cStartDir ) + 2
48 ' Get the list of directories within the path
49 dim cPathArray( iDirLevels ) as string
50 iDirLevels = DirNameList( cStartDir , cPathArray() )
52 ' Create an array for the two pathseparators - Windows and Unix/Linux
53 dim cPathSeparator( 2 ) as string
54 cPathSeparator( 1 ) = "\"
55 cPathSeparator( 2 ) = "/"
57 ' Some increment variables
58 dim iPathSeparator as integer
59 dim iPathRepeat as integer
61 ' Variables needed to verify that we are a filesystem root
62 dim iFileOpenItemCount as integer
63 dim cCurrentPath as string
64 dim iObjectPosition as integer
66 ' Needed for bug (see below)
67 const REPEAT_COUNT = 4
72 DateiName.setText( cStartDir )
75 for iPathSeparator = 1 to 2
78 printlog( "Trying: " & cPathSeparator( iPathSeparator ) )
80 printlog( "Note: This is repeated four times due to ancient bug" )
81 for iPathRepeat = 1 to REPEAT_COUNT
83 Dateiname.setText( cPathSeparator( iPathSeparator ) )
87 select case iPathSeparator
91 if ( gPlatGroup = "unx" ) then
94 if ( active.exists() ) then
96 printlog( "Messagebox for Unix and \ present." )
98 warnlog( "Error missing for invalid pathspec." )
101 ' in the ../level3-directory we look for the file filetest.txt
103 cCurrentPath = hGetFirstNameFromFileList()
104 if ( cCurrentPath <> "filetest.txt" ) then
105 warnlog( "Path should not have changed." )
107 printlog( "Still in same directory, ok." )
110 else ' Windows, eComStation
113 cCurrentPath = hGetFirstNameFromFileList()
114 if ( cCurrentPath <> "a:\" ) then
115 if ( iPathRepeat = 1 ) then
116 qaerrorlog( "Did not reach virtual root or no drive a:\ present" )
118 warnlog( "Did not reach virtual root or no drive a:\ present" )
121 printlog( "Switched to virtual root: a:\ - drive. ok" )
129 if ( gPlatGroup = "unx" ) then
131 ' Note: cPathArray( 1 ) = / so we need second element
132 ' Additionally we have a trailing slash that must be killed
133 cCurrentPath = left( cPathArray( 2 ) , len( cPathArray( 2 ) ) - 1 )
135 iObjectPosition = hFindFileObjectViaFileOpen( cCurrentPath )
136 if ( iObjectPosition <> 0 ) then
137 printlog( "Root for gTesttoolPath could be found. Good" )
139 warnlog( "Top directory of gTesttoolPath could not be found" )
140 printlog( "This probably means we are not at the root dir" )
143 else ' Windows, eComStation
146 cCurrentPath = hGetFirstNameFromFileList()
147 if ( cCurrentPath <> "a:\" ) then
148 warnlog( "Did not reach virtual root or no drive a:\ present" )
150 printlog( "Switched to virtual root: a:\ - drive. ok" )