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: ctrl_Grid.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-16 07:43:41 $
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 : marc.neumann@sun.com
36 '* short description : Grid Control Test
38 '\***********************************************************************
41 printlog "------------------- ctrl_Grid.inc ------------------------"
43 call tCreateGridControlColumn
44 call tReplaceGridControlColumn
45 call tDeleteGridControlColumn
46 call tShowHideGridControlColumn
49 '-------------------------------------------------------------------------
50 testcase tCreateGridControlColumn
54 '/// open new document
55 printlog "open new document and tear off form function toolbar"
59 call hToolbarSelect("MoreControls",true)
61 '/// insert a grid control
62 printlog "insert a grid control"
63 Kontext "MoreControls"
66 call hDrawingWithSelection ( 40, 20, 60, 40 )
68 '/// cancel the autopilot if exist
69 printlog "cancel the autopilot if exist"
70 Kontext "AutopilotTableElement"
71 if AutopilotTableElement.Exists(3) then AutopilotTableElement.Cancel
74 Kontext "DocumentWriter"
75 '/// select the gridcontrol and press return to get into the edit mode
76 printlog "select the gridcontrol and change in edit mode"
77 DocumentWriter.TypeKeys "<RETURN>" , true
79 '/// press SHIFT F10 to open the context menu and insert a text controls
80 printlog "press SHIFT F10 to open the context menu and insert 3 controls"
82 DocumentWriter.Typekeys "<SHIFT F10>" , true
88 '/// save and close the document
89 printlog "save and close the document"
90 hFileSaveAsKill ( gOfficePath + ConvertPath("user/work/TT_GridControl_create.odt"))
93 '/// load the document
94 printlog "load the document"
95 hFileOpen ( gOfficePath + ConvertPath("user/work/TT_GridControl_create.odt"))
98 call hToolbarSelect("FormControls",true)
100 Kontext "FormControls"
101 SwitchControlDesignMode.Click
104 '/// check if the control are still there
105 printlog "check if the control are still there"
106 Kontext "DocumentWriter"
107 DocumentWriter.TypeKeys "<SHIFT F4>" , true
109 DocumentWriter.TypeKeys "<RETURN>" , true
111 DocumentWriter.Typekeys "<MOD1 SHIFT SPACE>" , true
113 DocumentWriter.Typekeys "<SHIFT F10>" , true
114 'open the propety broser
118 Kontext "ControlPropertiesTabControl"
119 ControlPropertiesTabControl.setPage TabGeneralControl
121 if getControlType <> "text box" then
122 warnlog "column controls is wrong"
124 ' close property browser
125 Kontext "TabGeneralControl"
126 TabGeneralControl.TypeKeys "<Escape>"
132 '-------------------------------------------------------------------------
133 testcase tDeleteGridControlColumn
137 '/// open new document
138 printlog "open new document and tear off form function toolbar"
142 call hToolbarSelect("MoreControls",true)
144 '/// insert a grid control
145 printlog "insert a grid control"
146 Kontext "MoreControls"
149 call hDrawingWithSelection ( 40, 20, 60, 40 )
151 '/// cancel the autopilot if exist
152 printlog "cancel the autopilot if exist"
153 Kontext "AutopilotTableElement"
154 if AutopilotTableElement.Exists(3) then AutopilotTableElement.Cancel
157 Kontext "DocumentWriter"
158 '/// select the gridcontrol and press return to get into the edit mode
159 printlog "select the gridcontrol and change in edit mode"
160 DocumentWriter.TypeKeys "<RETURN>" , true
162 '/// press SHIFT F10 to open the context menu and insert a text controls
163 printlog "press SHIFT F10 to open the context menu and insert 3 controls"
165 DocumentWriter.Typekeys "<SHIFT F10>" , true
172 '/// delete inserted columns
173 printlog "delete inserted columns"
174 DocumentWriter.Typekeys "<MOD1 SHIFT SPACE>" , true
176 DocumentWriter.Typekeys "<RIGHT>" , true
178 DocumentWriter.Typekeys "<SHIFT F10>" , true
181 DocumentWriter.Typekeys "<LEFT>" , true
183 DocumentWriter.Typekeys "<MOD1 SHIFT SPACE>" , true
185 DocumentWriter.Typekeys "<SHIFT F10>" , true
188 DocumentWriter.Typekeys "<LEFT>" , true
190 DocumentWriter.Typekeys "<MOD1 SHIFT SPACE>" , true
192 DocumentWriter.Typekeys "<SHIFT F10>" , true
196 printlog "check deletion"
197 DocumentWriter.Typekeys "<LEFT>" , true
199 DocumentWriter.Typekeys "<MOD1 SHIFT SPACE>" , true
201 DocumentWriter.Typekeys "<SHIFT F10>" , true
202 if hMenuItemGetCount <> 1 then 'context of a column has more than one item
203 warnlog "Deleting column went wrong"
205 printlog "deleting column successfull"
209 '/// save and close the document
210 printlog "save and close the document"
211 hFileSaveAsKill ( gOfficePath + ConvertPath("user/work/TT_GridControl_delete.odt"))
214 '/// reload the document
215 printlog "reload the document"
216 hFileOpen ( gOfficePath + ConvertPath("user/work/TT_GridControl_delete.odt"))
219 call hToolbarSelect("FormControls",true)
221 Kontext "FormControls"
222 SwitchControlDesignMode.Click
225 '/// check deletion after save-&reloading
226 printlog "check deletion after save-&reloading"
227 Kontext "DocumentWriter"
228 DocumentWriter.TypeKeys "<SHIFT F4>" , true
230 DocumentWriter.TypeKeys "<RETURN>" , true
232 DocumentWriter.Typekeys "<MOD1 SHIFT SPACE>" , true
234 DocumentWriter.Typekeys "<SHIFT F10>" , true
236 if hMenuItemGetCount <> 1 then 'context of a column has more than one item
237 warnlog "Deleting column after save-&reloading went wrong"
239 printlog "deleting column after save-&reloading successfull"
242 'close the open context menu
244 call hCloseDocument()
247 '-------------------------------------------------------------------------
248 testcase tReplaceGridControlColumn
250 '/// open new document
251 printlog "open new document and tear off form function toolbar"
256 call hToolbarSelect("MoreControls",true)
258 Kontext "MoreControls"
261 '/// insert a grid control
262 printlog "insert a grid control"
263 printlog "insert a grid control"
264 call hDrawingWithSelection ( 40, 20, 60, 40 )
266 '/// cancel the autopilot if exist
267 printlog "cancel the autopilot if exist"
268 printlog "cancel the autopilot if exist"
269 Kontext "AutopilotTableElement"
270 if AutopilotTableElement.Exists(3) then AutopilotTableElement.Cancel
272 '/// - check replacing columns from context -
273 printlog "- check replacing columns from context -"
275 printlog "- check replacing columns from context -"
277 '/// press SHIFT F10 to open the context menu and insert a text controls
278 printlog "press SHIFT F10 to open the context menu and insert a text controls"
279 Kontext "DocumentWriter"
280 DocumentWriter.Typekeys "<RETURN>" , true
282 DocumentWriter.Typekeys "<SHIFT F10>" , true
287 '/// replace the text control with a list box controls
288 printlog "replace the text control with a list box controls"
289 Kontext "DocumentWriter"
291 DocumentWriter.Typekeys "<MOD1 SHIFT SPACE>" , true
293 DocumentWriter.Typekeys "<SHIFT F10>" , true
298 '/// check if the control was replaced
299 printlog "check if the control was replaced"
300 Kontext "DocumentWriter"
301 DocumentWriter.TypeKeys "<RETURN>" , true
303 DocumentWriter.Typekeys "<MOD1 SHIFT SPACE>" , true
305 DocumentWriter.Typekeys "<SHIFT F10>" , true
306 'open the propety broser
309 if getControlType <> "list box" then
310 warnlog "Replacing column controls went wrong"
312 ' close the property browser
313 Kontext "TabGeneralControl"
314 TabGeneralControl.TypeKeys "<Escape>"
317 '/// save and close the document
318 printlog "save and close the document"
319 hFileSaveAsKill ( gOfficePath + ConvertPath("user/work/TT_GridControl_replacing.odt"))
322 '/// reload the document
323 printlog "reload the document"
324 hFileOpen ( gOfficePath + ConvertPath("user/work/TT_GridControl_replacing.odt"))
328 call hToolbarSelect("FormControls",true)
330 Kontext "FormControls"
331 SwitchControlDesignMode.Click
333 '/// check replacing after save-&reloading
334 printlog "check replacing after save-&reloading"
335 Kontext "DocumentWriter"
336 DocumentWriter.TypeKeys "<SHIFT F4>" , true
338 DocumentWriter.TypeKeys "<RETURN>" , true
340 DocumentWriter.Typekeys "<MOD1 SHIFT SPACE>" , true
342 DocumentWriter.Typekeys "<SHIFT F10>" , true
343 ' open property browser
345 if getControlType <> "list box" then
346 warnlog "Replacing column controls not present after reload"
348 ' close property browser
349 Kontext "TabGeneralControl"
350 TabGeneralControl.TypeKeys "<Escape>"
355 '-------------------------------------------------------------------------
356 testcase tShowHideGridControlColumn
360 '/// open new document
361 printlog "open new document"
365 call hToolbarSelect("MoreControls",true)
367 Kontext "MoreControls"
371 '/// insert a grid control
372 printlog "insert a grid control"
373 call hDrawingWithSelection ( 40, 20, 60, 40 )
376 '/// cancel the autopilot if exist
377 printlog "cancel the autopilot if exist"
378 Kontext "AutopilotTableElement"
379 if AutopilotTableElement.Exists(3) then AutopilotTableElement.Cancel
382 '/// select the gridcontrol and press return to get into the edit mode
383 printlog "select the gridcontrol and change in edit mode"
384 Kontext "DocumentWriter"
385 DocumentWriter.TypeKeys "<RETURN>" , true
388 '/// press SHIFT F10 to open the context menu and insert controls
389 printlog "press SHIFT F10 to open the context menu and insert controls"
391 DocumentWriter.Typekeys "<SHIFT F10>" , true
397 '/// hide the first column
398 printlog "hide the first column"
399 Kontext "DocumentWriter"
401 DocumentWriter.TypeKeys "<RETURN>" , true
403 DocumentWriter.Typekeys "<MOD1 SHIFT SPACE>" , true
405 DocumentWriter.Typekeys "<SHIFT F10>" , true
408 DocumentWriter.TypeKeys "<RETURN>" , true
410 DocumentWriter.Typekeys "<MOD1 SHIFT SPACE>" , true
413 '/// check hiding column
414 printlog "check hiding column"
415 DocumentWriter.TypeKeys "<RETURN>" , true
417 DocumentWriter.Typekeys "<SHIFT F10>" , true
418 if hMenuItemGetCount <> 6 then 'context of a column after hiding has 6 items (normal 5)
419 warnlog "Hiding column went wrong"
421 printlog "hiding column successfull"
424 '/// save and close the document
425 printlog "save and close the document"
426 hFileSaveAsKill ( gOfficePath + ConvertPath("user/work/TT_GridControl_hide_show.odt"))
430 '/// reload the document
431 printlog "reload the document"
432 hFileOpen ( gOfficePath + ConvertPath("user/work/TT_GridControl_hide_show.odt"))
435 '/// check hiding column after saving and reloading
436 printlog "check hiding column after saving and reloadin"
438 call hToolbarSelect("FormControls",true)
440 Kontext "FormControls"
441 SwitchControlDesignMode.Click
444 Kontext "DocumentWriter"
445 DocumentWriter.TypeKeys "<SHIFT F4>" , true
447 DocumentWriter.TypeKeys "<RETURN>" , true
449 DocumentWriter.Typekeys "<MOD1 SHIFT SPACE>" , true
451 DocumentWriter.Typekeys "<SHIFT F10>" , true
452 if hMenuItemGetCount <> 6 then 'context of a column after hiding has 6 items (normal 5)
453 warnlog "Hiding column after saving and reloading went wrong"
455 printlog "hiding column after saving and reloading successfull"
458 '/// show column after saving and reloading
459 printlog "show column after saving and reloading"
463 DocumentWriter.Typekeys "<SHIFT F10>" , true
464 if hMenuItemGetCount <> 5 then 'context of a column normal has 5 items (before show column 6)
465 warnlog "Show column after saving and reloading went wrong"
467 printlog "show column after saving and reloading successfull"
470 'close the open context menu
475 '-------------------------------------------------------------------------
476 '-------------------------------------------------------------------------
477 function getControlType
478 'control property browser must be open
479 'check what properties are present and so find out what control type
480 dim sControlString as string
481 Kontext "TabGeneralControl"
482 if TabGeneralControl.exists(3) then
483 TabGeneralControl.TypeKeys "<TAB>" , true ' this tab is importent, I don't not why but it is.
484 if DefaultState.exists then
485 sControlString = "check box"
486 elseif LineCount.exists then
487 if MaxTextLen.exists then
488 sControlString = "combo box"
490 sControlString = "list box"
492 elseif EditMask.exists then
493 sControlString = "pattern field"
494 elseif FormatKey.exists then
495 sControlString = "formatted field"
496 elseif CurrencySymbol.exists then
497 sControlString = "currency field"
498 elseif TimeMin.exists then
499 sControlString = "time field"
500 elseif DateMin.exists then
501 sControlString = "date field"
502 elseif StrictFormat.exists then
503 sControlString = "numeric field"
504 elseif MaxTextLen.exists then
505 if EditMask.exists then
506 sControlString = "pattern field"
508 sControlString = "text box"
511 sControlString = "unkown"
514 warnlog "TabGeneralControl not there."
517 getControlType = sControlString
519 '-------------------------------------------------------------------------
520 sub myMenuSelectNr ( EintragsNr as Integer ) as String
523 nID = MenuGetItemID ( EintragsNr )