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 : Select a huge number of documents and load
32 '\******************************************************************************
34 testcase tFiledlgMultiselection1()
36 printlog( "Stress test: Load a great number of documents simultaneously" )
38 GLOBAL_USE_NEW_SLEEP = true
40 ' This is a test requested by framework development to be used in multi-
41 ' user environments like Terminal Servers. It is used to quickly create
42 ' a certain load. Furthermore issues (mostly unconfirmed) have been reported
43 ' that loading files using multiselection might lead to a crash.
45 dim cWorkPath as string : cWorkPath = hGetWorkPath() & "multiselection"
48 dim iCurrentFile as integer
49 dim iOpenDocuments as integer
53 dim iCurrentTime as long
56 dim iDocType as integer
57 dim iDocument as integer
58 dim cFilter( 4 ) as string
59 cFilter( 1 ) = "writer8"
60 cFilter( 2 ) = "calc8"
61 cFilter( 3 ) = "impress8"
62 cFilter( 4 ) = "draw8"
68 const TESTFILE_COUNT = 60 ' the number of documents in cWorkPath
69 const TESTFILE_TIMEOUT = 480000
72 while( getDocumentCount > 0 )
76 ' create the workdirectory
79 ' dynamically create a bulk of files to be written to the work directory
83 hNumericDocType( iDocType )
87 for iDocument = 1 to 15
88 cFile = cWorkPath & "\" & "test_" & cFilter( iDocType ) & iDocument
89 lTime = getSystemTicks
90 hFileSaveAsWithFilterKill( cFile, cFilter( iDocType ) )
91 lWait = lWait + getSystemTicks - lTime
94 printlog( "Total time for saving 15 documents: " & lWait & " ms" )
95 lTimeSum = lTimeSum + lWait
98 if ( getDocumentCount > 0 ) then
99 warnlog( "Not all files were saved and closed" )
103 printlog( "Time for saving 60 documents: " & lTimeSum & " ms" )
104 printlog( "Average time per document...: " & lTimeSum / TESTFILE_COUNT & " ms" )
106 printlog( "FileOpen" )
109 printlog( "Go to the workdirectory: " & cWorkPath )
111 if ( OeffnenDlg.exists( 1 ) ) then
113 DateiName.typeKeys( cWorkPath )
117 if ( active.exists( 2 ) ) then
118 cMsg = active.getText()
119 cMsg = hRemoveLineBreaks( cMsg )
120 warnlog( "Unexpected messagebox: " & cMsg )
123 if ( OeffnenDlg.exists() ) then
126 warnlog( "File Open dialog is not visible" )
131 printlog( "Select all documents and load them simultaneously" )
133 if ( OeffnenDlg.exists() ) then
135 DateiAuswahl.typeKeys( "<HOME>" )
136 DateiAuswahl.typeKeys( "<SHIFT END>" )
139 lTime = GetSystemTicks
141 while ( iOpenDocuments < TESTFILE_COUNT )
142 iOpenDocuments = getDocumentCount()
143 iCurrentTime = getSystemTicks - lTime
146 if ( iCurrentTime > TESTFILE_TIMEOUT ) then
147 warnlog( "Loading files max wait time exceed (" & _
148 TESTFILE_TIMEOUT/1000 & "), aborting" )
153 if ( iCurrentTime > 120000 ) then
154 'Closed issue: qaerrorlog( "#i105289# Slow loading of files, should be less than 120 seconds on all platforms" )
155 printlog( "Slow file loading (exceeds 120 seconds)" )
157 lWait = getSystemTicks - lTime ' time diff
159 printlog( "All documents loaded in " & lWait & " ms" )
162 printlog( "Starting to close all documents" )
163 for iCurrentFile = 1 to TESTFILE_COUNT
167 printlog( "Finished closing documents" )
169 if ( getDocumentCount > 0 ) then
170 warnlog( "Not all documents were closed." )
171 iOpenDocuments = getDocumentCount
172 for iCurrentFile = 1 to iOpenDocuments - 1
176 printlog( "All documents have been closed. Test succeeded." )
179 printlog( "Deleting work files..." )
180 for iDocType = 1 to 4
181 hNumericDocType( iDocType )
182 for iDocument = 1 to 15
183 cFile = cWorkPath & "\" & "test_" & cFilter( iDocType ) & iDocument
188 printlog( "Removing temporary work directory" )
191 warnlog( "File Open dialog is not visible" )
194 warnlog( "File Open dialog did not open." )