summaryrefslogtreecommitdiff
path: root/testautomation/global/tools/includes/optional/t_set_standard_controls.inc
blob: 8384edcc27d15440bc6a16052790ca2e4b13ac74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
'encoding UTF-8  Do not remove or change this line!
'**************************************************************************
' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
'
' Copyright 2000, 2010 Oracle and/or its affiliates.
'
' OpenOffice.org - a multi-platform office productivity suite
'
' This file is part of OpenOffice.org.
'
' OpenOffice.org is free software: you can redistribute it and/or modify
' it under the terms of the GNU Lesser General Public License version 3
' only, as published by the Free Software Foundation.
'
' OpenOffice.org is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
' GNU Lesser General Public License version 3 for more details
' (a copy is included in the LICENSE file that accompanied this code).
'
' You should have received a copy of the GNU Lesser General Public License
' version 3 along with OpenOffice.org.  If not, see
' <http://www.openoffice.org/license.html>
' for a copy of the LGPLv3 License.
'
'/************************************************************************
'*
'* owner : helge.delfs@oracle.com
'*
'* short description : Tool library for setting controls and verifying the functionality
'*
'**************************************************************************************************
'*
' #0 fSetListBoxByItem              'Function to select item in list box
' #0 fSetListBoxByString            'Function to select item by string in list box
' #0 fSetSpinFieldByString          'Function to set a string in a spin field control
' #0 fSetSpinFieldByButton          'Function to set a spin field control by using 'more' or 'less' button
' #0 fSetSpinFieldByLimit           'Function to set a spin field control to minimum or maximum value
' #0 fSetComboBoxByItem             'Function to select item in combo box
' #0 fSetComboBoxByString           'Function to select item in combo box
' #0 fSetComboBoxByText             'Function to Edit Field part of a combo box
' #0 fSetCheckBox                   'Function to (un)check a check box
' #0 fSetRadioButton                'Function to check a radio button
' #0 fSetTextBox                    'Function to set a textbox
'*
'\************************************************************************************************

'///<u><b>Library for abtracted handling of several control types</b></u>
'///+Note: This functions are designed to be called by wrapping functions
'///+All functions are designed to return error codes depending on the behaviour of the action applied.
'///<b>Return codes:</b>
'///+<ul><li>Error  0: Success</li>
'///+<li>Error  1: The basic action beeing applied caused a serious problem, e.g. a crash</li>
'///+<li>Error  2 TO  9: A functional problem occured.</li>
'///+<li>Error 11 TO 19: Wrong marginal conditions end up in Failure, e.g. control not visible</li></ul>
'/// NOTE: This errors can also be used for 'negative' testing.
'///+<ul><li>Error 42: Wrong input. Probably only of interest during test development</li>
'///+<li>Error 99: Unexpected behaviour - Shouldn't normally occur</li></ul>
'///<b>ATTENTION:</b>
'///+<ul><li>Only Errors 42 and 99 throw 'warnlogs'</li>
'///+<li>All other errors are silent!</li>
'///+<li>They only throw QAErrorlogs the give a hint what probably went wrong.</li>
'///+<li>Expected Errors MUST exclusivly be handled by the calling routine!</li></ul>
'///+<p><font size=-1><i>The idea and the first implementation of this library has been made by Peter Junge (pj at openoffice.org)</i></font></p> 
'
'
function fSetTextBox ( oThisTextBox as OBJECT , sThisText as STRING ) as INTEGER
         fSetTextBox = 99
