summaryrefslogtreecommitdiff
path: root/testautomation/writer/optional/includes/textframes/w_textframes3.inc
blob: d9db6fa322534669ab0f4949dd25ee20dd8cf1fd (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
1064
1065
1066
1067
1068
1069
1070
'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 : Test of textframe - 3
'*
'\***********************************************************************

sub w_textframes3

    Call tTextframes_33         'Test attribute 'AutoSize' in linked frames
    Call tTextframes_34         'Insert text into original frame must flow into target frame, when first one is full
    Call tTextframes_35         'Show link - under Format.Frame.Options (previous link, next link)
    Call tTextframes_36         'Test link frames which are placed on different pages
    Call tTextframes_37         'Test link frames which are placed on header
    Call tTextframes_38         'Test link frames which are placed on footer
    Call tTextframes_39         'Test drag&drop with a linked frame - keyboard
    Call tTextframes_40         'Test Undo on drag&drop of frames (keyboard)
    Call tTextframes_41         'Test Undo on removing the link
    Call tTextframes_42         'Link frame in header with frame in bodytext should be forbidden
    Call tTextframes_43         'Link frame in footer with frame in bodytext should be forbidden
    Call tTextframes_44         'Link frame when target frame is not empty  should be forbidden
    Call tTextframes_45         'Recursed links should be forbidden
    Call tTextframes_46         'Frames which couldn't be linked with the current one is part of another 'chain'
    Call tTextframes_47         'Frames couldn't be linked with the current one is in protected section
    Call tTextframes_48         'Frames could be linked with the current one is set to "editable in protected documents" even it is in protected section

end sub

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

testcase tTextframes_33

    printlog "- Test attribute 'AutoSize' in linked frames"
    '/// Test attribute 'AutoSize' in linked frames
    
    Call hNewDocument
    
    '/// insert a frame
    Call fInsertFrame(30,30 , 50,50)
    
    Call wTypeKeys "<ESCAPE>"
    WaitSlot (5)
    
    '/// insert another frame
    Call fInsertFrame(50,50 , 80,80)
    
    printlog "Move the second frame away from the first one."
    Call wTypeKeys "<RIGHT>",10
    
    '/// Set focus to first frame
    Call wTypeKeys "<TAB>"
    Wait 500
    
    '/// Active frame bar
    Call hToolbarSelect("FRAME", true )
    Wait 500
    
    '/// Click link frame button
    Verketten.Click
    Wait 500
    
    '/// Target the second frame
    Call gMouseClick(60,70)
    Wait 500
    
    '/// Format/Frame / Type ,
    '/// + 'AutoSize' should be turned off in 1st frame (origination)
    Call fFormatFrame("TabType")
    try
        AutoHoehe.Check
        Warnlog "'AutoSize' should be turned off!"
    catch
    endcatch
    TabType.Cancel
    
    '/// Set focus to second frame
    Call wTypeKeys "<TAB>"
    Wait 500
    
    '/// + 'AutoSize' should be actived in 2nd frame (target)
    Call fFormatFrame("TabType")
    try
        AutoHoehe.Check
    catch
        Warnlog "'AutoSize' should be actived!"
    endcatch
    TabType.Cancel
    
    Call hCloseDocument

endcase

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

testcase tTextframes_34

    Dim sText         as String
    Dim sOriginalName as String
    Dim sTargetName   as String
    
    sOriginalName = "TEST1"
    sTargetName   = "TEST2"
    
    printlog "- Test attribute 'AutoSize' in linked frames"
    '/// Test attribute 'AutoSize' in linked frames
    
    Call hNewDocument
    
    '/// insert a frame , set frame name
    Call fInsertFrame(30,30 , 50,50)
    
    Call fFormatFrame("TabZusaetze")
    ObjektName.SetText sOriginalName
    TabZusaetze.OK
    
    Call wTypeKeys "<ESCAPE>"
    Wait 500
    
    '/// insert another frame , set frame name
    Call fInsertFrame(50,50 , 80,80)
    
    printlog "Move second frame away from the first frame."
    Call wTypeKeys "<RIGHT>", 12
    
    printlog "Name second object."
    Call fFormatFrame("TabZusaetze")
    ObjektName.SetText sTargetName
    TabZusaetze.OK
    
    '/// Set focus to first frame
    Call wTypeKeys "<TAB>"
    Wait 500
    
    '/// Active frame bar
    Call hToolbarSelect("FRAME", true )
    Wait 500
    
    '/// Click link frame button
    Verketten.Click
    Wait 500
    
    '/// Target the second frame
    Call gMouseClick(60,70)
    Wait 500
    
    Call wTypeKeys "<RETURN>"
    Wait 500
    
    Call wBlindtextEinfuegen
    Wait 500
    
    '/// set focus to the frame which the focus is in
    Call wTypeKeys "<ESCAPE>"
    Sleep 1
    
    '/// Check if the link is showed correctly (Format.Frame.Options)
    Call fFormatFrame("TabZusaetze")
    if ObjektName.GetText <> sTargetName then Warnlog "The focus should be in 2nd frame!"
    TabZusaetze.Cancel
    
    Call hCloseDocument

endcase

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

testcase tTextframes_35

    Dim iNoLink as Integer
    Dim iLink   as Integer
    
    iNoLink = 1
    iLink   = 2
    
    printlog "- Show link - under Format.Frame.Options (previous link, next link)"
    '/// Show link - under Format.Frame.Options (previous link, next link)
    
    Call hNewDocument
    
    '/// insert a frame
    Call fInsertFrame(30,30 , 50,50)
    
    Call wTypeKeys "<ESCAPE>"
    Wait 500
    
    '/// insert another frame
    Call fInsertFrame(50,50 , 80,80)
    
    printlog "Move the second frame away from the first one."
    Call wTypeKeys "<RIGHT>",10
    
    '/// Set focus to first frame
    Call wTypeKeys "<TAB>"
    Wait 500
    
    '/// Active frame bar
    Call hToolbarSelect("FRAME", true )
    Wait 500
    
    '/// Click link frame button
    Verketten.Click
    Wait 500
    
    '/// Target the second frame
    Call gMouseClick(60,70)
    Wait 500
    
    '/// Check if the link is showed correctly (Format.Frame.Options)
    Call fFormatFrame("TabZusaetze")
    if PreviousLink.GetSelIndex <> iNoLink then Warnlog "1st frame: privious link should be none"
    if NextLink.GetSelIndex     <> iLink   then Warnlog "1st frame: next link isn't right!"
    TabZusaetze.Cancel
    
    '/// Set focus to second frame
    Call wTypeKeys "<TAB>"
    Wait 500
    
    '/// Check if the link is showed correctly (Format.Frame.Options)
    Call fFormatFrame("TabZusaetze")
    if PreviousLink.GetSelIndex <> iLink   then Warnlog "2nd frame: privious link isn't right!"
    if NextLink.GetSelIndex     <> iNoLink then Warnlog "2nd frame: next link should be none"
    TabZusaetze.Cancel
    
    Call hCloseDocument

endcase

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

testcase tTextframes_36

    Dim sTestFile as String
    Dim sTestText as String
    Dim iNoLink   as Integer
    Dim iLink     as Integer
    
    sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\textframe\twopages.sxw")
    iNoLink   = 1
    iLink     = 2
    
    printlog "- Test link frames which are placed on different pages"
    '/// Test link frames which are placed on different pages
    
    Call hNewDocument
    
    '/// Open a test file
    '/// + This test file is designed for testing link
    '/// + frames which are placed on different pages
    '/// + There are 2 pages in the file and 1 frame/page
    hFileOpenLocally( sTestFile )
    
    
    'Set focus to first frame
    Call wTypeKeys ( "<Shift F4>" )
    Wait 500
    
    'Check if frame is in 1st page
    Kontext
    ViewNavigator
    Kontext "NavigatorWriter"
    Sleep 1
    if Seitennummer.GetText <> "1" then
        Warnlog "The test frame isn't in the first page!"
    end if
    Call fCloseNavigator
    
    'Set focus to second frame
    Call wTypeKeys "<TAB>"
    Wait 500
    
    'Check if frame is in 2nd page
    Kontext
    ViewNavigator
    Kontext "NavigatorWriter"
    Sleep 1
    if Seitennummer.GetText <> "2" then
        Warnlog "The test frame isn't in the second page!"
    end if
    Call fCloseNavigator
    
    '/// Set focus to first frame
    Call wTypeKeys "<TAB>"
    Wait 500
    
    '/// Set link in Format/Frame/Options
    Call fFormatFrame("TabZusaetze")
    try
        NextLink.Select iLink
        Sleep 1
    catch
        Warnlog "Can't link 2 frames which are placed on different pages!"
    endcatch
    TabZusaetze.OK
    
    '/// Check if the link is correctly
    Call fFormatFrame("TabZusaetze")
    if PreviousLink.GetSelIndex <> iNoLink then Warnlog "1st frame: privious link should be none"
    if NextLink.GetSelIndex     <> iLink   then Warnlog "1st frame: next link isn't right!"
    TabZusaetze.Cancel
    
    '/// Set focus to second frame
    Call wTypeKeys "<TAB>"
    Wait 500
    
    '/// Check if the link is correctly
    Call fFormatFrame("TabZusaetze")
    if PreviousLink.GetSelIndex <> iLink   then Warnlog "2nd frame: privious link isn't right!"
    if NextLink.GetSelIndex     <> iNoLink then Warnlog "2nd frame: next link should be none"
    TabZusaetze.Cancel
    
    printlog " Close active document "
    Do Until GetDocumentCount = 0
        Call hCloseDocument
    Loop

endcase

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

testcase tTextframes_37

    Dim sTestFile as String
    Dim sTestText as String
    Dim iNoLink   as String
    Dim iLink     as  Integer
    
    sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\textframe\Header.sxw")
    iNoLink   = 1
    iLink     = 2
    
    printlog "- Test link frames which are placed on header"
    '/// Test link frames which are placed on header
    
    Call hNewDocument
    
    '/// Open a test file
    '/// + This test file is designed for testing link
    '/// + frames which are placed on header
    '/// + There are 2 frames in the header
    
    hFileOpenLocally( sTestFile )
    
    
    '/// Set focus to first frame
    Call wTypeKeys ( "<Shift F4>" )
    
    Wait 500
    
    '/// Set link in Format.Frame.Options
    Call fFormatFrame("TabZusaetze")
    try
        NextLink.Select iLink
        Sleep 1
    catch
        Warnlog "Can't link 2 frames which are in the header"
    endcatch
    TabZusaetze.OK
    
    '/// Check if the link is correctly
    Call fFormatFrame("TabZusaetze")
    if PreviousLink.GetSelIndex <> iNoLink then Warnlog "1st frame: privious link should be none"
    if NextLink.GetSelIndex     <> iLink   then Warnlog "1st frame: next link isn't right!"
    TabZusaetze.Cancel
    
    '/// Set focus to second frame
    Call wTypeKeys "<TAB>"
    Wait 500
    
    '/// Check if the link is correctly
    Call fFormatFrame("TabZusaetze")
    if PreviousLink.GetSelIndex <> iLink   then Warnlog "2nd frame: privious link isn't right!"
    if NextLink.GetSelIndex     <> iNoLink then Warnlog "2nd frame: next link should be none"
    TabZusaetze.Cancel
    
    printlog " Close active document "
    Do Until GetDocumentCount = 0
        Call hCloseDocument
    Loop

endcase

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

testcase tTextframes_38

    Dim sTestFile as String
    Dim sTestText as  String
    Dim iNoLink   as String
    Dim iLink     as  Integer
    
    sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\textframe\Footer.sxw")
    iNoLink   = 1
    iLink     = 2
    
    printlog "- Test link frames which are placed on footer"
    '/// Test link frames which are placed on footer
    
    Call hNewDocument
    
    '/// Open a test file
    '/// + This test file is designed for testing link
    '/// + frames which are placed on header
    '/// + There are 2 frames in the header
    hFileOpenLocally( sTestFile )
    
    
    '/// Set focus to first frame
    Call wTypeKeys ( "<Shift F4>" )
    Wait 500
    
    '/// Set link in Format.Frame.Options
    Call fFormatFrame("TabZusaetze")
    try
        NextLink.Select iLink
        Sleep 1
    catch
        Warnlog "Can't link 2 frames which are in the header"
    endcatch
    TabZusaetze.OK
    
    '/// Check if the link is correctly
    Call fFormatFrame("TabZusaetze")
    if PreviousLink.GetSelIndex <> iNoLink then Warnlog "1st frame: privious link should be none"
    if NextLink.GetSelIndex     <> iLink   then Warnlog "1st frame: next link isn't right!"
    TabZusaetze.Cancel
    
    '/// Set focus to second frame
    Call wTypeKeys "<TAB>"
    Wait 500
    
    '/// Check if the link is correctly
    Call fFormatFrame("TabZusaetze")
    if PreviousLink.GetSelIndex <> iLink   then Warnlog "2nd frame: privious link isn't right!"
    if NextLink.GetSelIndex     <> iNoLink then Warnlog "2nd frame: next link should be none"
    TabZusaetze.Cancel
    
    printlog " Close active document "
    Do Until GetDocumentCount = 0
        Call hCloseDocument
    Loop

endcase

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

testcase tTextframes_39

    Dim sHorizontalBy1    as String
    Dim sHorizontalBy2    as String
    Dim sVerticalBy1      as String
    Dim sVerticalBy2      as String
    Dim sHorizontalByNew1 as String
    Dim sHorizontalByNew2 as String
    Dim sVerticalByNew1   as String
    Dim sVerticalByNew2   as String
    
    sHorizontalBy1    = "2"+ gSeperator + "00" + gMeasurementUnit
    sVerticalBy1      = "1"+ gSeperator + "00" + gMeasurementUnit
    sHorizontalBy2    = "7"+ gSeperator + "00" + gMeasurementUnit
    sVerticalBy2      = "4"+ gSeperator + "00" + gMeasurementUnit
    sHorizontalByNew1 = "3"+ gSeperator + "00" + gMeasurementUnit
    sVerticalByNew1   = "2"+ gSeperator + "00" + gMeasurementUnit
    sHorizontalByNew2 = "7"+ gSeperator + "00" + gMeasurementUnit
    sVerticalByNew2   = "4"+ gSeperator + "00" + gMeasurementUnit
    
    printlog "- Test drag&drop with a linked frame - keyboard"
    '/// Test drag&drop with a linked frame - keyboard
    
    Call hNewDocument
    
    '/// insert a frame and set Horizontal and Vertical
    Call fInsertFrame(30,30 , 49,49)
    
    Call fFormatFrame("TabType")
    HorizontalBy.SetText sHorizontalBy1
    wait 500
    VerticalBy.SetText sVerticalBy1
    wait 500
    TabType.OK
    
    Call wTypeKeys "<ESCAPE>"
    Wait 500
    
    '/// insert another frame and set Horizontal and Vertical
    Call fInsertFrame(51,51 , 80,80)
    
    Call fFormatFrame("TabType")
    HorizontalBy.SetText sHorizontalBy2
    wait 500
    VerticalBy.SetText sVerticalBy2
    wait 500
    TabType.OK
    
    Call wTypeKeys "<Tab>"
    
    '/// link two frames
    Call fFormatFrame("TabZusaetze")
    NextLink.Select 2
    Sleep 1
    TabZusaetze.OK
    
    '/// Move 1st frame with keyboard (right and down)
    Call wTypeKeys "<Right>"
    Sleep 1
    Call wTypeKeys "<Down>"
    Sleep 1
    
    Call fFormatFrame("TabType")
    if HorizontalBy.GetText <> sHorizontalByNew1 then QAErrorLog "#110726#1st frame: Horizontal by isn't right!"
    if VerticalBy.GetText   <> sVerticalByNew1   then QAErrorLog "#110726#1st frame: Vertical by isn't right!"
    TabType.Cancel
    
    Call wTypeKeys "<Tab>"
    
    '/// Move 2nd frame with keyboard (right and down)
    Call wTypeKeys "<Right>"
    Sleep 1
    Call wTypeKeys "<Down>"
    Sleep 1
    
    '/// Check the result
    Call fFormatFrame("TabType")
    if HorizontalBy.GetText <> sHorizontalByNew2 then QAErrorLog "#110726# 2nd frame: Horizontal by isn't right! "
    if VerticalBy.GetText   <> sVerticalByNew2   then QAErrorLog "#110726# 2nd frame: Vertical by isn't right! "
    TabType.Cancel
    
    Call hCloseDocument

endcase

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

testcase tTextframes_40

    Dim sHorizontalBy as String
    
    sHorizontalBy = "2"+ gSeperator + "00" + gMeasurementUnit
    
    printlog "- Test Undo on drag&drop of frames (keyboard)"
    '/// Test Undo on drag&drop of frames (keyboard)
    
    Call hNewDocument
    
    '/// insert a frame
    Call fInsertFrame(30,30 , 49,49)
    
    Call fFormatFrame("TabType")
    HorizontalBy.SetText sHorizontalBy
    wait 500
    TabType.OK
    
    Call wTypeKeys "<ESCAPE>"
    Wait 500
    
    '/// insert another frame
    Call fInsertFrame(51,51 , 80,80)
    
    printlog "Move the second frame away from the first one."
    Call wTypeKeys "<RIGHT>",10
'    Call wTypeKeys "<DOWN>",7
    
    Call wTypeKeys "<Tab>"
    
    '/// Active frame bar
    Call hToolbarSelect("FRAME", true )
    Wait 500
    
    '/// Click link frame button
    Verketten.Click
    Wait 500
    
    '/// Target the second frame
    Call gMouseClick(75,30)
    Wait 500
    
    '/// Move 1st frame with keyboard (Left)
    Call wTypeKeys "<Left>"
    Sleep 1
    
    '/// Edit / Undo
    EditUndo
    Wait 500
    
    '/// Check if the frame is moved
    Call fFormatFrame("TabType")
    if HorizontalBy.GetText <> sHorizontalBy then Warnlog "Undo on drag&drop of frames doesn't work!"
    TabType.Cancel
    
    Call hCloseDocument

endcase

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

testcase tTextframes_41

    Dim iLink as String
    Dim iNolink as Integer
    
    iLink   =  2
    iNolink =  1
    
    printlog "- Test Undo on removing the link"
    '/// Test Undo on removing the link
    
    Call hNewDocument
    
    '/// insert a frame
    Call fInsertFrame(30,30 , 49,49)
    
    Call wTypeKeys "<ESCAPE>"
    WaitSlot (5)
    
    '/// insert another frame
    Call fInsertFrame(51,51 , 80,80)
    
    printlog "Move the second frame away from the first one."
    Call wTypeKeys "<RIGHT>",10
    
    '/// Set focus to 1st frame
    Call wTypeKeys "<Tab>"
    
    '/// Active frame bar
    Call hToolbarSelect("FRAME", true )
    Wait 500
    
    '/// Click link frame button
    Verketten.Click
    Wait 500
    
    '/// Target the second frame
    Call gMouseClick(60,70)
    Wait 500
    
    '/// Remove link
    Kontext "FrameObjectbar"
    VerkettungLoesen.Click
    Wait 500
    
    Call fFormatFrame("TabZusaetze")
    if NextLink.GetSelIndex  <> iNoLink then Warnlog "Remove link doesn't work!"
    TabZusaetze.Cancel
    
    '/// Edit / Undo
    EditUndo
    Wait 500
    
    '/// check if the frame is moved
    Call fFormatFrame("TabZusaetze")
    if NextLink.GetSelIndex  <> iLink then Warnlog "Undo on removing link doesn't work!"
    TabZusaetze.Cancel
    
    Call hCloseDocument

endcase

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

testcase tTextframes_42

    Dim iNoLink as Integer
    
    iNoLink  =  1
    
    printlog "- Link frame in header with frame in bodytext should be forbidden"
    '/// Link frame in header with frame in bodytext should be forbidden
    
    Call hNewDocument
    
    '/// insert a frame in header
    DocumentWriter.UseMenu
    MenuSelect(Menugetitemid(4))
    Sleep 2
    MenuSelect(Menugetitemid(9))
    Sleep 2
    MenuSelect(Menugetitemid(1))
    Sleep 2
    
    Call wInsertFrame
    
    Call wTypeKeys "<ESCAPE>"
    Wait 500
    
    '/// insert another frame in bodytext
    Call fInsertFrame(50,50 , 70,65)
    
    Call wTypeKeys "<Tab>"
    
    '/// Try to link two frames
    Call hToolbarSelect("FRAME", true )
    Wait 500
    Verketten.Click
    Wait 500
    Call gMouseClick(60,60)
    Wait 500
    
    Call fFormatFrame("TabZusaetze")
    if NextLink.GetSelIndex  <> iNoLink then Warnlog "There should be no link between 2 frames!"
    TabZusaetze.Cancel
    
    Call hCloseDocument

endcase

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

testcase tTextframes_43

    Dim iLink as Integer
    
    iLink = 2
    
    printlog "- Link frame in footer with frame in bodytext should be forbidden"
    '/// Link frame in footer with frame in bodytext should be forbidden
    
    Call hNewDocument
    
    '/// insert a frame in footer
    DocumentWriter.UseMenu
    MenuSelect(Menugetitemid(4))
    Sleep 2
    MenuSelect(Menugetitemid(10))
    Sleep 2
    MenuSelect(Menugetitemid(1))
    Sleep 2
    
    Call wInsertFrame
    
    Call wTypeKeys "<ESCAPE>"
    Wait 500
    
    '/// insert another frame in bodytext
    Call fInsertFrame(50,50 , 70,70)
    
    Call wTypeKeys "<Tab>"
    
    '/// Try to link two frames
    Call fFormatFrame("TabZusaetze")
    Sleep 1
    try
        NextLink.Select iLink
        Sleep 1
        Warnlog "There should be no link between 2 frames!"
    catch
    endcatch
    TabZusaetze.Cancel
    
    Call hCloseDocument

endcase

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

testcase tTextframes_44

    Dim sText   as String
    Dim iNoLink as Integer
    
    sText    =  "Test"
    iNoLink  =  1
    
    printlog "- Link frame in footer with frame in bodytext should be forbidden"
    '/// Link frame in footer with frame in bodytext should be forbidden
    
    Call hNewDocument
    
    '/// insert a frame
    Call fInsertFrame(50,30 , 50,40)
    
    Call wTypeKeys "<ESCAPE>"
    Wait 500
    
    '/// insert another frame
    Call fInsertFrame(60,50 , 70,65)
    Call wTypeKeys "<ESCAPE>"
    
    '/// input some text in the target frame(2nd frame)
    Call gMouseClick(65,60)
    Call wTypeKeys sText
    
    Call wTypeKeys ( "<Shift F4>" )
    
    '/// link two frames
    Call hToolbarSelect("FRAME", true )
    Wait 500
    Verketten.Click
    Wait 500
    Call gMouseClick(50,60)
    Wait 500
    
    Call fFormatFrame("TabZusaetze")
    if NextLink.GetSelIndex  <> iNoLink then Warnlog "There should be no link between 2 frames!"
    TabZusaetze.Cancel
    
    Call hCloseDocument

endcase

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

testcase tTextframes_45

    Dim iNoLink as Integer
    
    iNoLink  =  1
    
    printlog "- Recursed links should be forbidden"
    '/// Recursed links should be forbidden
    
    Call hNewDocument
    
    '/// insert a frame
    Call fInsertFrame(30,30 , 45,45)
    
    Call wTypeKeys "<ESCAPE>"
    Wait 500
    
    '/// insert another frame
    Call fInsertFrame(50,50 , 70,70)
    
    printlog "Move the second frame away from the first one."
    Call wTypeKeys "<RIGHT>",1
    
    '/// set focus to 1st frame
    Call wTypeKeys "<TAB>"
    Sleep 1
    
    '/// link two frames (2nd frame is target frame)
    Kontext "FrameObjectbar"
    Sleep 2
    Verketten.Click
    Wait 500
    Call gMouseClick(60,60)
    Wait 500
    
    '/// link two frames (1st frame is target frame)
    Call wTypeKeys "<TAB>"
    Call hToolbarSelect("FRAME", true )
    Wait 500
    Verketten.Click
    Wait 500
    Call gMouseClick(35,35)
    Wait 500
    
    Call fFormatFrame("TabZusaetze")
    if NextLink.GetItemCount <> iNoLink then Warnlog "There should be no link between 2 frames!" & NextLink.GetItemCount 
    TabZusaetze.Cancel
    Wait 500
    
    Call hCloseDocument
endcase

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

testcase tTextframes_46

    Dim iNoLink as Integer
    
    iNoLink = 1
    
    printlog "- Frames couldn't be linked with the current one is part of another 'chain'"
    '/// Frames couldn't be linked with the current one is part of another 'chain'
    
    Call hNewDocument
    
    '/// insert a frame
    Call fInsertFrame(30,30 , 49,49)
    
    Call wTypeKeys "<ESCAPE>"
    Wait 500
    
    '/// insert another frame
    Call fInsertFrame(51,51 , 65,65)
    
    printlog "Move the frame away from the position of the first one."
    Call wTypeKeys "<RIGHT>",4
    Call wTypeKeys "<DOWN>",4
    
    Call wTypeKeys "<ESCAPE>"
    Wait 500
    
    '/// insert 3rd frame
    Call fInsertFrame(70,70 , 80,80)
    Wait 500
    
    printlog "Move the frame away from the position of the first one."
    Call wTypeKeys "<LEFT>",8
    Call wTypeKeys "<UP>",8
    
    '/// set focus to 1st frame
    Call wTypeKeys "<SHIFT F4>" 'make sure object is selected.
    Call wTypeKeys "<TAB>"
    Sleep 1
    
    '/// link two frames 1 & 2 (2nd frame is target frame)
    '/// Active frame bar
    Call hToolbarSelect("FRAME", true )
    Sleep 1
    Verketten.Click
    Sleep 1
    Call gMouseClick(70,70)
    Wait 500
    
    '/// set focus to 3rd frame
    Call wTypeKeys "<TAB>" , 2
    
    '/// link two frames 3 & 2 (2nd frame is target frame)
    Kontext "FrameObjectbar"
    Sleep 2
    Verketten.Click
    Sleep 1
    Call gMouseClick(70,70)
    Wait 500
    
    Call fFormatFrame("TabZusaetze")
    if NextLink.GetSelIndex  <> iNoLink then Warnlog "Shouldn't link to 2nd frame ! "
    TabZusaetze.Cancel
    Wait 500

    Call hCloseDocument
endcase

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

testcase tTextframes_47

    Dim iLink as Integer
    
    iLink = 2
    
    printlog "- Frames couldn't be linked with the current one is in protected section"
    '/// Frames couldn't be linked with the current one is in protected section
    
    Call hNewDocument
    
    '/// Insert a section
    InsertSection
    wait 500
    Kontext
    Active.Setpage TabBereiche
    Kontext "TabBereiche"
    wait 500
    TabBereiche.OK
    wait 500
    
    Call wTypeKeys "<UP>" , 1
    Call wTypeKeys "<RETURN>", 6
    
    '/// Insert a frame (A) in the section
    Call wInsertFrame
    Call wTypeKeys "<UP>" , 2
    Call wTypeKeys "<ESCAPE>"
    
    '/// Set the section to be protected
    FormatSections
    Kontext "BereicheBearbeiten"
    Geschuetzt.Check
    sleep 1
    BereicheBearbeiten.OK
    
    Call wTypeKeys "<DOWN>" , 10
        
    '/// Insert another frame (B) out of the section
    Call fInsertFrame(30,70 , 60,90)
    
    Call wTypeKeys "<RIGHT>" , 8
    Call wTypeKeys "<DOWN>" , 8
    
    '/// Link B->A (A is target)
    Call fFormatFrame("TabZusaetze")
    try
        NextLink.Select iLink
        Sleep 1
        QAErrorLog "#110862# Should NOT link 2 frames when target frame is in the protected section!"
    catch
    endcatch
    TabZusaetze.Cancel
    
    Call hCloseDocument

endcase

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

testcase tTextframes_48

    Dim iLink as Integer
    
    iLink = 2
    
    printlog "- Frames could be linked with the current one is set to 'editable in protected documents' even it is in protected section "
    
    Call hNewDocument
    
    printlog "Insert a section"
    InsertSection
    wait 500
    Kontext
    Active.Setpage TabBereiche
    Kontext "TabBereiche"
    wait 500
    TabBereiche.OK
    wait 500
    
    Call wTypeKeys "<UP>" , 1
    Call wTypeKeys "<RETURN>", 6
    
    printlog "Insert a frame (A) in the section , and check 'editable in protected documents'"
    Call wInsertFrame
    Call wTypeKeys "<UP>" , 2          
       
    Call fFormatFrame("TabZusaetze")
    Editierbar.Check
    wait 500
    TabZusaetze.OK
    
    Call wTypeKeys "<ESCAPE>"
    
    printlog "Set the section to be protected"
    FormatSections
    Kontext "BereicheBearbeiten"
    Geschuetzt.Check
    sleep 1
    BereicheBearbeiten.OK
    
    Call wTypeKeys "<DOWN>" , 10
    printlog "nsert another frame (B) out of the section"
    Call fInsertFrame(50,50 , 60,60)
    
    printlog "Link B->A (A is target)"
    Call fFormatFrame("TabZusaetze")
    try
        NextLink.Select iLink
        Sleep 1
    catch
        Warnlog "link 2 frames should work!"
    endcatch
    TabZusaetze.Cancel
    
    Call hCloseDocument

endcase

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