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_Several1.inc,v $
11 '* $Revision: 1.1.68.1 $
13 '* last change: $Author: msc $ $Date: 2008/10/07 09:51:29 $
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 Serveral Part 1 - check each control and each property
38 '\***********************************************************************
42 call fSwitchAutopilotOff(true) ' has to run first to switch off the autopilot
44 call tCheckBox ' tested properties: Tristate, Enabled, Label field
45 call tTextBox ' tested properties: Background color, Additional Info, Scrollbars, Password
46 call tFormattedField ' tested properties: Value max, Value min, Formatting
47 call tPushButton ' tested properties: Graphic, Alignment, Default button, Toggle, Take Focus
48 call tOptionButton ' tested properties: Print, Reference value, Default status
49 call tListBox ' tested properties: Line count, Multiselection, List Entries, Default selection
50 call tComboBox ' tested properties: Auto fill, Max text length, Hide selection, Border color
51 call tLabelField ' tested properties: Alignment, Help text
53 call fSwitchAutopilotOff(false)
57 '--------------------------------------------------------------------------------------
58 ' todo: testcase: tTextBox and tLabelFild contain 'multiline' settings, but HelpID disappeared - has to be reworked
59 '--------------------------------------------------------------------------------------
63 '/// Open a new document,
64 printlog "Open a new document,"
66 Kontext "DocumentWriter"
67 DocumentWriter.TypeKeys "tt_doc" , true
70 Kontext "FormControls"
71 addControl("Label", 40, 30, 50, 40)
72 addControl("CheckBox", 55, 30, 65, 40 )
74 call fOpenControlPropertyBrowser
76 Kontext "ControlPropertiesTabControl"
77 ControlPropertiesTabControl.setPage TabGeneralControl 'make shure that tabpage general in property is choosen
79 '/// set properties: Label - therefore needed: a present label field
80 printlog "set properties: Label - therefore needed: a present label field"
81 Kontext "TabGeneralControl"
82 LabelFieldButton.Click
84 Kontext "LabelFieldSelection"
85 LabelFieldSelection.TypeKeys "<DOWN>",TRUE
86 LabelFieldSelection.TypeKeys "<DOWN>",TRUE
88 LabelFieldSelection.OK
90 '/// set properties: Tristate, Enabled
91 call fSetControlProperty("CheckBox","TriState","2")
93 call fSetControlProperty("CheckBox","Enabled","1") 'listbox property: no
95 '/// close control property browser
96 Kontext "ControlPropertiesDialog"
97 ControlPropertiesDialog.close
99 '/// save the document
100 printlog "save the document"
101 hFileSaveAsKill ( gOfficePath + ConvertPath("user/work/TT_CheckBox.odt"))
104 '/// reload the document
105 printlog "reload the document"
106 hFileOpen ( gOfficePath + ConvertPath("user/work/TT_CheckBox.odt"))
108 call fSwitchControlDesignMode()
110 Kontext "DocumentWriter"
111 DocumentWriter.TypeKeys "<SHIFT F4>"
113 DocumentWriter.TypeKeys "<TAB>" ' select the second control
116 call fOpenControlPropertyBrowser
118 '/// check if the values are saved
119 printlog "check if the values are saved"
121 Kontext "TabGeneralControl"
122 TabGeneralControl.TypeKeys "<TAB>" , true ' this tab is importent, I don't not why but it is.
125 if fGetControlProperty("CheckBox","TriState") <> "2" then
126 warnlog "the value 'tristate' is not saved correctly"
129 if fGetControlProperty("CheckBox","Enabled") <> "1" then
130 warnlog "the value 'enabled' is not saved correctly"
133 printlog "property character set text: " & LabelField.getText
134 if LabelField.getText = "" then
135 warnlog "the value 'label' is not saved correctly"
138 call closePropertyBrowserAndDocument()
141 '--------------------------------------------------------------------------------------
145 '/// Open a new document,
146 printlog "Open a new document,"
148 Kontext "DocumentWriter"
149 DocumentWriter.TypeKeys "tt_doc" , true
152 Kontext "FormControls"
153 addControl("Edit", 40, 40, 30, 30)
155 call fOpenControlPropertyBrowser
157 Kontext "ControlPropertiesTabControl"
158 ControlPropertiesTabControl.setPage TabGeneralControl 'make shure that tabpage general in property is choosen
160 '/// set properties: Background color, Additional Info, Scrollbars, Password
161 printlog "set properties"
162 call fSetControlProperty("TextBox","Background","92")
163 call fSetControlProperty("TextBox","AdditionalInfo","my only friend the end.")
164 call fSetControlProperty("TextBox","TextType","2") 'needed for activate scrollbar
165 call fSetControlProperty("TextBox","Scrollbars","4")
166 call fSetControlProperty("TextBox","TextType","1") 'needed for activate password
167 call fSetControlProperty("TextBox","Password","p")
168 '/// close control property browser
169 Kontext "ControlPropertiesDialog"
170 ControlPropertiesDialog.close
171 '/// save the document
172 printlog "save the document"
173 hFileSaveAsKill ( gOfficePath + ConvertPath("user/work/TT_TextBox.odt"))
176 '/// reload the document
177 printlog "reload the document"
178 hFileOpen ( gOfficePath + ConvertPath("user/work/TT_TextBox.odt"))
180 call fSwitchControlDesignMode()
182 Kontext "DocumentWriter"
183 DocumentWriter.TypeKeys "<SHIFT F4>"
186 call fOpenControlPropertyBrowser
188 '/// check if the values are saved
189 printlog "check if the values are saved"
191 Kontext "TabGeneralControl"
192 TabGeneralControl.TypeKeys "<TAB>" , true ' this tab is importent, I don't not why but it is.
194 if fGetControlProperty("TextBox","Background") <> "92" then
195 warnlog "the value: background is not saved"
198 if fGetControlProperty("TextBox","AdditionalInfo") <> "my only friend the end." then
199 warnlog "the AdditionalInfo value is not saved"
201 call fSetControlProperty("TextBox","TextType","2") 'needed for activate scrollbar
203 if fGetControlProperty("TextBox","Scrollbars") <> "4" then
204 warnlog "the value: Scrollbars are not saved"
206 call fSetControlProperty("TextBox","TextType","1") 'needed for activate password
208 if fGetControlProperty("TextBox","Password") <> "p" then
209 warnlog "the value: Password is not saved"
212 call closePropertyBrowserAndDocument()
215 '--------------------------------------------------------------------------------------
217 testcase tFormattedField
219 '/// Open a new document,
220 printlog "Open a new document,"
222 Kontext "DocumentWriter"
223 DocumentWriter.TypeKeys "tt_doc" , true
226 Kontext "FormControls"
227 addControl("FormattedField", 50, 20, 60, 30)
229 call fOpenControlPropertyBrowser
231 Kontext "ControlPropertiesTabControl"
232 ControlPropertiesTabControl.setPage TabGeneralControl 'make shure that tabpage general in property is choosen
234 '/// set ValueMin to 2 and ValueMax to 9 and any Formatting
235 printlog "set ValueMin to 2 and ValueMax to 9 and any Formatting"
236 Kontext "TabGeneralControl" 'set any formatting
237 FormatkeyButton.Click
239 TabZahlen.TypeKeys "<DOWN>", true
240 TabZahlen.TypeKeys "<RETURN>", true
242 fsetControlProperty("FormattedField","ValueMax","9")
244 fsetControlProperty("FormattedField","ValueMin","2")
245 '/// close control property browser
246 Kontext "ControlPropertiesDialog"
247 ControlPropertiesDialog.close
248 '/// save the document
249 printlog "save the document"
250 hFileSaveAsKill ( gOfficePath + ConvertPath("user/work/TT_FormattedField.odt"))
253 '/// reload the document
254 printlog "reload the document"
255 hFileOpen ( gOfficePath + ConvertPath("user/work/TT_FormattedField.odt"))
257 call fSwitchControlDesignMode()
259 Kontext "DocumentWriter"
260 DocumentWriter.TypeKeys "<SHIFT F4>"
263 call fOpenControlPropertyBrowser
265 '/// check if the values are saved
266 printlog "check if the values are saved"
268 Kontext "TabGeneralControl"
269 TabGeneralControl.TypeKeys "<TAB>" , true ' this tab is importent, I don't not why but it is.
270 if fgetControlProperty("FormattedField","ValueMax") = "" then
271 warnlog "the value ValueMax is not saved"
273 if fgetControlProperty("FormattedField","ValueMin") = "" then
274 warnlog "the value ValueMin is not saved"
276 if fgetControlProperty("FormattedField","Formatkey") = "" then
277 warnlog "the value ValueMin is not saved"
280 call closePropertyBrowserAndDocument()
283 '--------------------------------------------------------------------------------------
287 '/// Open a new document,
288 printlog "Open a new document,"
290 Kontext "DocumentWriter"
291 DocumentWriter.TypeKeys "tt_doc" , true
294 Kontext "FormControls"
295 addControl("PushButton", 50, 20, 60, 30)
297 call fOpenControlPropertyBrowser
299 Kontext "ControlPropertiesTabControl"
300 ControlPropertiesTabControl.setPage TabGeneralControl 'make shure that tabpage general in property is choosen
302 '/// set a graphic for this button
303 printlog "set a graphic for this button"
304 Kontext "TabGeneralControl"
305 call fSetControlProperty("PushButton","Graphics", gOfficePath + ConvertPath("share/gallery/bullets/blkpearl.gif"))
306 '/// set further properties: default button, toggle, graphics alignment
307 printlog "set further properties"
308 call fSetControlProperty("PushButton","DefaultButton","2") 'listbox property: yes
309 call fSetControlProperty("PushButton","ToggleProp","2") 'listbox property: yes
310 call fSetControlProperty("PushButton","GraphicsAlignment","5")
311 call fSetControlProperty("PushButton","TakeFocus","1")
312 '/// close control property browser
313 Kontext "ControlPropertiesDialog"
314 ControlPropertiesDialog.close
315 '/// save the document
316 printlog "save the document"
317 hFileSaveAsKill ( gOfficePath + ConvertPath("user/work/TT_PushButton.odt"))
320 '/// reload the document
321 printlog "reload the document"
322 hFileOpen ( gOfficePath + ConvertPath("user/work/TT_PushButton.odt"))
323 '/// check if the graphic still displayed
324 printlog "check if the graphic still displayed"
325 call fSwitchControlDesignMode()
327 Kontext "DocumentWriter"
328 DocumentWriter.TypeKeys "<SHIFT F4>"
331 call fOpenControlPropertyBrowser
333 '/// check if everything is saved right
334 printlog "check if everything is saved right"
335 dim bScrOK as boolean 'control variable if all properties are correct
337 dim sGraphics as String 'variable for graphics path
338 'check if the graphic is saved
339 sGraphics = fGetControlProperty("PushButton","Graphics")
340 if Right(sGraphics,12) <> "blkpearl.gif" then
341 warnlog "The graphics file name is not saved"
344 if fGetControlProperty("PushButton","GraphicsAlignment") <> "5" then
345 warnlog "the pushbutton is not saved with property: Graphics Alignment"
348 'check if the default button is saved
349 if fGetControlProperty("PushButton","DefaultButton") <> "2" then
350 warnlog "the pushbutton is not saved with property: Default Button"
353 if fGetControlProperty("PushButton","ToggleProp") <> "2" then
354 warnlog "the pushbutton is not saved with property: Toggle"
357 if fGetControlProperty("PushButton","TakeFocus") <> "1" then
358 warnlog "the pushbutton is not saved with property: Take Focus on click"
362 if bScrOK = true then printlog "Pushbutton was saved correctly"
364 call closePropertyBrowserAndDocument()
367 '--------------------------------------------------------------------------------------
369 testcase tOptionButton
371 '/// Open a new document,
372 printlog "Open a new document,"
374 Kontext "DocumentWriter"
375 DocumentWriter.TypeKeys "tt_doc" , true
378 Kontext "FormControls"
379 addControl("RadioButton", 50, 20, 60, 30)
381 call fOpenControlPropertyBrowser
383 Kontext "ControlPropertiesTabControl"
384 ControlPropertiesTabControl.setPage TabGeneralControl 'make shure that tabpage general in property is choosen
386 '/// set properties: Print, Reference value, Default status
387 printlog "set properties"
388 call fSetControlProperty("Radiobutton","Printable","1") 'listbox property: no
389 call fSetControlProperty("Radiobutton","ReferenceValue","777")
390 call fSetControlProperty("Radiobutton","DefaultState","2") 'listbox property: selected
391 '/// close control property browser
392 Kontext "ControlPropertiesDialog"
393 ControlPropertiesDialog.close
395 '/// save the document
396 printlog "save the document"
397 hFileSaveAsKill ( gOfficePath + ConvertPath("user/work/TT_Optionbutton.odt"))
401 '/// reload the document
402 printlog "reload the document"
403 hFileOpen ( gOfficePath + ConvertPath("user/work/TT_Optionbutton.odt"))
405 call fSwitchControlDesignMode()
407 Kontext "DocumentWriter"
408 DocumentWriter.TypeKeys "<SHIFT F4>"
410 call fOpenControlPropertyBrowser
412 '/// check if property values are inserted
413 printlog "check if property values are inserted"
414 Kontext "TabGeneralControl"
415 dim bScrOK as boolean 'control variable if all properties are correct
417 if fGetControlProperty("Radiobutton","Printable") <> "1" then
418 warnlog "the Optionbutton is not saved with property: Print"
421 if fGetControlProperty("Radiobutton","ReferenceValue") <> "777" then
422 warnlog "the Optionbutton is not saved with property: ReferenceValue"
425 if fGetControlProperty("Radiobutton","DefaultState") <> "2" then
426 warnlog "the Optionbutton is not saved with property: ReferenceValue"
429 if bScrOK = true then printlog "Optionbutton was saved correctly"
431 call closePropertyBrowserAndDocument()
434 '--------------------------------------------------------------------------------------
438 '/// Open a new document,
439 printlog "Open a new document,"
441 Kontext "DocumentWriter"
442 DocumentWriter.TypeKeys "tt_doc" , true
445 Kontext "FormControls"
446 addControl("ListBox", 50, 20, 60, 30)
448 call fOpenControlPropertyBrowser
450 Kontext "ControlPropertiesTabControl"
451 ControlPropertiesTabControl.setPage TabGeneralControl 'make shure that tabpage general in property is choosen
453 '/// set properties: default selection, line count, list entries, multiselection
454 printlog "set properties"
455 Kontext "TabGeneralControl"
456 'set property: list entries
457 call fSetControlProperty("ListBox","ListEntries","My only friend the end.")
458 'set property: line count
459 call fSetControlProperty("ListBox","DropDown","2") 'needed for activate line count
461 call fSetControlProperty("ListBox","LineCount","10")
463 'set property: multiselection
464 call fSetControlProperty("ListBox","Multiselection","2") 'yes
466 'set property: default selection
467 call fSetControlProperty("ListBox","DefaultSelection2","88")
468 '/// close control property browser
469 Kontext "ControlPropertiesDialog"
470 ControlPropertiesDialog.close
472 '/// save the document
473 printlog "save the document"
474 hFileSaveAsKill ( gOfficePath + ConvertPath("user/work/TT_ListBox.odt"))
478 '/// reload the document
479 printlog "reload the document"
480 hFileOpen ( gOfficePath + ConvertPath("user/work/TT_ListBox.odt"))
482 call fSwitchControlDesignMode()
484 Kontext "DocumentWriter"
485 DocumentWriter.TypeKeys "<SHIFT F4>"
488 call fOpenControlPropertyBrowser
490 '/// check if property values are inserted
491 printlog "check if property values are inserted"
492 Kontext "TabGeneralControl"
493 dim bScrOK as boolean 'control variable if all properties are correct
495 '(special field - cannot be read out)
496 'if fGetControlProperty("ListBox","ListEntries") = "" then
497 'warnlog "the listbox is not saved with property: ListEntries"
500 '(special field - cannot be read out)
501 'if fGetControlProperty("ListBox","DefaultSelection2") = "" then
502 'warnlog "the listbox is not saved with property: DefaultSelection2"
505 if fGetControlProperty("ListBox","LineCount") <> "10" then
506 warnlog "the listbox is not saved with property: LineCount"
509 if fGetControlProperty("ListBox","Multiselection") <> "2" then
510 warnlog "the listbox is not saved with property: Multiselection"
513 if bScrOK = true then printlog "listbox was saved correctly"
515 call closePropertyBrowserAndDocument()
518 '--------------------------------------------------------------------------------------
522 '/// Open a new document,
523 printlog "Open a new document,"
525 Kontext "DocumentWriter"
526 DocumentWriter.TypeKeys "tt_doc" , true
529 Kontext "FormControls"
530 addControl("ComboBox", 50, 20, 60, 30)
532 call fOpenControlPropertyBrowser
534 Kontext "ControlPropertiesTabControl"
535 ControlPropertiesTabControl.setPage TabGeneralControl 'make shure that tabpage general in property is choosen
537 '/// set properties: Auto fill, Max text length, Hide Selection, Border color
538 printlog "set properties"
539 Kontext "TabGeneralControl"
540 call fSetControlProperty("ComboBox","MaxTextLen","6")
541 call fSetControlProperty("ComboBox","AutoComplete","1") 'no
542 call fSetControlProperty("ComboBox","HideSelection","1") 'no
543 call fSetControlProperty("ComboBox","Border","3") 'needed to activate Border Color
544 call fSetControlProperty("ComboBox","BorderColor","13")
545 '/// close control property browser
546 Kontext "ControlPropertiesDialog"
547 ControlPropertiesDialog.close
549 '/// save the document
550 printlog "save the document"
551 hFileSaveAsKill ( gOfficePath + ConvertPath("user/work/TT_ComboBox.odt"))
555 '/// reload the document
556 printlog "reload the document"
557 hFileOpen ( gOfficePath + ConvertPath("user/work/TT_ComboBox.odt"))
559 call fSwitchControlDesignMode()
561 Kontext "DocumentWriter"
562 DocumentWriter.TypeKeys "<SHIFT F4>"
565 call fOpenControlPropertyBrowser
567 '/// check if property values are inserted
568 printlog "check if property values are inserted"
569 Kontext "TabGeneralControl"
570 dim bScrOK as boolean 'control variable if all properties are correct
572 if fGetControlProperty("ComboBox","MaxTextLen") <> "6" then
573 warnlog "the combobox is not saved with property: MaxTextLen"
576 if fGetControlProperty("ComboBox","AutoComplete") <> "1" then
577 warnlog "the combobox is not saved with property: AutoComplete"
580 if fGetControlProperty("ComboBox","HideSelection") <> "1" then
581 warnlog "the combobox is not saved with property: Hide Selection"
584 if fGetControlProperty("ComboBox","BorderColor") <> "13" then
585 warnlog "the combobox is not saved with property: Border Color"
588 if bScrOK = true then printlog "Combobox was saved correctly"
590 call closePropertyBrowserAndDocument()
593 '--------------------------------------------------------------------------------------
597 '/// Open a new document,
598 printlog "Open a new document,"
600 Kontext "DocumentWriter"
601 DocumentWriter.TypeKeys "tt_doc" , true
604 Kontext "FormControls"
605 addControl("Label", 50, 20, 60, 30)
607 call fOpenControlPropertyBrowser
609 Kontext "ControlPropertiesTabControl"
610 ControlPropertiesTabControl.setPage TabGeneralControl 'make shure that tabpage general in property is choosen
612 '/// set properties: alignment, multiline, help text
613 printlog "set properties"
614 call fSetControlProperty("LabelField","Align","4") 'set to right
615 call fSetControlProperty("LabelField","HelpText","Filled in Text")
616 '/// close control property browser
617 Kontext "ControlPropertiesDialog"
618 ControlPropertiesDialog.close
620 '/// save the document
621 printlog "save the document"
622 hFileSaveAsKill ( gOfficePath + ConvertPath("user/work/TT_LabelField.odt"))
626 '/// reload the document
627 printlog "reload the document"
628 hFileOpen ( gOfficePath + ConvertPath("user/work/TT_LabelField.odt"))
630 call fSwitchControlDesignMode()
632 Kontext "DocumentWriter"
633 DocumentWriter.TypeKeys "<SHIFT F4>"
636 call fOpenControlPropertyBrowser
638 '/// check if the values are saved
639 printlog "check if the values are saved"
641 Kontext "TabGeneralControl"
642 TabGeneralControl.TypeKeys "<TAB>" , true ' this tab is importent, I don't not why but it is.
643 if fGetControlProperty("LabelField","Align") <> "4" then
644 warnlog "the value: align is not saved"
646 if fGetControlProperty("LabelField","HelpText") <> "Filled in Text" then
647 warnlog "the value: HelpText is not saved"
650 call closePropertyBrowserAndDocument()