'Function to set a text box
'Input: 
'+OBJECT oThisTextBox (text box name in declaration)
'+STRING sThisText (text to be set in text box control)
' Return (Error-codes):
'+0  = Sucess
'+1  = Serious problem trying to set value
'+2  = Value was not set
'+11 = Text box is not visible
'+12 = Text box is not enabled
'+99 = Unexpected error

    dim iIndex as INTEGER
    dim iListLength as INTEGER
    dim sResultInUI as STRING
    
    sResultInUI = ""

    printlog "Setting text in Text Box Edit field"
    ' Check if desired Text box is visible
    if NOT oThisTextBox.IsVisible then
        QAErrorLog "Error 11: Text box is not visible"
        fSetTextBox = 11
        exit function
    endif
    ' Check if desired Text box is enabled
    if NOT oThisTextBox.IsEnabled then
        QAErrorLog "Error 12: Text box is not enabled"
        fSetTextBox = 12
        exit function
    endif
    ' Try to set text on Text Box
    try 
        oThisTextBox.setText sThisText
    catch
        ' Throw error 1 and quit on serious problem
        qaErrorLog "Error 1: Set text on Text box seems to cause a serious problem."
        fSetTextBox = 1
        exit function
    endcatch
    'Verify (against input) if text was set correctly    
    sResultInUI = oThisTextBox.GetText
    if sResultInUI = sThisText then
        fSetTextBox = 0
        printlog "Set '" & sThisText & "' in 'text box' control PASSED."
    else
        QAErrorLog "Error 2: Setting '" & sThisText & "' in 'text box' control failed!"
        fSetTextBox = 2
    endif

    if fSetTextBox = 99 then
        warnlog "Error 99: Something unexpected happened!!"
    endif   
end function
'
'--------------------------------------------------------------------
'
function fSetListBoxByItem ( oThisListBox as OBJECT , iThisValue as INTEGER ) as INTEGER
         fSetListBoxByItem = 99
'Function to select item in list box
'Input: 
'+OBJECT oThisListBox (list box name in declaration)
'+INTEGER iThisValue (item number to be selected in list box control)
'Return (Error-codes):
'+0  = Sucess
'+ 1 = Serious problem trying to set value
'+ 2 = Value was not set
'+11 = List box is not visible
'+12 = List box is not enabled
'+13 = Item number to be selected out of list range
'+99 = Unexpected error

    dim iListLength as INTEGER
    dim iResultFromUI as INTEGER
    
    iResultFromUI = ""
    
    printlog "Setting Item in list box"
    'Check if desired list box is visible
    if NOT oThisListBox.IsVisible then
        QAErrorLog "Error 11: List box is not visible"
        fSetListBoxByItem = 11
        exit function
    endif
    'Check if desired list box is enabled
    if NOT oThisListBox.IsEnabled then
        QAErrorLog "Error 12: List box is not enabled"
        fSetListBoxByItem = 12
        exit function
    endif
    'Check if input value is within list length
    iListLength = oThisListBox.GetItemCount
    if iThisValue < 1 OR iThisValue > iListLength then
        QAErrorLog "Error 13: Item number out of list range"        
        fSetListBoxByItem = 13
        exit function
    endif
    'Try to set value in List Box
    try 
        oThisListBox.select iThisValue
    catch
        'Throw error 1 and quit on serious problem
        QAErrorLog "Error 1: Set value on list box seems to cause a serious problem."
        fSetListBoxByItem = 1
        exit function
    endcatch
    'Verify (against input) if item was set correctly
    iResultFromUI = oThisListBox.GetSelIndex
    if iResultFromUI = iThisValue then
        fSetListBoxByItem = 0
        printlog ">> Set value in list box seems to work"
    else
        QAErrorLog "Error 2: Set value in list box failed."
        fSetListBoxByItem = 2
    endif

    if fSetListBoxByItem = 99 then
        warnlog "Error 99: Something unexpected happened!!"
    endif   
end function
'
'--------------------------------------------------------------------
'
function fSetListBoxByString ( oThisListBox as OBJECT , sThisString as STRING ) as INTEGER
         fSetListBoxByString = 99
