summaryrefslogtreecommitdiff
path: root/testautomation/dbaccess/optional/includes/ctrl_General.inc
blob: 647390c5845c0751dd2745734ac5139067caf7d3 (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
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
'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 : marc.neumann@sun.com
'*
'* short description : Data Source Administrator
'*
'\***********************************************************************
sub ctrl_General
	
    call tLoad_Save_Print
    call tAutomaticControlFocus1
    call tAutomaticControlFocus2'
    call tPosAndSize_Protect_Position
    call tPosAndSize_Protect_Size
    call tPosAndSize_Keyboard
    call tPosAndSize_Dialog    
    call tPosAndSize_KeepRatio
    'TODO Control the Setting on tabpage Rotation & Slant (should be inactive).
    
    call tTabStop
    call tActivationOrder
    call tAddFields

end sub

'--------------------------------------------------------------------------------------

testcase tLoad_Save_Print
    
    dim iXMLElementCount as integer
    dim i as integer
	'/// Load the document TT_All_Controls.odt		
    hFileOpen ( gTesttoolPath + ConvertPath("dbaccess/optional/input/TT_All_Controls.odt"))
    'TODO: Are all controlls shown right (color, fonts etc.)?
    '/// save the doc under a diffrent name.
    hFileSaveAsKill ( gOfficePath + ConvertPath("user/work/TT_All_Controls.odt"))
    '/// Reload & compare it with the origin doc.
    hCloseDocument
    hFileOpen ( gOfficePath + ConvertPath("user/work/TT_All_Controls.odt"))
    hCloseDocument
    'TODO: Print the doc & compare it with the origin.
    '(Attention: Background can't be printed colored (Task: <A HREF="http://webserver1.stardiv.de/Bugtracker/Source/Body_ReportDetail.asp?ID=57223">57223</A>)).

endcase    
'--------------------------------------------------------------------------------------
testcase tAutomaticControlFocus1
	
    '/// Open a new document,
    printlog "Open a new document,"
	call hNewDocument
    Kontext "DocumentWriter"       
	DocumentWriter.TypeKeys "tt_doc" , true
	sleep(1)

    call hToolbarSelect("FormControls",true)   
	
  	Kontext "FormControls"   	
   	    Edit.Click
        sleep(2)      
	'/// insert a Text Boxes
    printlog "insert three Text Boxes"                                                                    
    call hDrawingWithSelection ( 40, 40, 55, 55 ) 
        
    sleep(2)
    
	Kontext "FormControls"
	    ControlProperties.Click            
	sleep(2)	
	
    fSetControlProperty("Edit","DefaultValue","tt_control")
	sleep(1)
    '/// activate the Automatic control focus.
    printlog "activate the Automatic control focus."
	
    call hToolbarSelect("FormDesignTools",true)   
	    
    Kontext "FormDesignTools"
        AutoControlFocus.Click
        
	sleep(2)	
    '/// save the document
    printlog "save the document"
	hFileSaveAsKill ( gOfficePath + ConvertPath("user/work/TT_Control_Test1.odt"))
    sleep(1)
	hCloseDocument
    sleep(1)
    '/// reload the document
    printlog "reload the document"
	hFileOpen ( gOfficePath + ConvertPath("user/work/TT_Control_Test1.odt"))
    ' /// check if the control has the focus after reload.
    printlog " check if the second control has the focus after reload."
    Kontext "DocumentWriter"
    DocumentWriter.TypeKeys "<MOD1 HOME>" , true
    sleep(1)       
	DocumentWriter.TypeKeys "<MOD1 SHIFT END>" , true
    sleep(1)
    DocumentWriter.TypeKeys "<MOD1 C>" , true
    sleep(1)
    if GetClipboard <> "tt_control" then
        warnlog "The control has not the focus. The document has the focus." 
    endif
    
    hCloseDocument
    
