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_multiselection.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 : Select a huge number of documents and load
38 '\******************************************************************************
40 testcase tFiledlgMultiselection1()
42 printlog( "Stress test: Load a great number of documents simultaneously" )
44 GLOBAL_USE_NEW_SLEEP = true
46 ' This is a test requested by framework development to be used in multi-
47 ' user environments like Terminal Servers. It is used to quickly create
48 ' a certain load. Furthermore issues (mostly unconfirmed) have been reported
49 ' that loading files using multiselection might lead to a crash.
51 dim cWorkPath as string : cWorkPath = hGetWorkPath() & "multiselection"
54 dim iCurrentFile as integer
55 dim iOpenDocuments as integer
61 dim iDocType as integer
62 dim iDocument as integer
63 dim cFilter( 4 ) as string
64 cFilter( 1 ) = "writer8"
65 cFilter( 2 ) = "calc8"
66 cFilter( 3 ) = "impress8"
67 cFilter( 4 ) = "draw8"
73 const TESTFILE_COUNT = 60 ' the number of documents in cWorkPath
74 const TESTFILE_TIMEOUT = 120000
77 while( getDocumentCount > 0 )
81 ' create the workdirectory
84 ' dynamically create a bulk of files to be written to the work directory
88 hNumericDocType( iDocType )
92 for iDocument = 1 to 15
93 cFile = cWorkPath & "\" & "test_" & cFilter( iDocType ) & iDocument
94 lTime = getSystemTicks
95 hFileSaveAsWithFilterKill( cFile, cFilter( iDocType ) )
96 lWait = lWait + getSystemTicks - lTime
99 printlog( "Total time for saving 15 documents: " & lWait & " ms" )
100 lTimeSum = lTimeSum + lWait
103 if ( getDocumentCount > 0 ) then
104 warnlog( "Not all files were saved and closed" )
108 printlog( "Time for saving 60 documents: " & lTimeSum & " ms" )
109 printlog( "Average time per document...: " & lTimeSum / TESTFILE_COUNT & " ms" )
111 printlog( "FileOpen" )
114 printlog( "Go to the workdirectory: " & cWorkPath )
116 if ( OeffnenDlg.exists( 1 ) ) then
118 DateiName.typeKeys( cWorkPath )
122 if ( active.exists( 2 ) ) then
123 cMsg = active.getText()
124 cMsg = hRemoveLineBreaks( cMsg )
125 warnlog( "Unexpected messagebox: " & cMsg )
128 if ( OeffnenDlg.exists() ) then
131 warnlog( "File Open dialog is not visible" )
136 printlog( "Select all documents and load them simultaneously" )
138 if ( OeffnenDlg.exists() ) then
140 DateiAuswahl.typeKeys( "<HOME>" )
141 DateiAuswahl.typeKeys( "<SHIFT END>" )
144 lTime = GetSystemTicks
146 while ( iOpenDocuments < TESTFILE_COUNT )
147 iOpenDocuments = getDocumentCount
148 if ( (getSystemTicks - lTime) > TESTFILE_TIMEOUT ) then
149 warnlog( "Loading files max wait time exceed (120 seconds), aborting" )
153 lWait = getSystemTicks - lTime ' time diff
155 printlog( "All documents loaded in " & lWait & " ms" )
158 printlog( "Starting to close all documents" )
159 for iCurrentFile = 1 to TESTFILE_COUNT
163 printlog( "Finished closing documents" )
165 if ( getDocumentCount > 0 ) then
166 warnlog( "Not all documents were closed." )
167 iOpenDocuments = getDocumentCount
168 for iCurrentFile = 1 to iOpenDocuments - 1
172 printlog( "All documents have been closed. Test succeeded." )
175 printlog( "Deleting work files..." )
176 for iDocType = 1 to 4
177 hNumericDocType( iDocType )
178 for iDocument = 1 to 15
179 cFile = cWorkPath & "\" & "test_" & cFilter( iDocType ) & iDocument
184 printlog( "Removing temporary work directory" )
187 warnlog( "File Open dialog is not visible" )
190 warnlog( "File Open dialog did not open." )