'Function to select item by string in list box
'Input: 
'+OBJECT oThisListBox (list box name in declaration)
'+STRING sThisString (string trying to match in list box items)
'Return(E rror-codes):
'+ 0 = Sucess
'+ 1 = Serious problem trying to set value
'+ 2 = Value was not set
'+11 = List box is not visible
'+12 = List box is not enabled
'+13 = String to be selected doesn't exist in list box
'+99 = Unexpected error

    dim iIndex as INTEGER
    dim iListLength as INTEGER
    dim bStringIsInList as BOOLEAN
    dim sUIStringNow as STRING

    bStringIsInList = FALSE
    sUIStringNow = ""

    printlog "** Setting Item in list box"
    'Check if desired list box is visible
    if NOT oThisListBox.IsVisible then
        qaErrorLog "Error 11: List box is not visible"
        fSetListBoxByString = 11
        exit function
    endif
    'Check if desired list box is enabled
    if NOT oThisListBox.IsEnabled then
        qaErrorLog "Error 12: List box is not enabled"
        fSetListBoxByString = 12
        exit function
    endif
    'Check if input value is existent in list entries
    iListLength = oThisListBox.GetItemCount
    for iIndex = 1 to iListLength
        if oThisListBox.GetItemText ( iIndex ) = sThisString then
            bStringIsInList = TRUE
        endif
    next iIndex
    if bStringIsInList then
        printlog "OK, String exists in list box"
    else
        qaErrorLog "Error 13: Input String not found in list entries"
        fSetListBoxByString = 13
        exit function
    endif
    'Try to set value in List Box
    try 
        oThisListBox.select sThisString
    catch
        'Throw error 1 and quit on serious problem
        qaErrorLog "Error 1: Set value on list box seems to cause a serious problem."
        fSetListBoxByString = 1
        exit function
    endcatch
    'Verify (against input) if item was set correctly
    sUIStringNow = oThisListBox.GetSelText
    if sUIStringNow = sThisString then
        fSetListBoxByString = 0
        printlog "Setting value in list box is OK"
    else
        qaErrorLog "Error 2: Set value in list box failed."
        fSetListBoxByString = 2
    endif

    if fSetListBoxByString = 99 then
        warnlog "Error 99: Something unexpected happened!!"
    endif   
end function
'
'--------------------------------------------------------------------
'
function fSetSpinFieldByString ( oThisSpinField as OBJECT , sThisString as STRING ) as INTEGER
         fSetSpinFieldByString = 99
'Function to set a string in a spin field control
'Input: 
'+OBJECT oThisSpinField (spin field name in declaration)
'+STRING sThisString (string to set in spin field control)
'Return (Error codes):
'+ 0 = Sucess
'+ 1 = Serious problem trying to set value
'+11 = Spin field is not visible
'+12 = Spin field is not enabled
'+99 = Unexpected error

    printlog "Setting value in spin field"
    'Check if desired spin field is visible
    if NOT oThisSpinField.IsVisible then
        qaErrorLog "Error 11: Spin field is not visible"
        fSetSpinFieldByString = 11
        exit function
    endif
    'Check if desired spin field is enabled
    if NOT oThisSpinField.IsEnabled then
        qaErrorLog "Error 12: Spin field is not enabled"
        fSetSpinFieldByString = 12
        exit function
    endif
    'Try to set value in spin field
    try 
        oThisSpinField.setText sThisString
        fSetSpinFieldByString = 0
    catch
        'Throw error 1 and quit on serious problem
        qaErrorLog "Error 1: Setting value on spin field seems to cause a serious problem."
        fSetSpinFieldByString = 1
        exit function
    endcatch
    if fSetSpinFieldByString = 99 then
        warnlog "Error 99: Something unexpected happened!!"
    endif   
end function
'
'--------------------------------------------------------------------
'
function fSetSpinFieldByButton ( oThisSpinField as OBJECT , sMoreOrLess as STRING , OPTIONAL iTimes as INTEGER ) as INTEGER
         fSetSpinFieldByButton = 99
