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: e_update.inc,v $
11 '* $Revision: 1.1.2.3 $
13 '* last change: $Author: jsk $ $Date: 2008/10/08 09:05:51 $
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 : Extension Update Test
38 '\******************************************************************************
40 testcase tExtensionManagerResources()
42 ' Test is based on issue #i86913 and the common rules for update tests (QA)
44 ' We need to know if the user may change extension parameters. This is the case
45 ' when a) the user is root/Administrator or b) the office was installed
46 ' for the current user only
48 dim bUserIsAdmin as boolean : bUserIsAdmin = hCheckForAdministratorPermissions()
49 dim iBreakCounter as integer : iBreakCounter = 0
50 dim iFilterItems as integer
52 const MAX_ITERATIONS = 50
53 const FILTER_ITEMS = 9 ' This is the number of filters/extension types we know
55 printlog( "Ressource test for the Extension Manager UI" )
58 kontext "PackageManager"
59 if ( PackageManager.exists( 1 ) ) then
61 ' OOo comes with a few preinstalled, shared - extensions. We need at least one.
62 ' This test is bound to fail if we have a user-installed extension at the
63 ' first position of the Extension Manager UI list. There is no way we can
64 ' check that for now. However, this is hardly ever the case.
66 if ( BrowsePackages.getItemCount() = 0 ) then
67 warnlog( "This test requires at least one extension to be installed." )
68 printlog( "Some of the controls are not available or disabled." )
72 call dialogtest( PackageManager )
74 kontext "PackgeManager"
79 if ( OeffnenDlg.exists( 1 ) ) then
80 iFilterItems = DateiTyp.getItemCount
81 if ( iFilterItems <> FILTER_ITEMS ) then
82 warnlog( "The file type filter list is incorrect" )
83 printlog( "Expected: " & FILTER_ITEMS )
84 printlog( "Found...: " & iFilterItems )
86 printlog( "The number of filters in Add Extensions Dialog is ok" )
90 warnlog( "File Open dialog did not open" )
93 kontext "PackageManager"
94 printlog( "Check for updates..." )
97 kontext "ExtensionUpdate"
98 if ( ExtensionUpdate.exists( 2 ) ) then
99 call dialogtest( ExtensionUpdate )
100 ExtensionUpdate.cancel()
101 ExtensionUpdate.notExists( 3 )
103 warnlog( "Extenson Update dialog did not open" )
106 kontext "PackageManager"
107 printlog( "Controls belonging to extensions" )
109 BrowsePackages.select( 1 )
110 printlog( "Extension name.......: " & BrowsePackages.getItemText( 1 , 1 ) )
111 printlog( "Extension version....: " & BrowsePackages.getItemText( 1 , 2 ) )
112 printlog( "Extension description: " & BrowsePackages.getItemText( 1 , 3 ) )
114 if ( options.exists() ) then
115 if ( options.isEnabled() ) then
116 printlog( "Extension has options" )
119 kontext "OptionenDlg"
123 warnlog( "Extension Options button visible but disabled" )
126 printlog( "Extension Options button does not exist, no options available" )
129 if ( bUserIsAdmin ) then
131 ' If the user is Admin or the office was installed in the users
132 ' home directory we have access to the extensions that reside in
133 ' the shared layer. This means that the user can remove and disable
136 kontext "PackageManager"
137 BrowsePackages.select( 1 )
138 if ( disable.exists() ) then
139 if ( disable.isEnabled() ) then
144 if ( Active.exists( 1 ) ) then
145 printlog( "Disable extension: Warning for other office instance. Good." )
148 warnlog( "No warning for other office instances running" )
151 ' We now re-enable the extensions. Depending on the "size"
152 ' of the extension it might take the Extension Manager UI
153 ' a few seconds to complete the "disable" action. We need to
155 kontext "PackageManager"
156 BrowsePackages.select( 1 )
158 do while( not enable.exists() )
159 iBreakCounter = iBreakCounter + 1
161 if ( iBreakCounter = MAX_ITERATIONS ) then
162 warnlog( "Extension not ready within timeframe. Aborting" )
169 if ( Active.exists( 1 ) ) then
170 printlog( "Enable extension: Warning for other office instance. Good." )
173 warnlog( "No warning for other office instances running" )
176 ' The Extension Manager UI remembers when it has warned about
177 ' other running instances of the office, so the next time we try
178 ' to disable/enable the extension there should be no warning.
180 kontext "PackageManager"
182 do while( not disable.exists() )
183 iBreakCounter = iBreakCounter + 1
185 if ( iBreakCounter = MAX_ITERATIONS ) then
186 warnlog( "Extension not ready within timeframe. Aborting" )
193 if ( Active.exists( 1 ) ) then
194 warnlog( "There should be no warning when disabling the extension a second time" )
197 printlog( "Disable extension: No warning for other office instances. Good." )
200 kontext "PackageManager"
202 do while( not enable.exists() )
203 iBreakCounter = iBreakCounter + 1
205 if ( iBreakCounter = MAX_ITERATIONS ) then
206 warnlog( "Extension not ready within timeframe. Aborting" )
213 if ( Active.exists( 1 ) ) then
214 warnlog( "There should be no warning when enabling the extension a second time" )
217 printlog( "Enable extension: No warning for other office instances. Good." )
222 warnlog( "User should be able to disable shared extension" )
225 warnlog( "Cannot disable extension. It might be disabled already or defunct" )
228 kontext "PackageManager"
230 do while( not remove.isEnabled() )
231 iBreakCounter = iBreakCounter + 1
233 if ( iBreakCounter = MAX_ITERATIONS ) then
234 warnlog( "Extension not ready within timeframe. Aborting" )
239 kontext "PackageManager"
240 if ( remove.isEnabled() ) then
244 ' Note: First time we try to remove an extension we should get a
245 ' warning that we must make sure that no other office instances
246 ' are running. If this warning is missing we actually remove the
247 ' extension which leaves the installation in an inconsistent
248 ' state. In a "real life" installation this would not work, in a
249 ' "user space" installation we have to reinstall. Bad that is.
252 if ( Active.exists( 1 ) ) then
253 printlog( "Remove extension: Warning for other office instances. Good." )
256 warnlog( "No warning for other office instances running" )
257 warnlog( "Installation inconsistency: Extension was removed!" )
261 ' Note: Like for the disable/enable buttons we should not get
262 ' a warning for another running office instance when removing
263 ' an extension for the second time.
266 warnlog( "User should be able to remove extension" )
270 ' if the user does not have Administrator rights he may neither
271 ' he may neither disable or remove extensions.
273 kontext "PackageManager"
274 if ( disable.isEnabled() ) then
275 warnlog( "Disable-button enabled for shared extension" )
278 kontext "PackageManager"
279 if ( remove.isEnabled() ) then
280 warnlog( "Remove-button enabled for shared extension" )
284 kontext "PackageManager"
285 PackageManager.close()
288 warnlog( "Extension Manager UI did not open" )