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_folders7.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 ( 1. part )
38 '\*****************************************************************************
42 '///<h1>Check all context-menuentries of the "Level-Up" button</h1>
45 dim iCurrentItem as Integer ' increment variable
46 dim iCurrentItemCount as Integer ' actual number of entries in dropdown menu
49 ' The directory that we want to start in so we know how many steps we have
50 ' to the filesystem root (cStartDir is always good for at least 8 steps)
51 dim cStartDir as string
52 cStartDir = gTesttoolPath & "framework\optional\input\filetest\level1\level2\level3"
53 cStartDir = convertpath( cStartDir )
55 ' This is the threshold of the directory defined above. Usually we will have
56 ' 9 as the expected number of directories but depending on the mountpoint
57 ' of the testtool workdirectory the number may vary.
58 dim iExpectedItemCount as Integer
59 iExpectedItemCount = hGetDirTreeLevel( cStartDir )
61 ' Windows has one more level (Drives)
62 if ( gPlatGroup = "w95" ) then
63 iExpectedItemCount = iExpectedItemCount + 1
66 printlog( "Test context menu of the Level Up button on the FileOpen dialog" )
67 printlog( "Current threshold: " & iExpectedItemCount )
69 '///+<li>File open</li>
72 '///+<li>Walk down to the starting directory: <br>
73 '///+ framework\filedlg\input\filetest\level1\level2\level3</li>
75 Dateiname.SetText( cStartDir )
78 '///+<li>Open the context menu of the "Level Up" button</li>
79 UebergeordneterOrdner.Open()
81 '///+<li>Get the number of entries listed in the menu</li>
82 iCurrentItemCount = hMenuItemGetCount()
83 Printlog( "Current itemcount: " & iCurrentItemCount )
85 '///+<li>Verify that at least 9 items exist:</li>
87 '///+<li>Too few entries</li>
88 if ( iCurrentItemCount < iExpectedItemCount ) then
89 warnlog( "Items missing in the menu." )
90 printlog( "On Windows the node 'My Computer' might be missing" )
91 printlog( "On UNIX filesystem root might be missing" )
94 '///+<li>Correct number of entries</li>
95 if ( iCurrentItemCount = iExpectedItemCount ) then
96 printlog( "The number of entries in the context menu is correct" )
99 '///+<li>Too many entries</li>
100 if ( iCurrentItemCount > iExpectedItemCount ) then
101 warnlog( "Found more menu-items than expected: " & iCurrentItemCount)
105 '///+<li>Trigger the first entry, for each entry the menu list gets one shorter
106 '///+ as we walk up in the filesystem hierarchy.<br>
107 '///+ Note that the context menu is open at this point</li>
109 for iCurrentItem = 1 to iCurrentItemCount - 1
111 '///+<li>Find out how many items should be in the context menu (minus one per loop)</li>
112 iExpectedItemCount = iCurrentItemCount - iCurrentItem
114 '///+<li>Select the first item (it is dynamic)</li>
117 '///+<li>Open the context menu again</li>
119 UebergeordneterOrdner.Open()
121 '///+<li>Verify the number of items</li>
123 '///+<li>Too few items</li>
124 if ( hMenuItemGetCount < iExpectedItemCount ) then
125 printlog( "The number of entries is correct" )
128 '///+<li>Too many items</li>
129 if ( hMenuItemGetCount > iExpectedItemCount ) then
130 printlog( "The number of entries is correct" )
137 '///+<li>Select the first item from the context menu again (still open)</li>
140 '///+<li>Verify that we now have 8 items in the context menu</li>
141 if ( iCurrentItemCount = 8 ) then
143 '///+<li>Click the "Level Up" button</li>
145 UebergeordneterOrdner.Click()
149 '///+<li>Now we should be at filesystem root. Verify that "Level Up" is disabled</li>
151 if ( UebergeordneterOrdner.isEnabled() ) then
152 warnlog( "Level-Up is enabled, it should be disabled at filesystem root" )
155 printlog( "Good, button is disabled" )
158 '///+<li>Close FileOpen dialog</li>