'Function to set a spin field control by using More or Less button
'Input:
'+OBJECT oThisSpinField (spin field control name in declaration
'+STRING sMoreOrLess has to be <i>more</i> or <i>less</i> (to click on 'More' or 'Less' button in spin field)
'+<i>optional</i> INTEGER iTimes (How often to click if more than once)
'Return (Error codes):
'+ 0 = Sucess
'+ 1 = Serious problem trying to set value
'+11 = Spin field is not visible
'+12 = Spin field is not enabled
'+42 = User error, input doesn't match
'+99 = Unexpected error

    'toggle spin field as least once
    if isMissing ( iTimes ) then
        iTimes = 1
    endif
    printlog "Toggle value in spin field"
    'Check if desired spin field is visible
    if NOT oThisSpinField.IsVisible then
        qaErrorLog "Error 11: Spin field is not visible"
        fSetSpinFieldByButton = 11
        exit function
    endif
    'Check if desired spin field is enabled
    if NOT oThisSpinField.IsEnabled then
        qaErrorLog "Error 12: Spin field is not enabled"
        fSetSpinFieldByButton = 12
        exit function
    endif
    'Try to toggle value in spin field
    try 
        select case lcase ( sMoreOrLess ) 
               case "more" : oThisSpinField.more ( iTimes )
               case "less" : oThisSpinField.less ( iTimes )
               case else
                    fSetSpinFieldByButton = 42
                    warnlog "USER ERROR: Input doesn't match!"
                    exit function
        end select
        fSetSpinFieldByButton = 0
    catch
        'Throw error 1 and quit on serious problem
        qaErrorLog "Error 1: Try to toggle spin field seems to cause a serious problem."
        fSetSpinFieldByButton = 1
        exit function
    endcatch
    if fSetSpinFieldByButton = 99 then
        warnlog "Error 99: Something unexpected happened!!"
    endif   
end function
'
'--------------------------------------------------------------------
'
function fSetSpinFieldByLimit ( oThisSpinField as OBJECT , sMinOrMax as STRING ) as INTEGER
         fSetSpinFieldByLimit = 99
'Function to set a spin field control to minimum or maximum value
'Input:
'+OBJECT oThisSpinField (spin field name in declaration
'+STRING sMinOrMax has to be <i>min</i> or <i>max</i> (to set spin field to minimum or maximum value)
'Return (Error codes):
'+ 0 = Sucess
'+ 1 = Serious problem trying to set value
'+11 = Spin field is not visible
'+12 = Spin field is not enabled
'+42 = User error, input doesn't match
'+99 = Unexpected error

    printlog "Set spin field control to minimum or maximum value"
    'Check if desired spin field is visible
    if NOT oThisSpinField.IsVisible then
        qaErrorLog "Error 11: Spin field is not visible"
        fSetSpinFieldByLimit = 11
        exit function
    endif
    'Check if desired spin field is enabled
    if NOT oThisSpinField.IsEnabled then
        qaErrorLog "Error 12: spin field is not enabled"
        fSetSpinFieldByLimit = 12
        exit function
    endif
    'Try to set spin field to minimum or maximum value
    try 
        select case lcase ( sMinOrMax ) 
               case "max" : oThisSpinField.toMax
               case "min" : oThisSpinField.toMin
               case else
                    fSetSpinFieldByLimit = 42
                    warnlog "USER ERROR: Input doesn't match!"
                    exit function
        end select
        fSetSpinFieldByLimit = 0
    catch
        'Throw error 1 and quit on serious problem
        qaErrorLog "Error 1: Trying to set spin field to minimum or maximum value seems to cause a serious problem."
        fSetSpinFieldByLimit = 1
        exit function
    endcatch
    if fSetSpinFieldByLimit = 99 then
        warnlog "Error 99: Something unexpected happened!!"
    endif 
end function
'
'--------------------------------------------------------------------
'
function fSetComboBoxByItem ( oThisComboBox as OBJECT , iThisValue as INTEGER ) as INTEGER
'This is an alias for 'fSetListBoxByItem'