endcase
'--------------------------------------------------------------------------------------
testcase tAutomaticControlFocus2
	
    '/// Open a new document,
    printlog "Open a new document,"
	call hNewDocument
    Kontext "DocumentWriter"       
	DocumentWriter.TypeKeys "tt_doc" , true
	sleep(1)

    call hToolbarSelect("FormControls",true)   
	
  	Kontext "FormControls"   	
   	Edit.Click
   	sleep(1)
	'/// insert three Text Boxes
    printlog "insert three Text Boxes"
    call hDrawingWithSelection ( 50, 20, 60, 30 )
	sleep(2)
	Kontext "FormControls"
	ControlProperties.Click
	sleep(2)
    fSetControlProperty("Edit","DefaultValue","tt_control1")
	
	call hDrawingWithSelection  ( 50, 40, 60, 50 )
	sleep(2)
    ' open and close the form property browser to get the focus
	Kontext "FormControls"
	ControlProperties.Click
    sleep(2)
    ControlProperties.Click
	sleep(2)	
    
    fSetControlProperty("Edit","TabOrder","1")
    
    ' open and close the property browser
    Kontext "FormControls"
	ControlProperties.Click
    sleep(2)
    ControlProperties.Click
	sleep(2)	
	
    fSetControlProperty("Edit","DefaultValue","tt_control2")

    sleep(1)
    
    call hDrawingWithSelection  ( 50, 60, 60, 70 )
	sleep(2)
    ' open and close the form property browser to get the focus
    Kontext "FormControls"
	ControlProperties.Click
    sleep(2)
    ControlProperties.Click	
	sleep(2)	
    fSetControlProperty("Edit","DefaultValue","tt_control3")
	    
    '/// activate the Automatic control focus.
    printlog "activate the Automatic control focus."

    call hToolbarSelect("FormDesignTools",true)

    Kontext "FormDesignTools"
        AutoControlFocus.Click
        
	sleep(2)	
    '/// save the document
    printlog "save the document"
	hFileSaveAsKill ( gOfficePath + ConvertPath("user/work/TT_Control_Test2.odt"))
	hCloseDocument
    sleep(1)
    '/// reload the document
    printlog "reload the document"
	hFileOpen ( gOfficePath + ConvertPath("user/work/TT_Control_Test2.odt"))
    ' /// check if the second control has the focus after reload.
    printlog " check if the second control has the focus after reload."
    Kontext "DocumentWriter"
    DocumentWriter.TypeKeys "<MOD1 HOME>" , true
    sleep(1)       
	DocumentWriter.TypeKeys "<MOD1 SHIFT END>" , true
    sleep(1)
    DocumentWriter.TypeKeys "<MOD1 C>" , true
    sleep(1)
    if GetClipboard <> "tt_control2" then
        warnlog "The wrong control has the focus." 
    endif
    
    hCloseDocument
    
endcase
'--------------------------------------------------------------------------------------
testcase tPosAndSize_Keyboard
    
    dim sPosX as String
    dim sPosY as String
    dim sWidth as String
    dim sHeight as String
    
    '/// Open a new document,
    printlog "Open a new document,"
	call hNewDocument
    
	sleep(1)
    call hToolbarSelect("FormControls",true)
  	Kontext "FormControls"   	
   	    Edit.Click
   	
	'/// insert a Text Box
    printlog "insert a Text Box"    
    Kontext "DocumentWriter"
    DocumentWriter.MouseDown ( 45, 45 )
    DocumentWriter.MouseMove ( 55, 55 )
    DocumentWriter.MouseUp   ( 55, 55 )
	sleep(2)
	'/// open the position and size dialog.
    printlog "open the position and size dialog."
    
    call fOpenPositionAndSizeDialog    
    
    '/// remember the settings.
    printlog "remember the settings."
    Kontext "TabPositionAndSizeWriter"
    sPosX = HorizontalBy.getText()
    sPosY = Verticalby.getText()
    sWidth = Width.getText()
    sHeight = Height.getText()    
    TabPositionAndSizeWriter.OK
    sleep(2)
    
    Kontext "DocumentWriter"    
    gMouseClick(50,50)    
    sleep(2)
    
    '/// move the control via keyboard
    printlog "move the control via keyboard"     
    
    DocumentWriter.TypeKeys "<DOWN>" , true
    DocumentWriter.TypeKeys "<RIGHT>" , true
    DocumentWriter.TypeKeys "<MOD1 TAB>" , true
    DocumentWriter.TypeKeys "<DOWN>" , true
    DocumentWriter.TypeKeys "<RIGHT>" , true
        
    sleep(2)
    '/// open the position and size dialog
    printlog "open the position and size dialog"
    
    call fOpenPositionAndSizeDialog
    
    Kontext "TabPositionAndSizeWriter"
    '/// check the settings.
    printlog "check the settings."
    if sPosX = HorizontalBy.getText() then
        warnlog "The X position has not change."
    endif
    if sPosY = VerticalBy.getText() then
        warnlog "The Y position has not change."
    endif
    if sWidth = Width.getText() then
        warnlog "The width position has not change."
    endif
    if sHeight = Height.getText() then
        warnlog "The height position has not change."
    endif
    
    TabPositionAndSizeWriter.OK
    sleep(1)
    
    hCloseDocument
    
