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 : save and load passworded files
32 '\******************************************************************************
34 testcase tFiledlgPasswords()
36 dim workfile as string
37 dim workpath as string
38 workpath = hGetWorkPath()
40 dim filetype as string
41 dim filetypeID as string
44 dim iCurrentDocumentType as integer
45 dim iCurrentFileFormat as integer
48 for iCurrentDocumentType = 1 to 6
50 printlog( "Document Type: " & hNumericDocType( iCurrentDocumentType ) )
52 for iCurrentFileFormat = 1 to 2
54 select case iCurrentFileFormat
55 case 1 : filetypeID = "645"
56 case 2 : filetypeID = "current"
62 hCloseDialog( Navigator, "close,optional" )
66 printlog( "Open file-save dialog" )
67 if ( gApplication = "IMPRESS" ) then
68 printlog( " IMPRESS is slower than other apps, delaying for 2 sec." )
74 Kontext "SpeichernDlg"
75 if ( SpeichernDlg.exists( 2 ) ) then
77 filetype = hGetFilter( filetypeID )
78 hSelectUIFilter( filetype )
80 workfile = "password" & hGetSuffix( filetypeID )
81 DateiName.setText( workpath & workfile )
83 printlog( "Using fileformat: " & filetype )
84 printlog( "Using filename..: " & workfile )
86 printlog( "Check password" )
87 if ( passwort.isEnabled() ) then
90 warnlog( "#i36663# Password checkbox is disabled" )
93 printlog( "Save the file" )
97 if ( active.exists( 2 ) ) then
98 printlog( "Handle overwrite warning (if any)" )
103 Kontext "PasswordFileSave"
104 printlog( "Enter the name of the file as password and confirm" )
105 if ( passwordFileSave.exists() ) then
106 Password.settext( workfile )
107 PasswordConfirm.settext( workfile )
108 PasswordFileSave.ok()
110 warnlog( "No password dialog is displayed" )
113 kontext "AlienWarning"
114 if ( AlienWarning.exists( 2 ) ) then
115 if ( FileTypeID <> "current" ) then
116 printlog( "Handle alienwarning (expected)" )
119 warnlog( "Handle alienwarning (unexpected)" )
126 printlog( "Open the file via file-open" )
130 if ( OeffnenDlg.exists( 2 ) ) then
131 Dateiname.settext( workfile )
135 Kontext "PasswordFileOpen"
136 printlog( "Enter the filename as password" )
137 if ( PasswordFileOpen.exists( 4 ) ) then
138 PasswortName.settext( workfile )
139 PasswordFileOpen.ok()
142 if ( Active.exists( 2 ) ) then
143 cMsg = active.getText()
144 cMsg = hRemoveLineBreaks( cMsg )
146 warnlog( "#i65889# - CWS Warnings01: Cannot read password protected files" )
150 warnlog( "No password dialog is displayed" )
154 printlog( "Verify that the document is loaded" )
158 if ( Navigator.exists( 1 ) ) then
159 qaerrorlog( "Navigator should not be visible - setting not saved?" )
162 warnlog( "Second file open failed" )
165 warnlog( "File Open dislog did not come up" )
169 hCloseDialog( Navigator, "close,optional" )
173 hDeleteFile( workpath & workfile )
176 hCloseDialog( Navigator, "close,optional" )
178 next iCurrentFileFormat
180 next iCurrentDocumentType