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 2008 by Sun Microsystems, Inc.
7 '* OpenOffice.org - a multi-platform office productivity suite
9 '* $RCSfile: filedlg_folders6.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-16 12:18:14 $
15 '* This file is part of OpenOffice.org.
17 '* OpenOffice.org is free software: you can redistribute it and/or modify
18 '* it under the terms of the GNU Lesser General Public License version 3
19 '* only, as published by the Free Software Foundation.
21 '* OpenOffice.org is distributed in the hope that it will be useful,
22 '* but WITHOUT ANY WARRANTY; without even the implied warranty of
23 '* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 '* GNU Lesser General Public License version 3 for more details
25 '* (a copy is included in the LICENSE file that accompanied this code).
27 '* You should have received a copy of the GNU Lesser General Public License
28 '* version 3 along with OpenOffice.org. If not, see
29 '* <http://www.openoffice.org/license.html>
30 '* for a copy of the LGPLv3 License.
32 '/************************************************************************
34 '* owner : joerg.skottke@sun.com
36 '* short description : check the internal file dialog
38 '\*****************************************************************************
42 '///<h1>Jump to the filesystem root using pathseparator</h1>
43 '///+<i>Note that his is performed four times due to a bug that existed in
45 '///+Windows and Unix interpret the pathseparator differently so this test
46 '///+ provides handling of all four combinations (win + /, win + \, unx + /
47 '///+ and unx + \)</i><br>
50 ' We always want to start in a fixed directory structure so the first few dirnames are
51 ' known an can be used for verification
52 dim cStartDir as string
53 cStartDir = gTesttoolPath & "framework\optional\input\filetest\level1\level2\level3"
54 cStartDir = convertpath( cStartDir )
55 printlog( "Start-Directory is: " & cStartDir )
57 ' Find out how many items the array for pathnames must hold (do not use gTesttoolPath here)
58 dim iDirLevels as integer
59 iDirLevels = hGetDirTreeLevel( cStartDir ) + 2
61 ' Get the list of directories within the path
62 dim cPathArray( iDirLevels ) as string
63 iDirLevels = DirNameList( cStartDir , cPathArray() )
65 ' Create an array for the two pathseparators - Windows and Unix/Linux
66 dim cPathSeparator( 2 ) as string
67 cPathSeparator( 1 ) = "\"
68 cPathSeparator( 2 ) = "/"
70 ' Some increment variables
71 dim iPathSeparator as integer
72 dim iPathRepeat as integer
74 ' Variables needed to verify that we are a filesystem root
75 dim iFileOpenItemCount as integer
76 dim cCurrentPath as string
77 dim iObjectPosition as integer
79 ' Needed for bug (see below)
80 const REPEAT_COUNT = 4
82 '///+<li>Open the FileOpen dialog</li>
85 '///+<li>Change to the start-directory: ..framework\optional\input\filetest\level1\level2\level3</li>
87 DateiName.setText( cStartDir )
90 '///+<li>For both pathseparators (/ and \) do:</li>
92 for iPathSeparator = 1 to 2
95 printlog( "Trying: " & cPathSeparator( iPathSeparator ) )
97 '///<li>Repeat this four times (ancient bug, possible crash)</li>
99 printlog( "Note: This is repeated four times due to ancient bug" )
100 for iPathRepeat = 1 to REPEAT_COUNT
102 '///+<li>Enter the pathseparator into the filename field</li>
103 Dateiname.setText( cPathSeparator( iPathSeparator ) )
105 '///+<li>Click "open"</li>
108 select case iPathSeparator
111 ' This is Unix, Linux
112 if ( gPlatGroup = "unx" ) then
114 '///+<li>Handle the messagebox (Unix only)</li>
116 if ( active.exists() ) then
118 printlog( "Messagebox for Unix and \ present." )
120 warnlog( "Error missing for invalid pathspec." )
123 '///+<li>- Verify that the directory has not changed for Unix</li>
124 ' in the ../level3-directory we look for the file filetest.txt
126 cCurrentPath = hGetFirstNameFromFileList()
127 if ( cCurrentPath <> "filetest.txt" ) then
128 warnlog( "Path should not have changed." )
130 printlog( "Still in same directory, ok." )
133 else ' Windows, eComStation
135 '///+<li>- Verify that we are a the virtual root (drives list) on windows</li>
137 cCurrentPath = hGetFirstNameFromFileList()
138 if ( cCurrentPath <> "a:\" ) then
139 if ( iPathRepeat = 1 ) then
140 qaerrorlog( "Did not reach virtual root or no drive a:\ present" )
142 warnlog( "Did not reach virtual root or no drive a:\ present" )
145 printlog( "Switched to virtual root: a:\ - drive. ok" )
153 if ( gPlatGroup = "unx" ) then
155 '///+<li>- Verify that we are at top level of the drive</li>
156 ' Note: cPathArray( 1 ) = / so we need second element
157 ' Additionally we have a trailing slash that must be killed
158 cCurrentPath = left( cPathArray( 2 ) , len( cPathArray( 2 ) ) - 1 )
160 iObjectPosition = hFindFileObjectViaFileOpen( cCurrentPath )
161 if ( iObjectPosition <> 0 ) then
162 printlog( "Root for gTesttoolPath could be found. Good" )
164 warnlog( "Top directory of gTesttoolPath could not be found" )
165 printlog( "This probably means we are not at the root dir" )
168 else ' Windows, eComStation
170 '///+<li>- Verify that we are a the virtual root (drives list) on windows</li>
172 cCurrentPath = hGetFirstNameFromFileList()
173 if ( cCurrentPath <> "a:\" ) then
174 warnlog( "Did not reach virtual root or no drive a:\ present" )
176 printlog( "Switched to virtual root: a:\ - drive. ok" )
191 '///+<li>Cancel the FileOpen dialog</li>