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 : Test protected libraries
32 '\******************************************************************************
34 testcase tProtectedLibraries
37 const CLIB = "aaTestLib"
38 const CPASSWORD = "SomePassword"
42 dim cPBAFile as string
43 cPBAFile = gOfficePath & "user\basic\" & CLIB & "\Module1.pba"
44 cPBAFile = convertpath( cPBAFile )
47 dim iCurrentLib as integer
52 printlog( "Select My Macros" )
54 hSelectNode( MakroAus , 1 )
56 printlog( "Organize..." )
59 hSelectBasicObjectOrganizerTab( 3 )
62 kontext "TabBibliotheken"
65 printlog( "Name the Library" )
66 kontext "NeueBibliothek"
67 BibliotheksName.setText( CLIB )
70 printlog( "Select the new library" )
71 kontext "TabBibliotheken"
72 for iCurrentLib = 1 to Bibliotheksliste.getItemCount()
73 Bibliotheksliste.select( iCurrentLib )
74 if ( Bibliotheksliste.getSelText = CLIB ) then
79 printlog( "Set Password" )
80 kontext "TabBibliotheken"
84 NewPassword.setText( CPASSWORD )
85 Confirm.setText( CPASSWORD )
88 printlog( "Edit the library" )
89 kontext "TabBibliotheken"
93 hInsertMacro( IMACRO )
97 printlog( "Restart the application" )
98 call ExitRestartTheOffice()
102 printlog( "Select the protected library" )
104 hSelectNode( MakroAus , 1 )
105 hExpandNode( MakroAus , 0 )
106 hSelectNode( MakroAus , 2 )
107 hExpandNode( MakroAus , 0 )
109 printlog( "Enter correct Password" )
110 kontext "PasswordDLG"
111 Password.setText( CPASSWORD )
114 ' Handle possible errormessage (Happens if password is correct but not accepted)
116 if ( Active.exists() ) then
117 cMsg = Active.getText()
118 cMsg = hRemoveLineBreaks( cMsg )
119 printlog( "Unexpected messagebox: " & cMsg )
120 warnlog( "#i65955# - CWS Warnings01: Protected libraries do not accept valid password" )
124 hDeleteLibrary( 1 , CLIB )
129 hSelectNode( MakroAus , 3 )
131 printlog( "Edit Library" )
133 ' warnlog( "#144701 Crash on edit of password protected module" )
135 printlog( "Check that the Macro is the correct one" )
137 if ( BasicIDE.exists( 3 ) ) then
139 irc = htestMacro( IMACRO )
140 if ( irc <> IMACRO ) then
141 warnlog( "#i54305 - Changes to protected macros lost on office restart" )
143 iPBAFile = hGetFileSizeAsLong( cPBAFile )
144 if ( iPBAFile = 0 ) then
145 warnlog( "#i50568 - .pba-file has 0-byte size" )
147 printlog( "Module1.pba has " & iPBAFile & " Bytes" )
152 printlog( "Cleanup" )
155 warnlog( "BasicIDE did not open within 3 seconds" )
157 hDeleteLibrary( 1 , CLIB )