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: w_drawing_tools2.inc,v $
13 '* last change: $Author: vg $ $Date: 2008-08-18 12:25:59 $
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 : helge.delfs@sun.com
36 '* short description : Test of the drawing tools - group
38 '\***********************************************************************
42 printLog Chr(13) + "- Test of the drawing tools 2 -- Group"
44 Call tGroup_1 'Generate a objects group via menu Format/Group/Group
45 Call tGroup_2 'Generate a objects group via contextmenu Format/Group/Group
46 Call tGroup_3 'Menu entries may not be enabled if less then two objects are selected
47 Call tGroup_4 'Name a selected object group via Menu Format/Name object
48 Call tGroup_5 'Name a selected object group via context menu Name object
49 Call tGroup_6 'Edit object group via Menu Format/Group/Edit Group
50 Call tGroup_7 'Edit object group via context menu Group/Edit Group
51 Call tGroup_8 'Leave object group via Menu Format/Group/Exit Group
52 Call tGroup_9 'Leave object group via context menu Group/Exit Group
53 Call tGroup_10 'Create new objects inside the group ,Undo new created objects before leaving the group
54 Call tGroup_11 'Create new objects inside the group ,Undo new created objects after leaving the group
55 Call tGroup_12 'Save and reload document while editing a group
56 Call tEncapsulatedGroup_1 'Group objects inside the group
60 '-------------------------------------------------------------------------
64 PrintLog "- Generate a objects group via menu Format/Group/Group"
68 PrintLog "- Insert 2 drawing objects (rectangle and ellipse)"
69 Call wZeichenobjektEinfuegen("RECHTECK", 32, 30, 50, 65, false)
71 Call wZeichenobjektEinfuegen("ELLIPSE", 40, 45, 60, 70, false)
73 Call wObjektSelektieren ( 30, 28, 70, 80 )
76 PrintLog "- via menu Format/Group/Group objects."
80 Warnlog "Something wrong when creating group via menu - Format/Group/Group."
87 '-------------------------------------------------------------------------
91 PrintLog "- Generate a objects group via contextmenu Format/Group/Group"
95 PrintLog "- Insert 2 drawing objects (rectangle and ellipse)"
96 Call wZeichenobjektEinfuegen("RECHTECK", 32, 30, 50, 65, false)
98 Call wZeichenobjektEinfuegen("ELLIPSE", 40, 45, 60, 70, false)
100 Call wObjektSelektieren ( 30, 28, 70, 80 )
103 PrintLog "- via contextmenu Group/Group objects."
105 Call wOpenContextMenu
106 Call hMenuSelectNr(10)
107 Call hMenuSelectNr(1)
109 Warnlog "Something wrong when creating group via contextmenu Group/Group"
116 '-------------------------------------------------------------------------
120 PrintLog "- Menu entries may not be enabled if less then two objects are selected."
124 PrintLog "- Insert 2 drawing objects (rectangle and ellipse)"
125 Call wZeichenobjektEinfuegen("RECHTECK", 30, 30, 50, 65, false)
127 Call wZeichenobjektEinfuegen("ELLIPSE", 40, 45, 60, 70, false)
130 PrintLog "- Only select 1 object."
131 Call gMouseClick(32,32)
134 PrintLog "- via menu Format/Group/Group objects."
137 Warnlog "Should NOT generate the group when less then two objects are selected!"
145 '-------------------------------------------------------------------------
149 Dim sGroupName as String
151 sGroupName = "myTestGroup"
153 PrintLog "- Name a selected object group via Menu Format/Name object"
157 PrintLog "- Insert 2 drawing objects (rectangle and ellipse)"
158 Call wZeichenobjektEinfuegen("RECHTECK", 32, 30, 50, 65, false)
160 Call wZeichenobjektEinfuegen("ELLIPSE", 40, 45, 60, 70, false)
162 Call wObjektSelektieren ( 30, 28, 70, 80 )
165 PrintLog "- via menu Format/Group/Group objects."
171 Kontext "NameDlgObject"
172 NameField.SetText sGroupName
175 Warnlog "Something wrong when Naming the group"
178 PrintLog "- let the focus out of the group."
179 Call gMouseClick(5,5)
181 Call wNavigatorAuswahl( 12 , 1 )
187 Kontext "NameDlgObject"
188 if NameField.GetText <> sGroupName then Warnlog "The group name is wrong !"
191 Warnlog "Something wrong when checking the group name"
200 '-------------------------------------------------------------------------
204 Dim sGroupName as String
206 sGroupName = "myTestGroup"
208 PrintLog "- Name a selected object group via context menu Name object "
212 PrintLog "- Insert 2 drawing objects (rectangle and ellipse)"
213 Call wZeichenobjektEinfuegen("RECHTECK", 32, 30, 50, 65, false)
215 Call wZeichenobjektEinfuegen("ELLIPSE", 40, 45, 60, 70, false)
217 Call wObjektSelektieren ( 28, 28, 70, 80 )
220 PrintLog "- via menu Format/Group/Group objects"
225 Call wOpenContextMenu
226 Call hMenuSelectNr(6)
227 Kontext "NameDlgObject"
228 NameField.SetText sGroupName
231 Warnlog "Something wrong when Naming the group"
234 PrintLog "- let the focus out of the group."
235 Call gMouseClick(95,95)
237 Call wNavigatorAuswahl( 12 , 1 )
241 Call wOpenContextMenu
242 Call hMenuSelectNr(6)
243 Kontext "NameDlgObject"
244 if NameField.GetText <> sGroupName then Warnlog "The group name is wrong !"
247 Warnlog "Something wrong when checking the group name"
255 '-------------------------------------------------------------------------
259 Dim sPositionX1 as String
260 Dim sPositionY1 as String
261 Dim sPositionX2 as String
262 Dim sPositionY2 as String
264 PrintLog "- Edit object group via Menu Format/Group/Enter Group"
268 PrintLog "- Insert 2 drawing objects (rectangle and ellipse) , generate a group."
269 Call wZeichenobjektEinfuegen("RECHTECK", 32, 32, 50, 65, false)
271 Call gMouseClick(34,34)
273 Call fPositionAndSize("TabPositionAndSizeWriter")
274 sPositionX1 = Horizontalby.Gettext
275 sPositionY1 = Verticalby.Gettext
276 TabPositionAndSizeWriter.Cancel
278 Call gMouseClick(80,80)
281 Call wZeichenobjektEinfuegen("ELLIPSE", 40, 40, 60, 70, false)
283 Call gMouseClick(50,50)
285 Call fPositionAndSize("TabPositionAndSizeWriter")
286 sPositionX2 = Horizontalby.Gettext
287 sPositionY2 = Verticalby.Gettext
288 TabPositionAndSizeWriter.Cancel
290 Call gMouseClick(80,80)
292 Call wObjektSelektieren ( 28, 28, 70, 80 )
297 PrintLog "- Format/Group/Enter Group."
301 PrintLog "- Set the focus to ellipse, and move it."
302 Call gMouseClick(50,50)
304 Call wTypeKeys "<Right>",2
306 PrintLog "- Set the focus to rectangle , check if it is moved (Should NOT)"
307 Call gMouseClick(35,35)
308 Call fPositionAndSize("TabPositionAndSizeWriter")
309 if Horizontalby.Gettext <> sPositionX1 then Warnlog "Rectangle should NOT be moved: X Not -> "+sPositionX1+" but -> "+ Horizontalby.Gettext
310 if Verticalby.Gettext <> sPositionY1 then Warnlog "Rectangle should NOT be moved: Y Not -> "+sPositionY1+" but -> "+ Verticalby.Gettext
311 TabPositionAndSizeWriter.Cancel
313 PrintLog "- Set the focus to ellipse , check if it is moved (Should)"
314 Call wTypeKeys "<TAB>"
315 Call fPositionAndSize("TabPositionAndSizeWriter")
316 if Horizontalby.Gettext = sPositionX2 then Warnlog "ellipse should be moved"
317 if Verticalby.Gettext = sPositionY2 then Warnlog "ellipse should be moved"
318 TabPositionAndSizeWriter.Cancel
324 '-------------------------------------------------------------------------
328 Dim sPositionX1 as String
329 Dim sPositionY1 as String
330 Dim sPositionX2 as String
331 Dim sPositionY2 as String
333 PrintLog "- Edit object group via context menu Group/Enter Group"
337 PrintLog "- Insert 2 drawing objects (rectangle and ellipse) , generate a group."
338 Call wZeichenobjektEinfuegen("RECHTECK", 32, 32, 50, 65, false)
340 Call gMouseClick(40,40)
342 Call fPositionAndSize("TabPositionAndSizeWriter")
343 sPositionX1 = Horizontalby.Gettext
344 sPositionY1 = Verticalby.Gettext
345 TabPositionAndSizeWriter.Cancel
347 Call gMouseClick(80,80)
350 Call wZeichenobjektEinfuegen("ELLIPSE", 40, 40, 60, 70, false)
352 Call gMouseClick(50,50)
353 Call fPositionAndSize("TabPositionAndSizeWriter")
354 sPositionX2 = Horizontalby.Gettext
355 sPositionY2 = Verticalby.Gettext
356 TabPositionAndSizeWriter.Cancel
358 Call gMouseClick(80,80)
360 Call wObjektSelektieren ( 28, 28, 70, 80 )
365 PrintLog "- Context menu Group/Enter Group."
366 Call wOpenContextMenu
367 Call hMenuSelectNr(12)
369 Call hMenuSelectNr(2)
372 PrintLog "- Set the focus to ellipse , and move it."
373 Call gMouseClick(50,50)
375 Call wTypeKeys "<Right>",2
377 PrintLog "- Set the focus to rectangle , check if it is moved (Should NOT)."
378 Call gMouseClick(40,40)
379 Call fPositionAndSize("TabPositionAndSizeWriter")
380 if Horizontalby.Gettext <> sPositionX1 then Warnlog "Rectangle should NOT be moved: X Not -> "+sPositionX1+" but -> "+ Horizontalby.Gettext
381 if Verticalby.Gettext <> sPositionY1 then Warnlog "Rectangle should NOT be moved: Y Not -> "+sPositionY1+" but -> "+ Verticalby.Gettext
382 TabPositionAndSizeWriter.Cancel
384 PrintLog "- Set the focus to ellipse , check if it is moved (Should)."
385 Call wTypeKeys "<TAB>"
386 Call fPositionAndSize("TabPositionAndSizeWriter")
387 if Horizontalby.Gettext = sPositionX2 then Warnlog "ellipse should be moved"
388 if Verticalby.Gettext = sPositionY2 then Warnlog "ellipse should be moved"
389 TabPositionAndSizeWriter.Cancel
395 '-------------------------------------------------------------------------
399 Dim sPositionX as String
400 Dim sPositionY as String
402 PrintLog "- Leave object group via Menu Format/Group/Exit Group"
406 PrintLog "- Insert 2 drawing objects (rectangle and ellipse) , generate a group."
407 Call wZeichenobjektEinfuegen("RECHTECK", 32, 32, 50, 65, false)
409 Call gMouseClick(34,34)
411 Call fPositionAndSize("TabPositionAndSizeWriter")
412 sPositionX = Horizontalby.Gettext
413 sPositionY = Verticalby.Gettext
414 TabPositionAndSizeWriter.Cancel
416 Call gMouseClick(80,80)
417 Call wZeichenobjektEinfuegen("ELLIPSE", 40, 45, 60, 70, false)
419 Call wObjektSelektieren ( 28, 28, 70, 80 )
425 PrintLog "- Format/Group/Edit Group."
429 PrintLog "- Leave group via Format/Group/Exit Group."
430 FormatGroupExitGroup 'after this group , the focus should be on the group
433 PrintLog "- Set the focus to ellipse(in fact, the focus is on the group), and move it."
434 Call gMouseClick(50,50)
436 Kontext "DocumentWriter"
437 Call wTypeKeys "<Right>",2
438 Call wTypeKeys "<Down>"
440 PrintLog "- Set the focus to rectangle (in fact, the focus is still on the group) ,"
441 PrintLog "- check if it is moved . Group is moved , Rectangle is moved ..."
442 Call gMouseClick(45,45)
443 Call fPositionAndSize("TabPositionAndSizeWriter")
444 if Horizontalby.Gettext = sPositionX then Warnlog "Rectangle X should be moved!"
445 if Verticalby.Gettext = sPositionY then Warnlog "Rectangle Y should be moved!"
446 TabPositionAndSizeWriter.Cancel
452 '-------------------------------------------------------------------------
456 Dim sPositionX as String
457 Dim sPositionY as String
459 PrintLog "- Leave object group via context Menu Format/Group/Exit Group"
463 PrintLog "- Insert 2 drawing objects (rectangle and ellipse) , generate a group."
464 Call wZeichenobjektEinfuegen("RECHTECK", 32, 32, 50, 65, false)
466 Call gMouseClick(35,35)
468 Call fPositionAndSize("TabPositionAndSizeWriter")
469 sPositionX = Horizontalby.Gettext
470 sPositionY = Verticalby.Gettext
471 TabPositionAndSizeWriter.Cancel
473 Call gMouseClick(80,80)
475 Call wZeichenobjektEinfuegen("ELLIPSE", 40, 45, 60, 70, false)
477 Call wObjektSelektieren ( 28, 28, 70, 80 )
482 PrintLog "- Format/Group/Edit Group."
486 PrintLog "- Leave group via context menu Group/Exit Group."
487 Call gMouseClick(35,50)
489 Call wOpenContextMenu
491 call hMenuSelectNr(12)
493 Call hMenuSelectNr(1) 'after this group , the focus should be on the group
496 PrintLog "- Set the focus to ellipse(in fact, the focus is on the group), and move it."
497 Call gMouseClick(50,50)
498 Kontext "DocumentWriter"
499 Call wTypeKeys "<Right>",2
500 Call wTypeKeys "<Down>"
502 PrintLog "- Set the focus to rectangle (in fact, the focus is still on the group) ,"
503 PrintLog "- check if it is moved . Group is moved , Rectangle is moved ..."
504 Call gMouseClick(45,45)
505 Call fPositionAndSize("TabPositionAndSizeWriter")
506 if Horizontalby.Gettext = sPositionX then Warnlog "Rectangle X should be moved!"
507 if Verticalby.Gettext = sPositionY then Warnlog "Rectangle Y should be moved!"
508 TabPositionAndSizeWriter.Cancel
514 '-------------------------------------------------------------------------
518 PrintLog "- create new objects inside the group ,"
519 PrintLog " Undo new created objects before leaving the group"
523 PrintLog "- Insert 2 drawing objects (rectangle and ellipse) , generate a group "
524 Call wZeichenobjektEinfuegen("RECHTECK", 32, 32, 50, 35, false)
526 Call wZeichenobjektEinfuegen("ELLIPSE", 40, 60, 50, 80, false)
528 Call wObjektSelektieren ( 30, 30, 55, 85 )
534 PrintLog "- insert another object (rectangle) in the group"
535 Call wZeichenobjektEinfuegen("RECHTECK", 35, 40, 45, 55)
538 PrintLog "- Format/Group/Edit Group."
539 Call gMouseClick(32,32)
544 PrintLog "- Undo new created object( rectangle) before leaving the group."
548 Call gMouseClick(35,40) 'set focus in the rectangle , in fact, the rectangle should be undone now.
551 Call fPositionAndSize("TabPositionAndSizeWriter")
552 TabPositionAndSizeWriter.Cancel
553 Warnlog "Undo before leaving the group is FAILED!"
561 '-------------------------------------------------------------------------
565 PrintLog "- create new objects inside the group ,"
566 PrintLog " Undo new created objects after leaving the group"
569 PrintLog "- Insert 2 drawing objects (rectangle and ellipse) , generate a group "
570 Call wZeichenobjektEinfuegen("RECHTECK", 30, 30, 50, 35, false)
572 Call wZeichenobjektEinfuegen("ELLIPSE", 30, 60, 50, 80, false)
574 Call wObjektSelektieren ( 28, 28, 55, 85 )
580 PrintLog "- insert another object (rectangle) in the group"
581 Call wZeichenobjektEinfuegen("RECHTECK", 35, 40, 45, 55, false)
583 PrintLog "- Format/Group/Edit Group"
584 Call gMouseClick(32,32)
589 PrintLog "- Leave the group , Format/Group/Exit Group"
593 PrintLog "- Undo new created object( rectangle) after leaving the group"
597 Call gMouseClick(37,42) 'set focus in the rectangle , in fact, the rectangle should be undone now.
600 Call fPositionAndSize("TabPositionAndSizeWriter")
601 TabPositionAndSizeWriter.Cancel
602 Warnlog "Undo before leaving the group is FAILED!"
610 '-------------------------------------------------------------------------
614 Dim sDocument as String
616 PrintLog "- Edit object group via Menu Format/Group/Edit Group"
618 sDocument = ConvertPath ( gOfficePath +"user\work\tGroup_12.odt")
619 if hFileExists ( sDocument ) then app.kill ( sDocument )
623 PrintLog "- Insert 2 drawing objects (rectangle and ellipse) , generate a group "
624 Call wZeichenobjektEinfuegen("RECHTECK", 32, 32, 50, 65, false)
626 Call wZeichenobjektEinfuegen("ELLIPSE", 40, 45, 60, 70, false)
628 Call wObjektSelektieren ( 30, 30, 70, 80 )
634 PrintLog "- Format/Group/Edit Group"
638 PrintLog "- Save document"
639 Call hFileSaveAsKill(sDocument)
641 PrintLog "- close document"
644 PrintLog "- Open previous saved document "
645 Call hFileOpen (sDocument)
646 Call sMakeReadOnlyDocumentEditable
647 Kontext "DocumentWriter"
648 Call gMouseClick(34,34) 'set focus in the group
650 PrintLog "- try formatGroupEditGroup"
654 Warnlog "It should be in the group mode!"
657 PrintLog "- close document"
662 '-------------------------------------------------------------------------
664 testcase tEncapsulatedGroup_1
666 PrintLog "- Group objects inside the group ,Encapsulated Group"
670 PrintLog "- Insert 2 drawing objects (rectangle and ellipse) , generate a group "
672 Call wZeichenobjektEinfuegen("RECHTECK", 32, 32, 50, 65, false)
674 Call wZeichenobjektEinfuegen("ELLIPSE", 40, 45, 60, 70, false)
676 Call wObjektSelektieren ( 28, 28, 70, 80 )
682 Call gMouseClick(90,90) 'set focus outside of the group
684 PrintLog "- insert 2 drawing objects (rectangle and ellipse) in the group"
685 Call wZeichenobjektEinfuegen("RECHTECK", 35, 40, 38, 45, false)
686 Call wZeichenobjektEinfuegen("ELLIPSE", 52, 40, 78, 45, false)
687 Call wObjektSelektieren ( 28, 38, 80, 48 )
690 PrintLog "- generate a new group"
692 PrintLog "- edit the new group"
694 PrintLog "- leave the new group"
696 PrintLog "- Undo the new group"
699 Warnlog "Something wrong where operating the Encapsulated group!"