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: security_recommend_password.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-16 12:18:15 $
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 : Password settings in Tools/Options
38 '\******************************************************************************
40 testcase tRecommendPassword( filetypeID as string )
42 '///<H1>Recommend password protection when saving</H1>
43 '///<p>This test verifies that the global option to recommend password
44 '/// protection is transported to the file-save dialog. Before saving
45 '/// password protection will be unchecked in order to verify that the
46 '/// global option overrides the individual setting.</p>
48 dim workfile as string
49 workfile = "password" & hGetSuffix( filetypeID )
50 printlog( " * Name of workfile: " & workfile )
52 dim workpath as string
53 workpath = convertpath( gOfficePath & "user\work\" )
54 printlog( " * Save file to....: " & workpath )
59 '///<li>Open a new document</li>
60 printlog( "Open a new document" )
63 '///<li>change the content (document modified status)</li>
64 printlog( "Change the document" )
67 '///<li>Open File-Save-dialog</li>
68 printlog( "Open filesave" )
70 kontext "SpeichernDlg"
71 if ( SpeichernDlg.exists( 2 ) ) then
72 printlog( "File Open dialog is open. Good" )
74 warnlog( "File Open dialog is not open." )
78 '///<li>Verify that 'Save with password' is enabled</li>
79 printlog( "Verify that the password-checkbox is enabled" )
80 if ( passwort.isenabled() ) then
81 printlog( " * Password checkbox is enabled. Good." )
83 if ( passwort.ischecked() ) then
84 printlog( " * Password checkbox is checked. Good." )
87 warnlog( "Password checkbox is not checked, the option " & _
88 "has not been transported from tools/options " & _
89 "to the dialog -> bug" )
93 warnlog( "#i36663# Password checkbox is disabled" )
99 if AutomatischeDateinamenserweiterung.Exists then
100 QAErrorLog "OBSOLETE: Check-box Automatic file extension in file dialog will be removed soon!"
101 AutomatischeDateinamenserweiterung.Uncheck
105 '///<li>name the file and select filter</li>
106 printlog( "Name the file" )
107 Dateiname.settext( workpath & workfile )
109 '///<li>uncheck password-protection</li>
110 printlog( "Uncheck password-protection" )
113 '///<li>save the file</li>
114 printlog( "Save the file" )
117 '///<li>handle possoble overwrite-warning</li>
119 if ( active.exists( 2 ) ) then
120 printlog( " - handle overwrite warning (if any)" )
124 '///<li>handle unexpected password-dialog</li>
125 Kontext "passwordDlg"
126 if ( passwordDlg.exists( 2 ) ) then
127 warnlog( "Password dialog comes up, this is not expected at this " & _
128 "point. Trying to handle the error gracefully" )
129 Password.settext( workfile )
130 PasswordConfirm.settext( workfile )
133 printlog( " * No password dialog is displayed. Good." )
136 '///<li>Delete the workfile</li>
137 hDeleteFile( workpath & workfile )
141 '///<li>close the document</li>
142 printlog( "Close the current document" )
143 call hCloseDocument()