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: filedlg_passwords.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-16 12:18:14 $
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 : save and load passworded files
38 '\******************************************************************************
40 testcase tFiledlgPasswords()
42 '///<h1>Test saving/loading passworded files in three different formats</h1>
44 dim workfile as string
45 dim workpath as string
46 workpath = hGetWorkPath()
48 dim filetype as string
49 dim filetypeID as string
52 dim iCurrentDocumentType as integer
53 dim iCurrentFileFormat as integer
56 for iCurrentDocumentType = 1 to 6
58 printlog( "Document Type: " & hNumericDocType( iCurrentDocumentType ) )
60 for iCurrentFileFormat = 1 to 2
62 select case iCurrentFileFormat
63 case 1 : filetypeID = "645"
64 case 2 : filetypeID = "current"
68 '///+<li>open a new document</li>
71 '///+<li>Close the navigator - if present</li>
74 '///+<li>enter some random text</li>
77 '///+<li>Open file-save dialog</li>
78 printlog( "Open file-save dialog" )
79 if ( gApplication = "IMPRESS" ) then
80 printlog( " IMPRESS is slower than other apps, delaying for 2 sec." )
86 Kontext "SpeichernDlg"
87 if ( SpeichernDlg.exists( 2 ) ) then
89 '///+<li>Name the file and select filter</li>
90 filetype = hGetFilter( filetypeID )
91 hSelectUIFilter( filetype )
93 workfile = "password" & hGetSuffix( filetypeID )
94 DateiName.setText( workpath & workfile )
96 printlog( "Using fileformat: " & filetype )
97 printlog( "Using filename..: " & workfile )
99 '///+<li>Check password</li>
100 printlog( "Check password" )
101 if ( passwort.isEnabled() ) then
104 warnlog( "#i36663# Password checkbox is disabled" )
107 '///+<li>Save the file</li>
108 printlog( "Save the file" )
112 if ( active.exists( 2 ) ) then
113 printlog( "Handle overwrite warning (if any)" )
118 '///+<li>Enter the filename as password and confirm</li>
119 Kontext "PasswordFileSave"
120 printlog( "Enter the name of the file as password and confirm" )
121 if ( passwordFileSave.exists() ) then
122 Password.settext( workfile )
123 PasswordConfirm.settext( workfile )
124 PasswordFileSave.ok()
126 warnlog( "No password dialog is displayed" )
129 kontext "AlienWarning"
130 if ( AlienWarning.exists( 2 ) ) then
131 if ( FileTypeID <> "current" ) then
132 printlog( "Handle alienwarning (expected)" )
135 warnlog( "Handle alienwarning (unexpected)" )
140 '///+<li>Close the document</li>
143 '///+<li>Open the file via file-open</li>
144 printlog( "Open the file via file-open" )
148 if ( OeffnenDlg.exists( 2 ) ) then
149 Dateiname.settext( workfile )
153 Kontext "PasswordFileOpen"
154 '///+<li>Enter the filename as password</li>
155 printlog( "Enter the filename as password" )
156 if ( PasswordFileOpen.exists( 4 ) ) then
157 PasswortName.settext( workfile )
158 PasswordFileOpen.ok()
161 if ( Active.exists( 2 ) ) then
162 cMsg = active.getText()
163 cMsg = hRemoveLineBreaks( cMsg )
165 warnlog( "#i65889# - CWS Warnings01: Cannot read password protected files" )
169 warnlog( "No password dialog is displayed" )
173 '///+<li>Verify that the document is loaded</li>
174 printlog( "Verify that the document is loaded" )
177 '///+<li>Close the navigator if present</li>
179 if ( Navigator.exists( 1 ) ) then
180 qaerrorlog( "Navigator should not be visible - setting not saved?" )
183 warnlog( "Second file open failed" )
186 warnlog( "File Open dislog did not come up" )
189 '///+<li>Close navigator if present</li>
192 '///+<li>Close the document</li>
195 '///+<li>Delete the file</li>
196 hDeleteFile( workpath & workfile )
198 '///+<li>Close navigator if present</li>
201 next iCurrentFileFormat
203 next iCurrentDocumentType