endcase
'--------------------------------------------------------------------------------------
testcase tPosAndSize_Dialog
    
    dim sPosX as String
    dim sPosY as String
    dim sWidth as String
    dim sHeight as String
    dim sText as String
    
    '/// Open a new document,
    printlog "Open a new document,"
	call hNewDocument
    Kontext "DocumentWriter"       
	    DocumentWriter.TypeKeys "tt_doc" , true
        sleep(1)
    
    call hToolbarSelect("FormControls",true)

  	Kontext "FormControls"   	
   	    Edit.Click
        sleep(1)
    '/// insert a Text Box
    printlog "insert a Text Box"
    call hDrawingWithSelection ( 40, 40, 60, 60 )
	sleep(2)
	'/// open the position and size dialog
    printlog "open the position and size dialog"
    
    call fOpenPositionAndSizeDialog         
        
    '/// set values for X , Y , width and height
    printlog "set values for X , Y , width and height"
    Kontext "TabPositionAndSizeWriter"
        ' uncheck KeepRatio because maybe it have set from a test before.
        KeepRatio.UnCheck
        HorizontalBy.setText("3")
        VerticalBy.setText("3")
        Width.setText("3")
        Height.setText("3")    
        sleep(1)
        TabPositionAndSizeWriter.OK
    sleep(2)
    '/// open the position and size dialog
    printlog "open the position and size dialog"
    
    call fOpenPositionAndSizeDialog
    
    Kontext "TabPositionAndSizeWriter"
    '/// check the settings.
    printlog "check the settings."
    sText = HorizontalBy.getText()
    if Instr(sText,"3") = 0 then
        warnlog "The X position has not changed."
    endif
    sText = VerticalBy.getText()
    if Instr(sText,"3") = 0 then
        warnlog "The Y position has not changed."
    endif
    sText = Width.getText()
    if Instr(sText,"3") = 0 then
        warnlog "The width has not changed."
    endif
    sText = Height.getText()    
    if Instr(sText,"3") = 0 then
        warnlog "The height has not changed."
    endif
    
    TabPositionAndSizeWriter.OK
    sleep(1)
    
    hCloseDocument
    
endcase
'--------------------------------------------------------------------------------------
testcase tPosAndSize_Protect_Position
    
    dim sPosX as String
    dim sPosY as String    
    
    '/// Open a new document,
    printlog "Open a new document,"
	call hNewDocument
    Kontext "DocumentWriter"       
	DocumentWriter.TypeKeys "tt_doc" , true
	sleep(1)

    call hToolbarSelect("FormControls",true)
	
  	Kontext "FormControls"   	
   	    Edit.Click
   	sleep(1)
	'/// insert a Text Box
    printlog "insert a Text Box"
    call hDrawingWithSelection ( 40, 40, 60, 60 )
	sleep(2)
	'/// open the position and size dialog
    printlog "open the position and size dialog"

    call fOpenPositionAndSizeDialog
    
    Kontext "TabPositionAndSizeWriter"
    sPosX = HorizontalBy.getText()
    sPosY = VerticalBy.getText()
    '/// check protect position
    printlog "check protect position"
    ProtectPosition.Check
    TabPositionAndSizeWriter.OK
    sleep(2)
    
    Kontext "DocumentWriter"    
    gMouseClick(50,50)        
    sleep(2)
    'Kontext "DocumentWriter"    
    '/// test if is possible to move the control via keyboard
    printlog "test if is possible to move the control via keyboard"
    DocumentWriter.TypeKeys "<DOWN>" , true
    DocumentWriter.TypeKeys "<RIGHT>" , true
          
    sleep(2)
    '/// open the position and size dialog
    printlog "open the position and size dialog"
    
    call fOpenPositionAndSizeDialog
    
    Kontext "TabPositionAndSizeWriter"
    '/// check the settings, if the position is changed.
    printlog "check the settings, if the position is changed."
    if sPosX <> HorizontalBy.getText() then
        warnlog "The X position has change although the protect position is checked."
    endif
    if sPosY <> VerticalBy.getText() then
        warnlog "The Y position has change although the protect position is checked."
    endif   
    TabPositionAndSizeWriter.OK
    sleep(1)
    
    hCloseDocument
    
