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_Wizards.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 : Control Wizards Test
38 '\***********************************************************************
39 global sDSName as String
40 global sFileName as String
44 printlog "---------------- Control Wizards -------------------"
48 app.FileCopy gTesttoolPath + ConvertPath("dbaccess/optional/input/hsql_datasource/TT_hsqldb.odb"),gOfficePath + ConvertPath("user/work/TT_hsqldb.odb")
49 call fRegisterDatabaseFile(gOfficePath + ConvertPath("user/work/TT_hsqldb.odb"),"TT")
51 call fSwitchAutopilotOff(false) ' has to run first to switch on the autopilot
52 call tGroupBoxWithDatasource
53 call tGroupBoxWithoutDatasource
57 call fDeRegisterDatabaseFile(sDSName)
61 '--------------------------------------------------------------------
63 testcase tGroupBoxWithDatasource
65 '/// open a new text document
66 printlog "open a new text document"
69 '/// create a new form via the form navigator
70 printlog "create a new form via the form navigator"
72 call hToolbarSelect("FORMDESIGN",true)
73 Kontext "FormDesignTools"
77 Kontext "FormularNavigator"
78 Liste.TypeKeys "<SPACE>"
86 Liste.TypeKeys "<RETURN>",true
93 Kontext "ControlPropertiesTabControl"
94 ControlPropertiesTabControl.SetPage TabDataControl
96 '/// set the datasource TT
97 printlog "set the datasource TT"
98 DataSource.setText(sDSName)
99 DataSource.TypeKeys "<RETURN>" , true
100 '/// insert password 'testtool' into login dialog
101 printlog "insert password 'testtool' into login dialog"
102 Kontext "LoginDialog"
103 if LoginDialog.Exists then
104 Password.setText "testtool"
108 printlog "Login dialog doesn't exists. Why?"
110 Kontext "LoginDialog"
111 if LoginDialog.Exists then
112 Password.setText "testtool"
116 printlog "Login dialog doesn't exists. Why?"
118 Kontext "TabDataForm"
119 '/// set the table TT_Control
120 printlog "set the table TT_Control"
121 Content.setText("TT_Control")
122 Content.TypeKeys "<RETURN>" , true
123 Kontext "ControlPropertiesDialog"
124 ControlPropertiesDialog.Close
126 Kontext "FormularNavigator"
127 FormularNavigator.Close
130 call hToolbarSelect("MoreControls",true)
131 Kontext "MoreControls"
132 '/// insert a groupbox (the wizard appears)
133 printlog "insert a groupbox (the wizard appears)"
136 call hDrawingWithSelection ( 50, 20, 60, 30 )
140 Kontext "AutopilotGroupElement"
141 AutopilotGroupElement.MouseDown (10,10)
142 AutopilotGroupElement.MouseUp (10,10)
143 '/// insert three fields with the names: red, green, blue & next
144 printlog "insert three fields with the names: red, green, blue & next"
145 Kontext "TabGroupBoxData"
149 Names.setText "green"
155 Kontext "AutopilotGroupElement"
156 if NextButton.IsEnabled then
159 warnlog "In first window the 'Next'-button is disabled!"
160 AutopilotGroupElement.Cancel
163 printlog " - Autopilot group box: Page 2/5"
164 Kontext "TabDefaultFieldSelection"
165 '/// choose no default and click two times next
166 printlog "choose no default and click two times next"
168 Kontext "AutopilotGroupElement"
169 if NextButton.IsEnabled then
172 warnlog "In second window the 'Next'-button is disabled!!"
173 AutopilotGroupElement.Cancel
177 printlog " - Autopilot group box: Page 3/5"
178 Kontext "TabDatabaseValues"
180 Kontext "AutopilotGroupElement"
181 if NextButton.IsEnabled then
184 warnlog "In third window the 'Next'-button is disabled!"
185 AutopilotGroupElement.Cancel
188 printlog " - Autopilot group box: Page 4/5"
189 '/// choose the database field Colors
190 printlog "choose the database field Colors"
191 'Kontext "TabDatabaseValues"
192 Kontext "TabDatabaseField" ' dbp:TabPage:RID_PAGE_OPTION_DBFIELD
195 Kontext "AutopilotGroupElement"
196 if NextButton.IsEnabled then
199 warnlog "In fourth window the 'Next'-button is disabled!"
200 AutopilotGroupElement.Cancel
204 printlog " - Autopilot group box: Page 5/5"
205 Kontext "TabCreateOptionGroup"
207 Kontext "AutopilotGroupElement"
208 if CreateButton.IsEnabled then
211 warnlog "In fifth window the 'Create'-button is disabled!"
212 AutopilotGroupElement.Cancel
218 call hToolbarSelect("FORMDESIGN",true)
219 Kontext "FormDesignTools"
223 Kontext "FormularNavigator"
225 'Liste.TypeKeys "<DOWN>" , true
227 Liste.TypeKeys "<HOME>" , true
229 Liste.TypeKeys "<DOWN>" , true
231 Liste.TypeKeys "<DOWN>" , true
233 Liste.TypeKeys "<DOWN>" , true
235 Liste.OpenContextmenu
240 Kontext "ControlPropertiesTabControl"
241 ControlPropertiesTabControl.setPage TabGeneralControl
243 Kontext "TabGeneralControl"
244 TabGeneralControl.TypeKeys "<TAB>" , true 'this tab is importent, I don't not why but it is.
246 HelpURL.setText "HID:123456"
247 HelpURL.TypeKeys "<RETURN>",true
249 Kontext "ControlPropertiesDialog"
250 ControlPropertiesDialog.close
252 'open and close the formnavigator to get the focus
253 call hToolbarSelect("FORMDESIGN",true)
254 Kontext "FormDesignTools"
258 Kontext "FormDesignTools"
262 Kontext "FormularNavigator"
263 'Liste.TypeKeys "<DOWN>" , true ' this is needed , I don't know why
265 Liste.TypeKeys "<HOME>" , true
267 Liste.TypeKeys "<DOWN>" , true
269 Liste.TypeKeys "<DOWN>" , true
271 Liste.TypeKeys "<DOWN>" , true
273 Liste.TypeKeys "<DOWN>" , true
275 Liste.OpenContextmenu
280 Kontext "TabGeneralControl"
281 TabGeneralControl.TypeKeys "<TAB>" , true 'this tab is importent, I don't not why but it is.
283 HelpURL.setText "HID:1234567"
284 HelpURL.TypeKeys "<RETURN>", true
286 Kontext "ControlPropertiesDialog"
287 ControlPropertiesDialog.close
289 'open and close the frmnavigator to get the focus
290 call hToolbarSelect("FORMDESIGN",true)
291 Kontext "FormDesignTools"
295 Kontext "FormDesignTools"
299 Kontext "FormularNavigator"
300 'Liste.TypeKeys "<DOWN>" , true ' this is needed , I don't know why
302 Liste.TypeKeys "<HOME>" , true
304 Liste.TypeKeys "<DOWN>" , true
306 Liste.TypeKeys "<DOWN>" , true
308 Liste.TypeKeys "<DOWN>" , true
310 Liste.TypeKeys "<DOWN>" , true
312 Liste.TypeKeys "<DOWN>" , true
314 Liste.OpenContextmenu
319 Kontext "TabGeneralControl"
320 TabGeneralControl.TypeKeys "<TAB>" , true ' this tab is importent, I don't not why but it is.
321 HelpURL.setText "HID:12345678"
322 HelpURL.TypeKeys "<RETURN>", true
324 Kontext "ControlPropertiesDialog"
325 ControlPropertiesDialog.close
327 '/// save the document
328 printlog "save the document"
329 hFileSaveAsKill ( gOfficePath + ConvertPath("user/work/TT_AP_GroupBox.odt"))
333 '/// reload the document
334 printlog "reload the document"
335 hFileOpen ( gOfficePath + ConvertPath("user/work/TT_AP_GroupBox.odt"))
337 '/// check if the options buttons work right
338 printlog "check if the options buttons work right"
344 Kontext "MSC_Special_Dialog"
345 a = MSC_Special_Dialog.ischecked
346 Kontext "MSC_Special_Dialog2"
347 b = MSC_Special_Dialog2.ischecked
348 Kontext "MSC_Special_Dialog3"
349 c = MSC_Special_Dialog3.ischecked
351 if not a AND not b AND c then
354 warnlog "the third option isn't checked"
357 printlog "next record"
360 Kontext "MSC_Special_Dialog"
361 a = MSC_Special_Dialog.ischecked
362 Kontext "MSC_Special_Dialog2"
363 b = MSC_Special_Dialog2.ischecked
364 Kontext "MSC_Special_Dialog3"
365 c = MSC_Special_Dialog3.ischecked
367 if not a AND b AND not c then
370 warnlog "the second option isn't checked"
373 printlog "next record"
376 Kontext "MSC_Special_Dialog"
377 a = MSC_Special_Dialog.ischecked
378 Kontext "MSC_Special_Dialog2"
379 b = MSC_Special_Dialog2.ischecked
380 Kontext "MSC_Special_Dialog3"
381 c = MSC_Special_Dialog3.ischecked
383 if a AND not b AND not c then
386 warnlog "the first option isn't checked"
392 '--------------------------------------------------------------------
394 testcase tGroupBoxWithoutDatasource
396 '/// open a textdocument
397 printlog "open a textdocument"
402 call hToolbarSelect("MoreControls",true)
404 Kontext "MoreControls"
405 '/// insert a groupbox (the wizard appears)
406 printlog "insert a groupbox (the wizard appears)"
408 call hDrawingWithSelection ( 50, 20, 60, 30 )
411 Kontext "AutopilotGroupElement"
412 AutopilotGroupElement.MouseDown (10,10)
413 AutopilotGroupElement.MouseUp (10,10)
415 if AutopilotGroupElement.Exists(3) then
416 printlog " - Autopilot group element: Page 1/4"
417 '/// insert 6 diffent options
418 printlog "insert 6 diffent options"
419 Kontext "TabGroupBoxData"
421 Names.Settext "Option field " + i
422 if AddTo.IsEnabled then
425 warnlog "Entry couldn't be overtaken in first window of the group box autopilot!"
426 AutopilotGroupElement.Cancel
429 Kontext "AutopilotGroupElement"
430 if NextButton.IsEnabled then
433 warnlog "In first window the 'Next'-button is disabled!"
434 AutopilotGroupElement.Cancel
437 printlog " - Autopilot group box: Page 2/4"
438 Kontext "TabDefaultFieldSelection"
440 '/// set Option Field 3 as default selection
441 printlog "set Option Field 3 as default selection"
443 Selection.Select "Option field 3"
444 Kontext "AutopilotGroupElement"
445 if NextButton.IsEnabled then
448 warnlog "In second window the 'Next'-button is disabled!!"
449 AutopilotGroupElement.Cancel
452 printlog " - Autopilot group box: Page 3/4"
453 Kontext "TabDatabaseValues"
454 dim iCountOptionFields
455 iCountOptionFields = OptionFields.getitemCount
456 if iCountOptionFields <> 6 then
457 warnlog "there are not 6 options."
458 AutopilotGroupElement.Cancel
461 '/// set some new reference for the options fields
462 printlog "set some new reference for the options fields"
463 OptionFields.select 1
464 WhichValue.setText "a"
465 OptionFields.select 2
466 WhichValue.setText "b"
467 OptionFields.select 3
468 WhichValue.setText "c"
469 OptionFields.select 4
470 WhichValue.setText "d"
471 OptionFields.select 5
472 WhichValue.setText "e"
473 OptionFields.select 6
474 WhichValue.setText "f"
476 Kontext "AutopilotGroupElement"
477 if NextButton.IsEnabled then
480 warnlog "In third window the 'Next'-button is disabled!"
481 AutopilotGroupElement.Cancel
485 printlog " - Autopilot group box: Page 4/4"
486 '/// change the goup name to Group 123
487 printlog "change the goup name to Group 123"
488 Kontext "TabCreateOptionGroup"
489 GroupCaption.setText "Group 123"
490 Kontext "AutopilotGroupElement"
491 if CreateButton.IsEnabled then
494 warnlog "In fourth window the 'Create'-button is disabled!"
495 AutopilotGroupElement.Cancel
498 warnlog "- Autopilot for Group Box didn't appear!"
502 '/// save the document
503 hFileSaveAsKill ( gOfficePath + ConvertPath("user/work/TT_AP_GroupBox2.odt"))
507 '/// reload the document
508 printlog "reload the document"
509 hFileOpen ( gOfficePath + ConvertPath("user/work/TT_AP_GroupBox2.odt"))
511 call hToolbarSelect("FormControls",true)
514 Kontext "FormControls"
515 SwitchControlDesignMode.Click
518 call hToolbarSelect("FormDesignTools",true)
519 Kontext "FormDesignTools"
522 Kontext "FormularNavigator"
523 Liste.TypeKeys "<HOME>"
524 Liste.TypeKeys "<DOWN>"
525 Liste.TypeKeys "<DOWN>"
527 Liste.OpenContextmenu
532 printlog "Control property browser already open."
535 Kontext "ControlPropertiesTabControl"
536 ControlPropertiesTabControl.SetPage TabGeneralControl
538 Kontext "TabGeneralControl"
539 if Label.getText() <> "Group 123" then
540 warnlog "The label of the groupbox is not right." + getClipboard
543 Kontext "FormularNavigator"
544 Liste.TypeKeys "<DOWN>"
547 if fgetControlproperty("RadioButton","DefaultState") <> "1" then
548 warnlog "The default state is set to not selected"
552 Kontext "FormularNavigator"
553 Liste.TypeKeys "<DOWN>"
554 Liste.TypeKeys "<DOWN>"
557 if fgetControlproperty("RadioButton","DefaultState") <> "2" then
558 warnlog "The default state is set to not selected"
561 if fgetControlproperty("RadioButton","ReferenceValue") <> "c" then
562 warnlog "The reference value is not right, it have to be c but it is " + ReferenceValue.getText
568 '--------------------------------------------------------------------
575 printlog "- Formular toolbox: List box element (" & gApplication & ")"
576 '/// open a text, insert a listbox (the wizard appears)
580 call hToolbarSelect("FormControls",true)
582 Kontext "FormControls"
584 call hDrawingWithSelection ( 50, 20, 60, 30 )
586 Kontext "AutoPilotListComboBox"
587 AutoPilotListComboBox.MouseDown(10,10)
588 AutoPilotListComboBox.MouseUp(10,10)
590 if AutoPilotListComboBox.Exists(1) then
591 printlog " - Autopilot List/Combo Box: Page 1/4"
592 Kontext "TabListBoxData"
593 '/// choose database TT & click next
594 DataSource.Select(sDSName)
595 Kontext "LoginDialog"
596 if LoginDialog.Exists(3) then
597 printlog "login dialog"
598 Password.SetText "testtool"
602 '/// choose table TPCoA-1 & click next
603 Kontext "TabListBoxData"
604 Table.Select("TT_Control")
606 Kontext "AutopilotListComboBox"
607 if NextButton.IsEnabled then
610 warnlog "In first window the 'Next'-button is disabled!"
611 AutopilotListComboBox.Cancel
614 printlog " - Autopilot List/Combo Box: Page 2/4"
615 Kontext "TabTableSelection"
616 TableSelection.Select("TT_Control")
618 Kontext "AutopilotListComboBox"
619 if NextButton.IsEnabled then
622 warnlog "In second window the 'Next'-button is disabled!!"
623 AutopilotListComboBox.Cancel
627 printlog " - Autopilot List/Combo Box: Page 3/4"
628 Kontext "TabFieldSelection"
629 '/// choose InfoColor as displayed field & click next
630 ExistingFields.Select("InfoColor")
632 Kontext "AutopilotListComboBox"
633 if NextButton.IsEnabled then
636 warnlog "In third window the 'Next'-button is disabled!"
637 AutopilotListComboBox.Cancel
640 printlog " - Autopilot List/Combo Box: Page 4/4"
641 Kontext "TabFieldLink"
642 '/// take Colors as value field, ID as list field & click create
643 ValueTable.Select("Colors")
645 ListTable.Select("ID")
647 Kontext "AutopilotListComboBox"
648 if CreateButton.IsEnabled then
651 warnlog "In fourth window the 'Create'-button is disabled!"
652 AutopilotListComboBox.Cancel
655 warnlog "The Autopilot doesn't start!"
659 Kontext "FormControls"
660 ControlProperties.Click
662 '/// check if the list box is in dropdown style
663 if fGetControlProperty("ListBox","DropDown") <> "2" then
664 warnlog "The dropdown style is not active."
667 fSetControlProperty("ListBox","HelpURL","HID:123456")
669 '/// save the document
670 printlog "save the document"
671 hFileSaveAsKill ( gOfficePath + ConvertPath("user/work/TT_AP_ListBox.odt"))
674 '/// reload the document
675 printlog "reload the document"
676 hFileOpen ( gOfficePath + ConvertPath("user/work/TT_AP_ListBox.odt"))
678 '/// open the listbox, and ccheck the list entries
679 Kontext "MSC_Special_Dialog"
681 ii = MSC_Special_Dialog.GetItemCount
684 MSC_Special_Dialog.Select (i)
686 sText = MSC_Special_Dialog.GetSelText
690 warnlog "The 1. entry is not empty"
693 if sText <> "red = 1" then
694 warnlog "The 2. entry is not red = 1"
697 if sText <> "green = 2" then
698 warnlog "The 3. entry is not green = 2"
701 if sText <> "blue = 3" then
702 warnlog "The 4. entry is not blue = 3"
711 '--------------------------------------------------------------------
716 printlog "- Formular toolbox: List box element (" & gApplication & ")"
717 '/// open new text document
721 call hToolbarSelect("FormControls",true)
723 '/// insert a new combo box
724 Kontext "FormControls"
726 call hDrawingWithSelection ( 50, 20, 60, 30 )
729 Kontext "AutoPilotListComboBox"
730 AutoPilotListComboBox.MouseDown (10,10)
731 AutoPilotListComboBox.MouseUp (10,10)
732 if AutoPilotListComboBox.Exists(3) then
733 printlog " - Autopilot List/Combo Box: Page 1/4"
734 Kontext "TabListBoxData"
735 DataSource.Select(sDSName)
736 Table.Select("TT_Control")
737 Kontext "AutopilotListComboBox"
738 if NextButton.IsEnabled then
741 warnlog "In first window the 'Next'-button is disabled!"
742 AutopilotListComboBox.Cancel
746 printlog " - Autopilot List/Combo Box: Page 2/4"
747 Kontext "TabTableSelection"
748 TableSelection.Select("TT_Control")
750 Kontext "AutopilotListComboBox"
751 if NextButton.IsEnabled then
754 warnlog "In second window the 'Next'-button is disabled!!"
755 AutopilotListComboBox.Cancel
759 printlog " - Autopilot List/Combo Box: Page 3/4"
760 Kontext "TabFieldSelection"
761 ExistingFields.Select(1)
763 Kontext "AutopilotListComboBox"
764 if NextButton.IsEnabled then
767 warnlog "In third window the 'Next'-button is disabled!"
768 AutopilotListComboBox.Cancel
772 printlog " - Autopilot List/Combo Box: Page 4/4"
773 Kontext "TabDatabaseField"
775 Kontext "AutopilotListComboBox"
776 if CreateButton.IsEnabled then
779 warnlog "In fourth window the 'Create'-button is disabled!"
780 AutopilotListComboBox.Cancel
784 warnlog "- Autopilot for Combo Box didn't appear!"
791 '--------------------------------------------------------------------
793 testcase tTableControl
795 printlog "- Formular toolbox: Tablecontrol element (" & gApplication & ")"
796 '/// open a new textdocument & insert a table control
800 call hToolbarSelect("MoreControls",true)
802 Kontext "MoreControls"
804 call hDrawingWithSelection ( 40, 20, 60, 40 )
806 '/// take as datasource table biblio, mark it & next
807 '/// select some fields (in both directions) & create
808 '/// switch off the design view & open the database beamer (TODO)
809 '/// compare the header & the contents with the table control (TODO)
811 Kontext "AutopilotTableElement"
812 AutopilotTableElement.MouseDown (10,10)
813 AutopilotTableElement.MouseUp (10,10)
814 if AutopilotTableElement.Exists(3) then
815 printlog " - Autopilot Table Element: Page 1/2"
816 Kontext "TabListBoxData"
817 DataSource.Select(sDSName)
819 Kontext "LoginDialog"
820 if LoginDialog.Exists(3) then
821 printlog "login dialog"
822 Password.SetText "testtool"
827 Kontext "TabListBoxData"
828 Table.Select("TT_Control")
830 Kontext "AutopilotTableElement"
831 if NextButton.IsEnabled then
834 warnlog "In first window the 'Next'-button is disabled!"
835 AutopilotTableElement.Cancel
838 printlog " - Autopilot Table Element: Page 2/2"
839 Kontext "TabTableFieldSelection"
840 ExistingFields.Select("ID")
842 ExistingFields.Select("Colors")
844 ExistingFields.Select("InfoColor")
847 Kontext "AutopilotTableElement"
848 if CreateButton.IsEnabled then
851 warnlog "In fourth window the 'Create'-button is disabled!"
852 AutopilotTableElement.Cancel
855 warnlog "- Autopilot for Table Element didn't appear!"
863 '-------------------------------------------------------------------------