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 : Load certified documents and verify the certificate
32 '\******************************************************************************
34 testcase tLoadCertifiedFile( cBuildID as string )
37 ' Build the path to the file we want to work with
39 cFile = gTesttoolpath & "framework\optional\input\security\DigitalSignature"
40 cFile = cFile & hGetSuffix( cBuildId )
41 cFile = convertpath( cFile )
42 printlog( "Using file: " & cFile )
44 dim cSigName as string
45 dim sCertData( 20 ) as string
48 sFileIn = gTesttoolPath & "framework\optional\input\security\certificate_data.txt"
49 sFileIn = convertpath( sFileIn )
51 dim sFileOut as string
52 sFileOut = hGetWorkPath() & "certificate_data.txt"
54 ' Variable to store boolean returncodes from functions
55 dim brc as boolean : brc = true
56 dim irc as boolean : irc = 0
58 ' the number of certificates attached to the current document
59 dim iCertCount as integer
61 printlog( "Load the file" )
63 brc = hHandleActivesOnLoad( 0 , 2 )
65 ' in case the file did not get loaded, handle the problem by aborting the test
67 warnlog( "The requested file could not be loaded, aborting test" )
71 brc = hOpenDigitalSignaturesDialog()
73 ' If the menuitem should not be available, clicking it will fail. In
74 ' this case we must assume that the file has been loaded but the certificate
75 ' does not exist. So we close the document and abort the test here.
77 warnlog( "The requested menuitem is not available, the test ends" )
82 ' second line of defense: If something was opened but this is not the
83 ' digital signatures dialog, we abort as well.
84 ' If no mozill a profile exists, we don't have the means to verify
85 ' certificates, so the test aborts here as well. We get a messagebox then.
86 Kontext "DigitalSignature"
87 if ( not DigitalSignature.exists( 2 ) ) then
89 if ( active.exists() ) then
90 qaerrorlog( "#i48252# Mozilla profile missing?: " & active.getText() )
93 warnlog( "The current dialog is not <Digital Signatures>. Aborting" )
99 ' If we have zero or more than one certificate, this is probably a bug
100 ' introduced by the test maintainer. However, we warn but the test can
102 Kontext "DigitalSignature"
104 ViewCertificate.click()
106 hSelectXMLSecTab( "PATH" )
108 qaerrorlog( "Skipping EditBrowseBox: Not implemented in Testtool yet" )
109 goto SkipEditBrowseBox
111 kontext "TabXMLSecCertPath"
112 XMLSecViewSigTree.select( 1 )
113 cSigName = XMLSecViewSigTree.getSelText()
114 if ( cSigName <> "Dummy Certificate for Testing" ) then
115 warnlog( "The certificate at pos. 1 is not the dummy certificate: " & cSigName )
117 printlog( "Found correct certificate name: " & cSigName )
120 hSelectXMLSecTab( "DETAILS" )
122 kontext "TabXMLSecDetails"
123 hGetListItems( XMLSecDetailsListBox, sCertData() )
125 irc = hManageComparisionList( sFileIn, sFileOut, sCertData() )
126 hListResultEvaluation( irc , 0 )
130 hSelectXMLSecTab( "GENERAL" )
131 kontext "TabXMLSecGeneral"
133 TabXMLSecGeneral.ok()
135 printlog( "Close the dialog with OK" )
136 Kontext "DigitalSignature"
137 DigitalSignature.OK()
139 printlog( "Close the document" )
140 call hCloseDocument()