endcase
'--------------------------------------------------------------------------------------
testcase tPosAndSize_KeepRatio
    
    dim sWidth as String
    dim sHeight as String
    
    '/// Open a new document,
    printlog "Open a new document,"
	call hNewDocument
    Kontext "DocumentWriter"       
	DocumentWriter.TypeKeys "tt_doc" , true
	sleep(1)

    call hToolbarSelect("FormControls",true) 	

  	Kontext "FormControls"   	
   	    Edit.Click
   	sleep(1)
	'/// insert a Text Box
    printlog "insert a Text Box"
    call hDrawingWithSelection ( 40, 40, 60, 60 )
	sleep(2)
	'/// open the position and size dialog
    printlog "open the position and size dialog"
    
    call fOpenPositionAndSizeDialog

    sleep(1)
    '/// set a width and height.
    printlog "set a width and height."
    Kontext "TabPositionAndSizeWriter"
        KeepRatio.UnCheck
        Width.setText("4")
        sleep(1)
        Height.setText("2")
        sleep(1)
        '/// check keep ratio
        printlog "check keep ratio"
        KeepRatio.Check
        sleep(1)
        Width.setText("6")
        sleep(1)
        '/// check if keep ratio is working
        printlog "check if keep ratio is working"
        if Instr(Height.getText(),"3") = -1  then
            warnlog "The height doesn't keep the ratio"
        endif
        TabPositionAndSizeWriter.OK
    sleep(2)
    '/// open the position and size dialog
    printlog "open the position and size dialog"
    call fOpenPositionAndSizeDialog
    
    Kontext "TabPositionAndSizeWriter"
        '/// check the settings.
        printlog "check the settings."
        if Instr(Width.getText(),"6") = -1 then
            warnlog "The width isn't correct. " + Width.getText()+" instead of 6."
        endif
        if Instr(Height.getText(),"3") = -1 then
           warnlog "The height isn't correct. " + height.getText()+" instead of 3."
        endif
        
        TabPositionAndSizeWriter.OK
    sleep(1)
    
    hCloseDocument
    
endcase
'--------------------------------------------------------------------------------------
testcase tPosAndSize_Protect_Size
    
    dim sWidth as String
    dim sHeight as String
    
    '/// Open a new document,
    printlog "Open a new document,"
	call hNewDocument
    Kontext "DocumentWriter"       
	DocumentWriter.TypeKeys "tt_doc" , true
	sleep(1)

    call hToolbarSelect("FormControls",true) 
	
  	Kontext "FormControls"   	
   	    Edit.Click
   	sleep(1)
	'/// insert a Text Box
    printlog "insert a Text Box"
    call hDrawingWithSelection ( 40, 40, 60, 60 )
	sleep(2)
	'/// open the position and size dialog
    printlog "open the position and size dialog"
    
    call fOpenPositionAndSizeDialog
    
    Kontext "TabPositionAndSizeWriter"
        sWidth = Width.getText()
        sHeight = Height.getText()
        '/// check protect size
        printlog "check protect size"
        ProtectSize.Check
        TabPositionAndSizeWriter.OK
    sleep(2)
    
    Kontext "DocumentWriter"    
    gMouseClick(50,50)    
    sleep(2)
    'Kontext "DocumentWriter"    
    '/// test is is possible to change the size of the control via keyboard
    printlog "test is is possible to change the size of the control via keyboard"    
    DocumentWriter.TypeKeys "<MOD1 TAB>" , true
    DocumentWriter.TypeKeys "<DOWN>" , true
    DocumentWriter.TypeKeys "<RIGHT>" , true
    sleep(2)
    '/// open the position and size dialog
    printlog "open the position and size dialog"
    
    call fOpenPositionAndSizeDialog
    
    Kontext "TabPositionAndSizeWriter"
    '/// check the settings
    printlog "check the settings"
    if sWidth <> Width.getText() then
        warnlog "The width has change although the protect size is checked."
    endif
    if sHeight <> Height.getText() then
        warnlog "The height has change although the protect size is checked."
    endif   
    TabPositionAndSizeWriter.OK
    sleep(1)
    
    hCloseDocument
    