'Function to select item in combo box
'Input:
'+OBJECT oThisComboBox (combo box name in declaration)
'+INTEGER iThisValue (item number to be selected in Combo box)
'Return (Error codes):
'+ 0 = Sucess
'+ 1 = Serious problem trying to set value
'+ 2 = Value was not set
'+11 = Combo box is not visible
'+12 = Combo box is not enabled
'+13 = Item number to be selected out of list range
'+99 = Unexpected error
    fSetComboBoxByItem = fSetListBoxByItem ( oThisComboBox , iThisValue )
end function
'
'--------------------------------------------------------------------
'
function fSetComboBoxByString ( oThisComboBox as OBJECT , iThisString as STRING ) as INTEGER
'This is an alias for 'fSetListBoxByString'
'Function to select item in combo box
'Input:
'+OBJECT oThisComboBox (combo box name in declaration)
'+STRING iThisString (string to be selected in combo box control)
'Return (Error codes):
'+ 0 = Sucess
'+ 1 = Serious problem trying to set value
'+ 2 = Value was not set
'+11 = Combo box is not visible
'+12 = Combo box is not enabled
'+13 = String to be selected doesn't exist in list box
'+99 = Unexpected error
    fSetComboBoxByString = fSetListBoxByString ( oThisComboBox , iThisString )
end function
'
'--------------------------------------------------------------------
'
function fSetComboBoxByText ( oThisComboBox as OBJECT , sThisText as STRING , OPTIONAL bVerifyAgainstEntries as BOOLEAN ) as INTEGER
         fSetComboBoxByText = 99
'Function to Edit Field part of a combo box
'Input:
'+OBJECT oThisComboBox (combo box name in declaration)
'+STRING sThisText (Text to be set in combo box edit field
'+<i>optional</i> BOOLEAN bVerifyAgainstEntries (Check if setting the text succeeded)
'Return (Error codes):
'+ 0 = Sucess
'+ 1 = Serious problem trying to set value
'+ 2 = Value was not set
'+11 = Combo box is not visible
'+12 = Combo box is not enabled
'+13 = String to be selected doesn't exist in list box (if <i>optional</i> input parameter has been used)
'+99 = Unexpected error

    dim iIndex as INTEGER
    dim iListLength as INTEGER
    dim bStringIsInList as BOOLEAN
    dim sStringinUI as STRING
    
        bStringIsInList = FALSE
        sStringinUI = ""
        
    'Only check Edit Field against list box if 'bVerifyAgainstEntries' is explizitly TRUE	
    if isMissing ( bVerifyAgainstEntries ) then
        bVerifyAgainstEntries = FALSE
    endif
    
    printlog "Setting text in Combo Box Edit field"
    'Check if desired combo box is visible
    if NOT oThisComboBox.IsVisible then
        qaErrorLog "Error 11: Combo box is not visible"
        fSetComboBoxByText = 11
        exit function
    endif
    'Check if desired combo box is enabled
    if NOT oThisComboBox.IsEnabled then
        qaErrorLog "Error 12: Combo box is not enabled"
        fSetComboBoxByText = 12
        exit function
    endif
    'Check if input value is existent in list entries (optinal if desired)
    if bVerifyAgainstEntries then
        iListLength = oThisComboBox.GetItemCount
        for iIndex = 1 to iListLength
            if oThisComboBox.GetItemText ( iIndex ) = sThisText then
                bStringIsInList = TRUE
            endif
        next iIndex
        if bStringIsInList then
            printlog "OK, string exists in list box control"
        else
            qaErrorLog "Error 13: Input string not found in list entries"
            fSetComboBoxByText = 13
            exit function
        endif
    endif
    'Trying to set text on combo box
    try 
        oThisComboBox.setText sThisText
    catch
        'Throw error 1 and quit on serious problem
        qaErrorLog "Error 1: Set text in combo box seems to cause a serious problem."
        fSetComboBoxByText = 1
        exit function
    endcatch
    'Verify (against input) if text was set correctly
    sStringinUI = oThisComboBox.GetSelText
    if sStringinUI = sThisText then
        fSetComboBoxByText = 0
        printlog "Setting text in Combo box works"
    else
        qaErrorLog "Error 2: Set text in Combo box failed."
        fSetComboBoxByText = 2
    endif

    if fSetComboBoxByText = 99 then
        warnlog "Error 99: Something unexpected happened!!"
    endif  
