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: basic_protected_libraries.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-16 12:18:13 $
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 : Test protected libraries
38 '\******************************************************************************
40 testcase tProtectedLibraries
42 '///<H1>Test protected libraries</H1>
45 const CLIB = "aaTestLib"
46 const CPASSWORD = "SomePassword"
50 dim cPBAFile as string
51 cPBAFile = gOfficePath & "user\basic\" & CLIB & "\Module1.pba"
52 cPBAFile = convertpath( cPBAFile )
55 dim iCurrentLib as integer
58 '///+<li>Open the Basic Organizer</li>
59 hOpenBasicOrganizerFromDoc()
61 '///+<li>Ensure the node "My Macros" is selected</li>
62 printlog( "Select My Macros" )
64 hSelectNode( MakroAus , 1 )
66 '///+<li>Click "Organizer..."</li>
67 printlog( "Organize..." )
70 '///+<li>Select the libraries tab</li>
71 hSelectBasicObjectOrganizerTab( 3 )
73 '///+<li>Click "New..."</li>
75 kontext "TabBibliotheken"
78 '///+<li>Name the libraray, click "OK"</li>
79 printlog( "Name the Library" )
80 kontext "NeueBibliothek"
81 BibliotheksName.setText( CLIB )
84 '///+<li>Find the new library, select it</li>
85 printlog( "Select the new library" )
86 kontext "TabBibliotheken"
87 for iCurrentLib = 1 to Bibliotheksliste.getItemCount()
88 Bibliotheksliste.select( iCurrentLib )
89 if ( Bibliotheksliste.getSelText = CLIB ) then
94 '///+<li>Click "Password..."</li>
95 printlog( "Set Password" )
96 kontext "TabBibliotheken"
99 '///+<li>Give a password, confirm with "OK"</li>
101 NewPassword.setText( CPASSWORD )
102 Confirm.setText( CPASSWORD )
105 '///+<li>Edit the protected library</li>
106 printlog( "Edit the library" )
107 kontext "TabBibliotheken"
110 '///+<li>Modify the macro</li>
112 hInsertMacro( IMACRO )
114 '///+<li>Close the Basic-IDE</li>
117 '///+<li>Exit and restart the office</li>
118 printlog( "Restart the application" )
119 call ExitRestartTheOffice()
121 '///+<li>Open the Basic Organizer</li>
122 hOpenBasicOrganizerFromDoc()
124 '///+<li>Find the protected library</li>
125 printlog( "Select the protected library" )
127 hSelectNode( MakroAus , 1 )
128 hExpandNode( MakroAus , 0 )
129 hSelectNode( MakroAus , 2 )
130 hExpandNode( MakroAus , 0 )
132 '///+<li>Enter the correct Password, click "OK"</li>
133 printlog( "Enter correct Password" )
134 kontext "PasswordDLG"
135 Password.setText( CPASSWORD )
138 ' Handle possible errormessage (Happens if password is correct but not accepted)
140 if ( Active.exists() ) then
141 cMsg = Active.getText()
142 cMsg = hRemoveLineBreaks( cMsg )
143 printlog( "Unexpected messagebox: " & cMsg )
144 warnlog( "#i65955# - CWS Warnings01: Protected libraries do not accept valid password" )
148 hDeleteLibrary( 1 , CLIB )
152 '///+<li>Expand the library, select the Module</li>
154 hSelectNode( MakroAus , 3 )
156 '///+<li>Open the Basic-IDE by clicking on "Edit"</li>
157 printlog( "Edit Library" )
159 ' warnlog( "#144701 Crash on edit of password protected module" )
161 '///+<li>Verify that the correct macro is displayed</li>
162 printlog( "Check that the Macro is the correct one" )
164 if ( BasicIDE.exists( 3 ) ) then
166 irc = htestMacro( IMACRO )
167 if ( irc <> IMACRO ) then
168 warnlog( "#i54305 - Changes to protected macros lost on office restart" )
170 iPBAFile = hGetFileSizeAsLong( cPBAFile )
171 if ( iPBAFile = 0 ) then
172 warnlog( "#i50568 - .pba-file has 0-byte size" )
174 printlog( "Module1.pba has " & iPBAFile & " Bytes" )
179 printlog( "Cleanup" )
182 warnlog( "BasicIDE did not open within 3 seconds" )
184 hDeleteLibrary( 1 , CLIB )