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: ole_1.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-16 12:18:15 $
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 : thorsten.bosbach@sun.com
36 '* short description : global-level-1-test -> insert all OLE-Objects out of OLE-dialog into all doc-types
38 '\******************************************************************************
42 '///Test all OLE-Objects you can insert out of menu
46 gApplication = "WRITER"
48 '///'file / new / text document'
51 '///'insert / object / chart' without a table
52 PrintLog "- Writer : Chart without table"
55 '///+ click 'create' on the Autoformat dialog for Charts
56 Kontext "DocumentChart"
57 if DocumentChart.Exists(5) then
58 '///+ format / vhart type
61 if ChartType.Exists(5) then
62 '///+ press ( cancel ) in chart type dialog
65 warnlog "Chart Type dialog did bot occour."
67 Kontext "DocumentChart"
69 DocumentChart.TypeKeys "<ESCAPE>"
70 '///+ delete the selected chart with keyboard ( delete )
71 Kontext "DocumentWriter"
72 DocumentWriter.TypeKeys "<DELETE>"
75 warnlog "Chart has not been inserted."
78 '///create a table with numbers
79 PrintLog "- Writer : Chart out of a table only with numbers"
82 Kontext "TabelleEinfuegenWriter"
85 TabelleEinfuegenWriter.OK
87 Kontext "DocumentWriter"
91 DocumentWriter.TypeKeys sText$
92 DocumentWriter.TypeKeys "<Right>"
94 DocumentWriter.TypeKeys "<Down>"
95 DocumentWriter.TypeKeys "<Left>", 3
98 '///+if you are in the table 'insert / object / chart'
100 hStepThroughChartWizard()
102 '///+ delete the selected chart with keyboard ( delete )
103 Kontext "DocumentChart"
104 DocumentChart.typeKeys "<ESCAPE>"
105 Kontext "DocumentWriter"
106 DocumentWriter.TypeKeys "<Delete>"
108 DocumentWriter.TypeKeys "<Down>", 20
109 DocumentWriter.TypeKeys "<Return>", 2
113 '///create a new table only with characters
114 PrintLog "- Writer : Chart out of a table only with chars"
117 Kontext "TabelleEinfuegenWriter"
120 TabelleEinfuegenWriter.OK
122 Kontext "DocumentWriter"
126 DocumentWriter.TypeKeys "Hallo" + sText$
127 DocumentWriter.TypeKeys "<Right>"
129 DocumentWriter.TypeKeys "<Down>"
130 DocumentWriter.TypeKeys "<Left>", 3
133 '///+if you are in the table 'insert / object / chart'
136 hStepThroughChartWizard()
138 '///+ delete the selected chart with keyboard ( delete )
139 Kontext "DocumentChart"
140 DocumentChart.typeKeys "<ESCAPE>"
141 Kontext "DocumentWriter"
142 DocumentWriter.TypeKeys "<Delete>"
144 DocumentWriter.TypeKeys "<Down>", 20
145 DocumentWriter.TypeKeys "<Return>", 2
148 '///insert a math object into the writer doc
149 PrintLog "- Writer : Math"
151 '///+ insert / object / formula
152 InsertObjectFormulaWriter
155 '///+ delete the selected mathobject with keyboard ( delete )
156 Kontext "DocumentWriter"
157 DocumentWriter.TypeKeys "<Delete>"
160 '///insert a floating object into the writer doc
161 PrintLog "- Writer : floating frame"
163 'warnlog( "#148094# - Crash when deselecting floating frame in Writer" )
165 '///+insert / floating frame
168 '///+insert in the dialog as name 'hello' and as contents '[Testtoolpath]\global\input\graf_inp\borabora.jpg'
169 Kontext "TabEigenschaften"
170 FrameName.SetText "Hallo"
171 Inhalt.SetText ConvertPath ( gTesttoolPath+"global\input\graf_inp\borabora.jpg" )
177 '///+ delete the selected frame with keyboard ( delete )
178 Kontext "DocumentWriter"
179 DocumentWriter.TypeKeys "<Delete>"
182 '///close the document
187 '*******************************************************************************
192 '///<h1>Create charts within Calc as OLE objects</h1>
198 const ICWAIT as Integer = 2
200 dim iCurrentPos as integer
201 dim iColumn as integer
204 const CHART_OBJECT_DEFAULT_POSITION_X = 30
205 const CHART_OBJECT_DEFAULT_POSITION_Y = 30
206 const OUTSIDE_CHART_OBJECT_X = 1
207 const OUTSIDE_CHART_OBJECT_Y = 1
208 const CURSOR_MOVEMENT_RETRIES = 20
209 const SELECT_CELLS_X = 7
210 const SELECT_CELLS_Y = 7
212 gApplication = "CALC"
214 '///+<li>Create a new spredsheet document</li>
215 brc = hCreateDocument()
217 warnlog( "Failed to create new " & gApplication & " document" )
220 '///+<li>Insert a Chart Object without specifying a data range</li>
221 PrintLog "- Calc : Chart without data"
224 '///+<li>Step through the wizard without changing any settings, close it</li>
225 hStepThroughChartWizard()
227 '///+<li>Switch from editing to select mode of the OLE object by typing <ESC></li>
228 kontext "DocumentChart"
229 DocumentChart.typeKeys( "<ESCAPE>" )
231 '///+<li>Remove focus from object by clicking into the document</li>
232 Kontext "DocumentCalc"
233 gMouseClick ( OUTSIDE_CHART_OBJECT_X , OUTSIDE_CHART_OBJECT_Y )
236 '///+<li>Click on the chart and delete it with 'delete'</li>
237 ' If the OLE object is in selection mode the Drawing Object Bar should be
238 ' visible. As we do not know exactly where on the spreadsheet the object
239 ' appears we move from the upper left to the lower right corner of the
240 ' document until we hit an OLE object and the Drawing Object Bar is enabled.
241 ' Then <DEL> is sent to the document hopefully deleting the object.
243 for iCurrentPos = 1 to 9
245 kontext "DocumentCalc"
246 gMouseClick( 10 * iCurrentPos , 10 * iCurrentPos )
248 Kontext "DrawingObjectBar"
249 if ( DrawingObjectBar.exists( 1 ) ) then
251 kontext "DocumentCalc"
252 DocumentCalc.TypeKeys( "<Delete>" )
253 printlog( "Found drawing object, executed <DEL> on the object" )
258 qaerrorlog( "Drawing object not hit, trying again" )
266 '///+<li>insert a chart with data</li>
269 PrintLog "- Calc : Chart with data"
271 '///+<li>Create a table with random numbers in the cells A1 to G7</li>
272 kontext "DocumentCalc"
273 DocumentCalc.TypeKeys( "<MOD1 HOME>" )
274 for iColumn = 1 to SELECT_CELLS_Y
275 for iRow = 1 to SELECT_CELLS_X
276 hTypeKeys ( iColumn * iRow )
277 hTypeKeys ( "<Return>" )
279 DocumentCalc.TypeKeys( "<Up><Left>", CURSOR_MOVEMENT_RETRIES )
280 DocumentCalc.TypeKeys( "<Right>", iColumn )
283 '///+<li>Select the range A1 to G7</li>
284 DocumentCalc.TypeKeys( "<Up><Left>", CURSOR_MOVEMENT_RETRIES )
285 call ZellenMarkieren ( SELECT_CELLS_X , SELECT_CELLS_Y )
287 '///+<li>Insert / chart</li>
290 '///+<li>Click on 'next' for each page in AutoFormat dialog for charts and on the last page click 'create'</li>
291 hStepThroughChartWizard()
293 '///+<li>click in the spreadsheet document to deselect the chart</li>
294 Kontext "DocumentCalc"
295 DocumentCalc.typeKeys("<escape>")
299 '///+<li>insert a chart only with text in the table</li>
301 PrintLog "- Calc : Chart for a table only with text"
303 '///+<li>Create a range of cells from A1 to G7 containing text content</li>
304 Kontext "DocumentCalc"
305 DocumentCalc.TypeKeys( "<MOD1 HOME>" )
306 for iColumn = 1 to SELECT_CELLS_Y
307 for iRow = 1 to SELECT_CELLS_X
308 hTypeKeys ( "Hallo<Return>" )
310 DocumentCalc.TypeKeys "<Up><Left>", CURSOR_MOVEMENT_RETRIES
311 DocumentCalc.TypeKeys "<Right>", iColumn
314 '///+<li>Select the range from A1 to G7</li>
315 DocumentCalc.TypeKeys "<Up><Left>", CURSOR_MOVEMENT_RETRIES
316 call ZellenMarkieren ( SELECT_CELLS_X , SELECT_CELLS_Y )
318 '///+<li>Click insert / chart or go there via menu</li>
321 '///+<li>Step through the Chart Wizard keeping all defaults, finish it</li>
322 hStepThroughChartWizard()
324 '///+<li>Click in the spreadsheet document to deselect the chart</li>
325 Kontext "DocumentCalc"
326 gMouseCLick ( OUTSIDE_CHART_OBJECT_X , OUTSIDE_CHART_OBJECT_Y )
330 '///+<li>Insert a math object</li>
332 PrintLog( "- Calc : Math" )
334 '///+<li>Insert / object / formula</li>
335 InsertObjectFormulaCalc
338 '///+<li>Click in the spreadsheet document to deselect the chart</li>
339 gMouseClick ( 50, 99 )
343 '///+<li>insert a floating frame</li>
345 PrintLog( "- Calc : floating frame" )
347 '///+<li>Insert a floating frame</li>
350 '///+<li>Insert in the dialog as name 'hello' and as contents '[Testtoolpath]\global\input\graf_inp\borabora.jpg'</li>
351 Kontext "TabEigenschaften"
352 FrameName.SetText( "Hallo" )
353 Inhalt.SetText( ConvertPath ( gTesttoolPath+"global\input\graf_inp\borabora.jpg" ) )
355 '///+<li>Click 'OK'</li>
356 TabEigenschaften.OK()
359 '///+<li>Click in the spreadsheet document to deselect the chart</li>
360 gMouseCLick ( OUTSIDE_CHART_OBJECT_X , OUTSIDE_CHART_OBJECT_Y )
364 '///+<li>close the document</li>
365 brc = hDestroyDocument()
370 '*******************************************************************************
375 Dim iMenuCount(1) as integer
377 gApplication = "DRAW"
379 '///file / new / drawing
382 '///insert a math object
383 PrintLog "- Draw : Math"
384 '///+insert / object / formula
385 InsertObjectFormulaDraw
388 '///+click into the draw document once to set the focus on the math object
389 gMouseClick ( 1 , 1 )
392 '///+delete the object with keyboard ( delete )
393 DocumentDraw.TypeKeys "<Delete>"
396 PrintLog "- Draw : Chart"
398 '/// Special test: check that menubar switches, by comparing the count. ///'
400 iMenuCount(0) = menuGetItemCount
408 Kontext "DocumentChart"
409 DocumentChart.useMenu
410 iMenuCount(1) = menuGetItemCount
412 if iMenuCount(0) = iMenuCount(1) then
413 warnlog "Menu bar didn't change after inserting OLE object; It should be different from: " +iMenuCount(0)
415 printlog "Menu bar did change; from: " + iMenuCount(0) + "; to: " + iMenuCount(1)
418 '///+click into the draw document once to set the focus on the math object
419 gMouseClick ( 1 , 1 )
422 '///+delete the object with keyboard ( delete )
423 DocumentDraw.TypeKeys "<Delete>"
428 '///insert a spreadsheet
429 PrintLog "- Draw : Calc"
431 '///+insert / spreadsheet
432 InsertSpreadsheetDraw
435 '///+click one time into the draw document to set only the focus on the math object
436 gMouseClick ( 1 , 1 )
439 '///+delete the object with keyboard ( delete )
440 DocumentDraw.TypeKeys "<Delete>"
442 '///insert a floating frame
443 PrintLog "- Draw : floating frame"
445 '///+insert / floating frame
449 Kontext "TabEigenschaften"
451 '///+insert in the dialog as name 'hello' and as contents '[Testtoolpath]\global\input\graf_inp\borabora.jpg'
452 FrameName.SetText "Hallo"
453 Inhalt.SetText ConvertPath ( gTesttoolPath+"global\input\graf_inp\borabora.jpg" )
459 '///+click one time into the draw document to set only the focus on the math object
460 gMouseClick ( 1 , 1 )
463 '///+delete the object with keyboard ( delete )
464 DocumentDraw.TypeKeys "<Delete>"
473 '*******************************************************************************
479 gApplication = "IMPRESS"
481 '///file / new / presentation
484 '///insert a math object
485 PrintLog "- Impress : Math"
487 '///+insert / object / formula
488 InsertObjectFormulaDraw
491 '///+click one time into the impress document to set only the focus on the math object
492 gMouseClick ( 1 , 1 )
495 '///+delete the object with keyboard ( delete )
496 DocumentImpress.TypeKeys "<Delete>"
499 PrintLog "- Impress : Chart"
506 '///+click one time into the impress document to set only the focus on the math object
507 gMouseClick ( 1 , 1 )
510 '///+delete the object with keyboard ( delete )
511 DocumentImpress.TypeKeys "<Delete>"
517 PrintLog "- Impress : Calc"
519 '///+insert / spreadsheet
520 InsertSpreadsheetDraw
523 '///+click one time into the impress document to set only the focus on the math object
524 gMouseClick ( 1 , 1 )
527 '///+delete the object with keyboard ( delete )
528 DocumentImpress.TypeKeys "<Delete>"
531 PrintLog "- Impress : floating frame"
534 '///+insert / floating frame
537 Kontext "TabEigenschaften"
538 FrameName.SetText "Hallo"
540 '///+insert in the dialog as name 'hello' and as contents '[Testtoolpath]\global\input\graf_inp\borabora.jpg'
541 Inhalt.SetText ConvertPath ( gTesttoolPath+"global\input\graf_inp\borabora.jpg" )
547 '///+click one time into the impress document to set only the focus on the math object
548 gMouseClick ( 1 , 1 )
554 '///+delete the object with keyboard ( delete )
555 DocumentImpress.TypeKeys "<Delete>"