endcase
'-------------------------------------------------------------------------
testcase tTabStop
    
    '/// Open a new document,
    printlog "Open a new document,"
	call hNewDocument
    Kontext "DocumentWriter"       
	DocumentWriter.TypeKeys "tt_doc" , true
	sleep(1)

    call hToolbarSelect("FormControls",true) 
	
  	Kontext "FormControls"   	
   	    Edit.Click
   	sleep(1)
	'/// insert one Text Box
    printlog "insert one Text Box"    
    call hDrawingWithSelection ( 50, 20, 60, 30 )
	sleep(2)
	
    '/// open the control propery browser
    printlog "open the control propery browser"
    call fOpenControlPropertyBrowser
    
    '/// the the default text to tt_control1
    printlog "the the default text to tt_control1"
    call fSetControlProperty("TextBox","DefaultValue","tt_control1")	
		
	' close the property browser
    Kontext "FormControls"
	    ControlProperties.Click

	sleep(1)
    
	'/// insert again one Text Box
    printlog "insert again one Text Box"
	call hDrawingWithSelection  ( 50, 40, 60, 50 )
	
    sleep(2)    
	
    '/// open the property browser
    printlog "open the property browser"
    call fOpenControlPropertyBrowser
    
    '/// set the Order property to 2
    printlog "set the Order property to 2"
    call fSetControlProperty("TextBox","Order","2")
    
    'close and reopen the control property browser to get the default focus
    call fOpenControlPropertyBrowser
    
    '/// set the DefaultValue property to tt_control2
    call fSetControlProperty("TextBox","DefaultValue","tt_control2")

    'close the control propery browser
    Kontext "FormControls"
	    ControlProperties.Click

    '/// insert again one Text Box
    printlog "insert again one Text Box"    
    call hDrawingWithSelection  ( 50, 60, 60, 70 )
	
    sleep(2)
    
    ' open and close the form property browser to get the focus    
    call fOpenControlPropertyBrowser
    
    '/// set the Order property to 1
    printlog "set the Order property to 1"
    call fSetControlProperty("TextBox","Order","1")
    
    'close and reopen the control property browser to get the default focus
    call fOpenControlPropertyBrowser
    
    '/// set the DeaultValue property to tt_control3
    printlog "set the DeaultValue property to tt_control3"
    call fSetControlProperty("TextBox","DefaultValue","tt_control3")
    
    call hToolbarSelect("FormDesignTools",true) 
    Kontext "FormDesignTools"
        '/// activate the AutomaticControlFocus
        printlog "activate the AutomaticControlFocus"
        AutoControlFocus.Click
        sleep(1)		
        '/// turn of the design view
        printlog "turn of the design view"
    Kontext "FormControls"
        SwitchControlDesignMode.Click    
        printlog "after designview click"
        sleep(4)
    '/// check if the right control has the focus
    printlog "check if the right control has the focus"
    Kontext "DocumentWriter"
        DocumentWriter.TypeKeys "<MOD1 HOME>" , true
        sleep(1)
        DocumentWriter.TypeKeys "<MOD1 SHIFT END>" , true
        sleep(1)
        DocumentWriter.TypeKeys "<MOD1 C>" , true
        sleep(1)        
        if GetClipboard = "tt_doc" then
            warnlog "The control has not the focus. The document has the focus." 
        elseif GetClipboard <> "tt_control3" then
            warnlog "The wrong control has the focus."
        endif  
        '/// check that tyou travel to the right controls via TAB
        printlog "check that tyou travel to the right controls via TAB"
        DocumentWriter.TypeKeys "<TAB>" , true
        sleep(1)
        DocumentWriter.TypeKeys "<MOD1 HOME>" , true
        sleep(1)
        DocumentWriter.TypeKeys "<MOD1 SHIFT END>" , true
        sleep(1)
        DocumentWriter.TypeKeys "<MOD1 C>" , true
        sleep(1)        
        if GetClipboard <> "tt_control2" then
            warnlog "The wrong control has the focus." 
        endif        
    
    hCloseDocument
    
