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: identifiers.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-16 10:03:21 $
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 : Use unique identifiers instead of filenames for extensions
38 '\******************************************************************************
40 testcase tExtensionIdentifiers()
42 printlog( "Extension identifiers / reinstallation of extensions" )
44 if ( gBuild <= 9183 ) then
45 printlog( "Build does not support extension identifiers" )
50 dim cExtensionPath( 2 ) as string
51 dim cCommonPath as string
52 dim cExtensionCount( 3 ) as integer
53 const EXTENSION_NAME = "identifier.oxt"
54 dim cExtensionFlags as string
57 ' paths to the extensions - the have identical names but different identifiers
58 cCommonPath = gTesttoolPath & "extensions\optional\input\identifier\"
59 cExtensionPath( 1 ) = convertpath( cCommonPath & "legacy\" & EXTENSION_NAME )
60 cExtensionPath( 2 ) = convertpath( cCommonPath & "explicit\" & EXTENSION_NAME )
61 cExtensionCount( 0 ) = hGetExtensionCount()
63 ' Install first extension
64 cExtensionFlags = "InstallForUser"
65 cExtensionCount( 1 ) = hExtensionAddGUI( cExtensionPath( 1 ), cExtensionFlags )
66 if ( cExtensionCount( 1 ) = cExtensionCount( 0 ) + 1 ) then
67 printlog( "Extension 1 was installed" )
69 warnlog( "Incorrect extension count: " & cExtensionCount( 1 ) )
72 ' Install second extension
73 cExtensionFlags = "InstallForUser"
74 cExtensionCount( 2 ) = hExtensionAddGUI( cExtensionPath( 2 ), cExtensionFlags )
75 if ( cExtensionCount( 2 ) = cExtensionCount( 1 ) + 1 ) then
76 printlog( "Extension 2 was installed" )
78 warnlog( "Incorrect extension count: " & cExtensionCount( 2 ) )
81 ' Install first extension again
82 cExtensionFlags = "InstallForUser,AllowUpdate"
83 cExtensionCount( 3 ) = hExtensionAddGUI( cExtensionPath( 1 ), cExtensionFlags )
84 if ( cExtensionCount( 3 ) = cExtensionCount( 2 ) ) then
85 printlog( "Extension 1 was installed, overwriting existing" )
89 ' Install second extension again
90 cExtensionFlags = "InstallForUser,AllowUpdate"
91 cExtensionCount( 3 ) = hExtensionAddGUI( cExtensionPath( 2 ), cExtensionFlags )
92 if ( cExtensionCount( 3 ) = cExtensionCount( 2 ) ) then
93 printlog( "Extension 2 was installed, overwriting existing" )
96 hExtensionRemoveGUI( EXTENSION_NAME )
97 hExtensionRemoveGUI( EXTENSION_NAME )
99 ' Install first extension
100 cExtensionFlags = "InstallForUser"
101 cExtensionCount( 1 ) = hExtensionAddGUI( cExtensionPath( 1 ), cExtensionFlags )
102 if ( cExtensionCount( 1 ) = cExtensionCount( 0 ) + 1 ) then
103 printlog( "Extension 1 was installed again" )
105 warnlog( "Extension 1 was not installed" )
108 ' Install second extension
109 cExtensionFlags = "InstallForUser"
110 cExtensionCount( 2 ) = hExtensionAddGUI( cExtensionPath( 2 ), cExtensionFlags )
111 if ( cExtensionCount( 2 ) = cExtensionCount( 1 ) + 1 ) then
112 printlog( "Extension 2 was installed again" )
114 warnlog( "Extension 2 was not installed" )
117 hExtensionRemoveGUI( EXTENSION_NAME )
118 hExtensionRemoveGUI( EXTENSION_NAME )
120 if ( hGetExtensionCount() <> cExtensionCount( 0 ) ) then
121 warnlog( "For some reason we have an unexpected number of extensions listed" )
123 printlog( "Extensions were handled correctly" )