end function
'
'--------------------------------------------------------------------
'
function fSetCheckBox ( oThisCheckBox as OBJECT , bCheck as BOOLEAN ) as INTEGER
         fSetCheckBox = 99
'Function to (un)check a check box
'Input:
'+OBJECT oThisCheckBox (check box name in declaration)
'+BOOLEAN bCheck (check or uncheck the check box control)
'Return (Error codes):
'+ 0 = Sucess
'+ 1 = Serious problem trying to check the box
'+ 2 = Box was not checked
'+11 = Check box is not visible
'+12 = Check box is not enabled
'+99 = Unexpected error

    printlog "Checking check box"
    'Check if desired check box is visible
    if NOT oThisCheckBox.IsVisible then
        qaErrorLog "Error 11: Check box is not visible"
        fSetCheckBox = 11
        exit function
    endif
    'Check if desired check box is enabled
    if NOT oThisCheckBox.IsEnabled then
        qaErrorLog "Error 12: Check box is not enabled"
        fSetCheckBox = 12
        exit function
    endif
    'Try to check check box control
    try 
        if bCheck then
            oThisCheckBox.Check
        else
            oThisCheckBox.Uncheck
        endif
    catch
        'Throw error 1 and quit on serious problem
        if bCheck then
            qaErrorLog "Error 1: Checking check box control cause into a serious problem."
        else
            qaErrorLog "Error 1: Unchecking check box control cause into a serious problem."
        endif
        fSetCheckBox = 1
        exit function
    endcatch
    'Verify (against input) if check box is checked
    if oThisCheckBox.IsChecked = bCheck then
        fSetCheckBox = 0
        printlog "Check check box seems to work"
    else
        qaErrorLog "Error 2: Check check box failed."
        fSetCheckBox = 2
    endif
    if fSetCheckBox = 99 then
        warnlog "Error 99: Something unexpected happened!!"
    endif  
end function
'
'--------------------------------------------------------------------
'
function fSetRadioButton ( oThisRadioButton as OBJECT  ) as INTEGER
         fSetRadioButton = 99
'Function to check a radio button
'Input:
'+OBJECT oThisRadioButton (radio button name in declaration)
'Return (Error codes):
'+ 0 = Sucess
'+ 1 = Serious problem trying to check the radio button
'+ 2 = Radio button was not checked
'+11 = Radio button is not visible
'+12 := Radio button is not enabled
'+99 := Unexpected error
    printlog "Checking radio button"
    'Check if desired radio button is visible
    if NOT oThisRadioButton.IsVisible then
        qaErrorLog "Error 11: Radio button is not visible"
        fSetRadioButton = 11
        exit function
    endif
    'Check if desired radio button is enabled
    if NOT oThisRadioButton.IsEnabled then
        qaErrorLog "Error 12: Radio button is not enabled"
        fSetRadioButton = 12
        exit function
    endif
    'Try to check Radio Button
    try 
        oThisRadioButton.Check
    catch
        'Throw error 1 and quit on serious problem
        qaErrorLog "Error 1: Check radio button seems to cause a serious problem."
        fSetRadioButton = 1
        exit function
    endcatch
    'Verify if radio button is checked
    if oThisRadioButton.IsChecked = TRUE then
        fSetRadioButton = 0
        printlog "Check radio button seems to work"
    else
        qaErrorLog "Error 2: Check radio button failed."
        fSetRadioButton = 2
    endif
    if fSetRadioButton = 99 then
        warnlog "Error 99: Something unexpected happened!!"
    endif  
end function