endcase
'--------------------------------------------------------------------------------------
testcase tActivationOrder

    Dim sSelText as string

    '/// Open a new document,
    printlog "Open a new document,"
	call hNewDocument
    Kontext "DocumentWriter"       
	    DocumentWriter.TypeKeys "tt_doc" , true
        sleep(1)
    
    call hToolbarSelect("FormControls",true)    
	
    Kontext "FormControls"   	
   	    Edit.Click
        sleep(1)
        
    '/// insert one Text Box
    printlog "insert one Text Box"
    call hDrawingWithSelection ( 50, 20, 60, 30 )
	sleep(2)
    
    '/// open the control property browser
    printlog "open the control property browser"
    call fOpenControlPropertyBrowser
    
    '/// set the Name Property to tt_control1
    printlog "set the Name Property to tt_control1"
    call fSetControlProperty("TextBox","NameText","tt_control1")
    
    'close and reopen the control property browser to get the default focus
    call fOpenControlPropertyBrowser
    
    '/// set the DefaultValue Property to tt_control1
    printlog "set the DefaultValue Property to tt_control1"
    call fSetControlProperty("TextBox","DefaultValue","tt_control1")

    sleep(1)    

    ' close the property browser
    Kontext "FormControls"
	    ControlProperties.Click
    
    '/// insert one Text Box
    printlog "insert one Text Box"
	call hDrawingWithSelection  ( 50, 40, 60, 50 )
	sleep(2)
    
    '/// open the control property browser
    printlog "open the control property browser"
    call fOpenControlPropertyBrowser
    
    '/// set the Name Property to tt_control2
    printlog "set the Name Property to tt_control2"
    call fSetControlProperty("TextBox","NameText","tt_control2")
    
    'close and reopen the control property browser to get the default focus
    call fOpenControlPropertyBrowser
    
    '/// set the DefaultValue Property to tt_control2
    call fSetControlProperty("TextBox","DefaultValue","tt_control2")
    
    ' close the property browser
    Kontext "FormControls"
	    ControlProperties.Click
    
    '/// insert one Text Box
    printlog "insert one Text Box"
    call hDrawingWithSelection  ( 50, 60, 60, 70 )
	sleep(2)
    
    '/// open the control property browser
    printlog "open the control property browser"
    call fOpenControlPropertyBrowser
    
    '/// set the Name Property to tt_control3
    call fSetControlProperty("TextBox","NameText","tt_control3")
    
    'close and reopen the control property browser to get the default focus
    call fOpenControlPropertyBrowser
    
    '/// set the Defaultvalue property to tt_control3
    call fSetControlProperty("TextBox","DefaultValue","tt_control3")
    
    '/// open the tab order dialog
    printlog "open the tab order dialog"
    call fOpenTabOrder
    
    ' IndexKLiener
    printlog "IndexKLiener"     
    Kontext "ActivationOrder"        
        sleep(1)
        ControlList.TypeKeys "<END>" , true ' to select the first entry        
        sleep(1)        
        ControlList.TypeKeys "<HOME>" , true        
        sleep(1)
        sSelText = ControlList.getSelText()
        if sSelText <> "tt_control1" then
            warnlog "Wrong control on first position in activation order dialog.(" + sSelText + ")"
        endif        
        sleep(1)
        ControlList.TypeKeys "<DOWN>" , true
        sleep(1)
        sSelText = ControlList.getSelText()
        if sSelText <> "tt_control2" then
            warnlog "Wrong control on second position in activation order dialog.(" + sSelText + ")"
        endif
        sleep(1)        
        ControlList.TypeKeys "<DOWN>" , true
        sleep(1)
        sSelText = ControlList.getSelText()
        if sSelText <> "tt_control3" then
            warnlog "Wrong control on third position in activation order dialog.(" + sSelText + ")"
        endif
        sleep(1)
        MoveUp.Click
        sleep(1)
        ControlList.TypeKeys "<HOME>" , true
        sleep(1)
        ControlList.TypeKeys "<DOWN>" , true
        sSelText = ControlList.getSelText()
        if sSelText <> "tt_control3" then
            warnlog "The move up button in activation order dialog doesn't work.(" + sSelText + ")"
        endif
        
        
        ActivationOrder.OK        
    sleep(1)        
    printlog "open TabOrder dialog"
    call fOpenTabOrder
        
    Kontext "ActivationOrder"        
        sleep(1)
        ControlList.TypeKeys "<END>" , true ' to select the first entry        
        sleep(1)        
        ControlList.TypeKeys "<HOME>" , true        
        sleep(1)
        sSelText = ControlList.getSelText()
        if sSelText <> "tt_control1" then
            warnlog "Wrong control on first position in activation order dialog.(" + sSelText + ")"
        endif        
        sleep(1)
        MoveDown.Click
        sleep(1)        
        ControlList.TypeKeys "<HOME>" , true
        sleep(1)
        ControlList.TypeKeys "<DOWN>" , true
        sSelText = ControlList.getSelText()
        if sSelText <> "tt_control1" then
            warnlog "The move down button in activation order dialog doesn't work.(" + sSelText + ")"
        endif        
        
        ActivationOrder.OK
    
    sleep(1)

    call hToolbarSelect("FormDesignTools",true)

    Kontext "FormDesignTools"
        
            '/// activate the AutomaticControlFocus
            printlog "activate the AutomaticControlFocus"
            AutoControlFocus.Click
            sleep(1)		
            '/// turn of the design view
            printlog "turn of the design view"
        Kontext "FormControls"
            SwitchControlDesignMode.Click    
            printlog "after designview click"
            sleep(4)
       
    Kontext "DocumentWriter"
        DocumentWriter.TypeKeys "<MOD1 HOME>" , true
        sleep(1)
        DocumentWriter.TypeKeys "<MOD1 SHIFT END>" , true
        sleep(1)
        DocumentWriter.TypeKeys "<MOD1 C>" , true
        sleep(1)        
        if GetClipboard = "tt_doc" then
            warnlog "The control has not the focus. The document has the focus." 
        elseif GetClipboard <> "tt_control3" then
            warnlog "The wrong control has the focus. (" + GetClipboard +  ")"
        endif      
        DocumentWriter.TypeKeys "<TAB>" , true
        sleep(1)
        DocumentWriter.TypeKeys "<MOD1 HOME>" , true
        sleep(1)
        DocumentWriter.TypeKeys "<MOD1 SHIFT END>" , true
        sleep(1)
        DocumentWriter.TypeKeys "<MOD1 C>" , true
        sleep(1)        
        if GetClipboard = "tt_doc" then
            warnlog "The control has not the focus. The document has the focus." 
        elseif GetClipboard <> "tt_control1" then
            warnlog "The wrong control has the focus. (" + GetClipboard +  ")"
        endif
        
        DocumentWriter.TypeKeys "<TAB>" , true
        sleep(1)
        DocumentWriter.TypeKeys "<MOD1 HOME>" , true
        sleep(1)
        DocumentWriter.TypeKeys "<MOD1 SHIFT END>" , true
        sleep(1)
        DocumentWriter.TypeKeys "<MOD1 C>" , true
        sleep(1)        
        if GetClipboard = "tt_doc" then
            warnlog "The control has not the focus. The document has the focus." 
        elseif GetClipboard <> "tt_control2" then
            warnlog "The wrong control has the focus. (" + GetClipboard +  ")"
        endif

        
        printlog "turn of the design view"
        Kontext "FormControls"
            SwitchControlDesignMode.Click    
            printlog "after designview click"
            sleep(4)
        
    printlog "open TabOrder dialog"
    call fOpenTabOrder
        
    Kontext "ActivationOrder"
        AutoOrder.Click
        sleep(1)
        ActivationOrder.OK
    sleep(1)
    
    Kontext "FormControls"	
        '/// turn off the design view
        printlog "turn of the design view"    
        SwitchControlDesignMode.Click
    sleep(2)
        
    Kontext "DocumentWriter"
        DocumentWriter.TypeKeys "<MOD1 HOME>" , true
        sleep(1)
        DocumentWriter.TypeKeys "<MOD1 SHIFT END>" , true
        sleep(1)
        DocumentWriter.TypeKeys "<MOD1 C>" , true
        sleep(1)        
        if GetClipboard = "tt_doc" then
            warnlog "The control has not the focus. The document has the focus." 
        elseif GetClipboard <> "tt_control1" then
            warnlog "The wrong control has the focus.(" + GetClipboard +  ")"
        endif      
        DocumentWriter.TypeKeys "<TAB>" , true
        sleep(1)
        DocumentWriter.TypeKeys "<MOD1 C>" , true
        sleep(1)        
        if GetClipboard = "tt_doc" then
            warnlog "The control has not the focus. The document has the focus." 
        elseif GetClipboard <> "tt_control2" then
            warnlog "The wrong control has the focus.(" + GetClipboard +  ")"
        endif
        
        DocumentWriter.TypeKeys "<TAB>" , true
        sleep(1)
        DocumentWriter.TypeKeys "<MOD1 C>" , true
        sleep(1)        
        if GetClipboard = "tt_doc" then
            warnlog "The control has not the focus. The document has the focus." 
        elseif GetClipboard <> "tt_control3" then
            warnlog "The wrong control has the focus.(" + GetClipboard +  ")"
        endif
    
    sleep(1)
    
    call hCloseDocument
    
