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 : First test of basic functionality
32 '\******************************************************************************
36 printlog( "Open all available document types" )
38 Dim lsList (20) as string
40 if ( gUseSysDlg ) then
41 warnlog("Only check, if the documents will be opened; no " & _
42 "check for the defaultfilter (system file-dialog)!")
47 gApplication = "WRITER"
48 printlog " - " & gApplication
52 Kontext "DocumentWriter"
53 DocumentWriter.TypeKeys "This is a Writer-document!"
54 if gUseSysDlg = FALSE then
55 if fDocumentCheck (gWriterFilter) = FALSE then
56 warnlog("The filter name (saving) is not correct! " & _
57 "Please check if a Writer document will be opened!")
68 printlog " - " & gApplication
71 Kontext "DocumentCalc"
72 DocumentCalc.TypeKeys "This is a Calc-document!"
74 if gUseSysDlg = FALSE then
75 if fDocumentCheck (gCalcFilter) = FALSE then
76 warnlog("The filter name (saving) is not correct! " & _
77 "Please check if a Calc document will be opened!")
87 gApplication = "IMPRESS"
88 printlog " - " & gApplication
94 if gUseSysDlg = FALSE then
95 if fDocumentCheck (gImpressFilter) = FALSE then
96 warnlog("The filter name (saving) is not correct! " & _
97 "Please check if an Impress document will be opened!")
107 gApplication = "DRAW"
108 printlog " - " & gApplication
111 if gUseSysDlg = FALSE then
112 if fDocumentCheck (gDrawFilter) = FALSE then
113 warnlog("The filter name (saving) is not correct! Please check if a Draw document will be opened!")
122 gApplication = "HTML"
123 printlog " - " & gApplication
125 Kontext "DocumentWriter"
126 DocumentWriter.TypeKeys "This is a HTML-Document!"
127 if gUseSysDlg = FALSE then
128 if (fDocumentCheck (gHTMLFilter) = FALSE) then
129 warnlog("The filter name (saving) is not correct! Please check if a HTML document will be opened! -> #i30867")
139 gApplication = "MATH"
140 printlog " - " & gApplication
142 Call SchreibenInMathDok("a over b")
143 if gUseSysDlg = FALSE then
144 if fDocumentCheck (gMathFilter) = FALSE then
145 warnlog("The filter name (saving) is not correct! Please check if a Math document will be opened!")
156 gApplication = "MASTERDOCUMENT"
157 printlog " - " & gApplication
159 Kontext "DocumentWriter"
160 DocumentWriter.TypeKeys "This is a master document!"
161 if gUseSysDlg = FALSE then
162 if fDocumentCheck (gMasterDocFilter) = FALSE then
163 warnlog("The filter name (saving) is not correct! Please check if a Master document will be opened!")
167 if Navigator.Exists(5) then
177 '*******************************************************************************
181 printlog( "Load a Java applet. It should *not* be executed, applets are disabled by default" )
183 Dim iTryLoadingJava as integer
186 ' This test will not work if the system filedialog is used.
188 warnlog("No test with system file-dialog!")
192 Dateiname.settext(ConvertPath(gTestToolPath & "global\input\java\java.htm")
194 hFileWait( false ) ' Wait but do not warn.
195 for iTryLoadingJava = 1 to 10
197 'Sometimes it needs time to bring up the Java Runtime on the system.
198 'Just trying it 10 times (paused with a sleep(1)
200 ' if no java is installed or it is disabled a messagebox will be displayed
201 ' for each class file triggered by this test, so there will be two errormessages
202 ' asking to enable java. The first msgbox will be handled within the loop while
203 ' waiting for the document to get loaded, the second msgbox will be handled
204 ' outside the loop, it comes up right after the first one.
207 if ( MessageBox.exists( 1 )) then
208 warnlog(Messagebox.GetText())
211 MessageBox.notExists( 2 ) ' wait till it's gone, timing related
213 Messagebox.OK() ' if "OK" works, we are in an undefined state
214 warnlog( "The dialog has been closed by OK -> BUG" )
219 printlog "... wait another second ..."
223 ' the second errormessage is a bug (even if it is logical it is not ok
224 ' from a user's point of view. The task will not be fixed for OOo 2.0
226 if ( messagebox.exists() ) then
228 qaerrorlog( "#i37020# Second messagebox displayed" )
232 warnlog( "The dialog has been closed by OK -> BUG" )
236 messageBox.notExists( 5 )
237 Call hCloseDocument()
241 '*******************************************************************************
243 testcase tDatabaseCheck
245 printlog( "Minimal test for Database functionality" )
248 gApplication = "WRITER"
249 hFileOpen( ConvertPath(gOfficePath & "user\database\biblio.odb" )
250 printlog "check if database is open"
252 if (Database.exists()) then
253 printlog "Database open"
254 printlog "click on the table icon and check if tables are displayed"
257 Kontext "ContainerView"
258 if TableTree.exists() then
259 printlog "table tree visible"
261 warnlog "table tree not visible"
264 warnlog "Database not open"
268 warnlog "error while open Database."
272 '*******************************************************************************
274 function fDocumentCheck( SollFilter as String ) as boolean
275 ' Check the name of the file type in the Save dialog and validate
276 ' it against a given string.
277 Dim sFiltername as String
281 Kontext "SpeichernDlg"
282 if ( SpeichernDlg.exists( 1 ) ) then
283 sFiltername = DateiTyp.GetItemText (1)
284 if (Instr(lcase(sFiltername), lcase (SollFilter)) <> 0) then
285 fDocumentCheck() = TRUE
287 printlog("Filter names do not match:")
288 printlog("Found: [" & sFilterName & "]")
289 printlog("Expected: [" & SollFilter & "]")
290 SollFilter = sFiltername
291 fDocumentCheck() = FALSE
293 SpeichernDlg.Cancel()
295 warnlog( "Dialog <File Save As> did not open" )
296 fDocumentCheck() = FALSE
300 '*******************************************************************************
302 testcase tInFilterCountCompare()
304 printlog( "Check filterlist (filterstring) for graphics files" )
306 const FILE_NAME = "graphic_filters.txt"
307 const SUFFIX_STRING_LENGTH = 178
309 ' List of filter suffixes for verification in case of error
310 ' *.bmp;*.dxf;*.emf;*.eps;*.gif;*.jpg;*.jpeg;*.jfif;*.jif;*.met;*.pbm;*.pcd;
311 ' *.pct;*.pcx;*.pgm;*.png;*.ppm;*.psd;*.ras;*.sgf;*.sgv;*.svm;*.tga;*.tif;
312 ' *.tiff;*.wmf;*.xbm;*.xpm;*.pict
314 dim caUIFilters( 30 ) as string
316 dim cReferencePath as string
317 cReferencePath = gTesttoolPath & "global/input/filters/"
318 cReferencePath = convertpath ( cReferencePath & FILE_NAME )
320 dim cUIFiltersPath as string
321 cUIFiltersPath = hGetWorkPath() & FILE_NAME
323 dim iCurrentFilter as integer
324 dim iFilterCount as integer
326 dim cAllFormats as string
329 dim iBegin as integer
333 printlog( "Verify filternames listed on the Insert Graphics dialog" )
338 InsertGraphicsFromFile
340 kontext "GrafikEinfuegenDlg"
341 if ( GrafikEinfuegenDlg.exists( 1 ) ) then
342 iFilterCount = DateiTyp.getItemCount()
344 'Make list compatible with listfunctions
345 caUIFilters( 0 ) = iFilterCount - 1
347 for iCurrentFilter = 2 to iFilterCount
349 caUIFilters( iCurrentFilter - 1 ) = DateiTyp.getItemText( iCurrentFilter )
353 irc = hManageComparisionList( cReferencePath, cUIFiltersPath, caUIFilters() )
354 hListResultEvaluation( irc , 0 )
357 printlog( "Verify <All formats>-string" )
358 cAllFormats = DateiTyp.getItemText( 1 )
360 iBegin = instr( cAllFormats, "<" )
361 if ( iBegin <> 1 ) then
362 warnlog( "The opening bracket < is missing in <All formats> string" )
365 iEnd = instr( cAllFormats, ">" )
367 warnlog( "The closing bracket > is missing in <All formats> string" )
370 if ( ( iEnd - iBegin ) < 2 ) then
371 warnlog( "<All formats> string is shorter than expected, please check" )
372 printlog( "String is: " & cAllFormats & ", length (" & len( cAllFormats ) & ")" )
375 iBegin = instr( cAllFormats, "(" )
376 if ( iBegin <> iEnd + 2 ) then
377 warnlog( "The opening bracket ( is missing in <All formats> string" )
380 iEnd = instr( cAllFormats, ")" )
381 if ( iEnd < 10 ) then
382 warnlog( "The closing bracket ) is missing in <All formats> string" )
386 if ( irc <> SUFFIX_STRING_LENGTH ) then
387 warnlog( "The list of file suffixes has changed, please verify" )
388 printlog( "Found: " & irc & " chars, expected " & SUFFIX_STRING_LENGTH )
391 kontext "GrafikEinfuegenDlg"
392 GrafikEinfuegenDlg.cancel()
394 warnlog( "<Insert Graphics> dialog did not open" )