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
59 dim iCurrentTime as long
62 dim iDocType as integer
63 dim iDocument as integer
64 dim cFilter( 4 ) as string
65 cFilter( 1 ) = "writer8"
66 cFilter( 2 ) = "calc8"
67 cFilter( 3 ) = "impress8"
68 cFilter( 4 ) = "draw8"
74 const TESTFILE_COUNT = 60 ' the number of documents in cWorkPath
75 const TESTFILE_TIMEOUT = 480000
78 while( getDocumentCount > 0 )
82 ' create the workdirectory
85 ' dynamically create a bulk of files to be written to the work directory
89 hNumericDocType( iDocType )
93 for iDocument = 1 to 15
94 cFile = cWorkPath & "\" & "test_" & cFilter( iDocType ) & iDocument
95 lTime = getSystemTicks
96 hFileSaveAsWithFilterKill( cFile, cFilter( iDocType ) )
97 lWait = lWait + getSystemTicks - lTime
100 printlog( "Total time for saving 15 documents: " & lWait & " ms" )
101 lTimeSum = lTimeSum + lWait
104 if ( getDocumentCount > 0 ) then
105 warnlog( "Not all files were saved and closed" )
109 printlog( "Time for saving 60 documents: " & lTimeSum & " ms" )
110 printlog( "Average time per document...: " & lTimeSum / TESTFILE_COUNT & " ms" )
112 printlog( "FileOpen" )
115 printlog( "Go to the workdirectory: " & cWorkPath )
117 if ( OeffnenDlg.exists( 1 ) ) then
119 DateiName.typeKeys( cWorkPath )
123 if ( active.exists( 2 ) ) then
124 cMsg = active.getText()
125 cMsg = hRemoveLineBreaks( cMsg )
126 warnlog( "Unexpected messagebox: " & cMsg )
129 if ( OeffnenDlg.exists() ) then
132 warnlog( "File Open dialog is not visible" )
137 printlog( "Select all documents and load them simultaneously" )
139 if ( OeffnenDlg.exists() ) then
141 DateiAuswahl.typeKeys( "<HOME>" )
142 DateiAuswahl.typeKeys( "<SHIFT END>" )
145 lTime = GetSystemTicks
147 while ( iOpenDocuments < TESTFILE_COUNT )
148 iOpenDocuments = getDocumentCount()
149 iCurrentTime = getSystemTicks - lTime
152 if ( iCurrentTime > TESTFILE_TIMEOUT ) then
153 warnlog( "Loading files max wait time exceed (" & _
154 TESTFILE_TIMEOUT/1000 & "), aborting" )
159 if ( iCurrentTime > 120000 ) then
160 warnlog( "#i105289# Slow loading of files, should be less than 120 seconds on all platforms" )
162 lWait = getSystemTicks - lTime ' time diff
164 printlog( "All documents loaded in " & lWait & " ms" )
167 printlog( "Starting to close all documents" )
168 for iCurrentFile = 1 to TESTFILE_COUNT
172 printlog( "Finished closing documents" )
174 if ( getDocumentCount > 0 ) then
175 warnlog( "Not all documents were closed." )
176 iOpenDocuments = getDocumentCount
177 for iCurrentFile = 1 to iOpenDocuments - 1
181 printlog( "All documents have been closed. Test succeeded." )
184 printlog( "Deleting work files..." )
185 for iDocType = 1 to 4
186 hNumericDocType( iDocType )
187 for iDocument = 1 to 15
188 cFile = cWorkPath & "\" & "test_" & cFilter( iDocType ) & iDocument
193 printlog( "Removing temporary work directory" )
196 warnlog( "File Open dialog is not visible" )
199 warnlog( "File Open dialog did not open." )