endcase
'-------------------------------------------------------------------------
testcase tAddFields
    
    Dim sControlName1 as String
    Dim sControlName2 as String
    '/// Open a new document,
    printlog "Open a new document,"
	call hNewDocument
    Kontext "DocumentWriter"       
	    DocumentWriter.TypeKeys "tt_doc" , true
        sleep(1)
    
    call hToolbarSelect("FormControls",true)
    	
    Kontext "FormControls"   	
   	    Edit.Click
        sleep(1)
    '/// insert three Text Boxes
    printlog "insert three Text Boxes"
    call hDrawingWithSelection ( 50, 20, 60, 30 )
	sleep(2)
	Kontext "FormControls"
	    FormProperties.Click
        sleep(1)
   
    Kontext "FormPropertiesDialog"
   	    FormPropertiesTabControl.SetPage TabDataForm
  	
    Kontext "TabDataForm"                
		sleep(1)		
        DataSource.Select "Bibliography"
        TabDataForm.typeKeys("<RETURN>")
        sleep(1)
        Content.Select "biblio"
        TabDataForm.typeKeys("<RETURN>")
        sleep(1)
        
    Kontext "FormControls"   
	    FormProperties.Click
        sleep(1)

    call hToolbarSelect("FormDesignTools",true)
       
    Kontext "FormDesignTools"    
        AddField.Click
        sleep(1)
    
    Kontext "FeldAuswahl"
        Liste.Select 1
        sControlName1 = Liste.getSelText
        Liste.TypeKeys "<RETURN>"
        sleep(3)
        
    Kontext "FormDesignTools"
        ShowFmExplorer.Click
        sleep(1)

    Kontext "FormularNavigator" 
       	Liste.TypeKeys "<HOME>" , true 
        Liste.TypeKeys "<DOWN>" , 4, true   	    
        sControlName2 = Liste.getSelText
        if sControlName1 <> sControlName2 then
            qaerrorlog "#i98316# The control name is not the same as the fieldname."
        endif
        
    sleep (2)    
    
    call hCloseDocument
    
endcase

function fOpenPositionAndSizeDialog

    call hToolbarSelect("FormDesignTools",true)  	
            
    Kontext "FormDesignTools"        
        PositionAndSizeDialog.Click
    
    fOpenPositionAndSizeDialog=true
    
end function
'-------------------------------------------------------------------------
function fOpenTabOrder

    printlog "open FormControls Toolbar"

    call hToolbarSelect("FormDesignTools",true)  	

    Kontext "FormDesignTools"    
        TabDialog.Click    
    
    fOpenTabOrder=true
    
end function

'-------------------------------------------------------------------------