summaryrefslogtreecommitdiff
path: root/testautomation/writer/optional/includes/textframes/w_textframes2.inc
blob: c4cc19006f36c3d12b3de33523acbf93d4ec6af3 (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
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
'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 - 2
'*
'\***********************************************************************

sub w_textframes2

    Call tTextframes_17         'Test protect contents - text insertion in frame must be suppressed
    Call tTextframes_18         'Test protect position - moving frame with mouse/keyboard suppressed
    Call tTextframes_19         'Test if frame can move when protect content is checked
    Call tTextframes_20         'Test frame without wrap
    Call tTextframes_21         'Test frame with wrap ( through)
    Call tTextframes_22         'Test wrap - before/after - 1
    Call tTextframes_23         'Test wrap - before/after - 2
    Call tTextframes_24         'Set more than 1 columns for the frame
    Call tTextframes_25         'Test columns' width
    Call tTextframes_26         'Test columns' spacing
    Call tTextframes_27         'Test columns' seperator line
    Call tTextframes_28         'Test overlap with different wrapping types
    Call tTextframes_29         'Test 'synchronize' distances for border (Check Synchronize)
    Call tTextframes_30         'Test 'synchronize' distances for border (UnCheck Synchronize)
    Call tTextframes_31         'Frame should be non-editable in read-only documents
    Call tTextframes_32         'Test input text into frame in read-only document when checking "Editable in read-only document"

end sub

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

testcase tTextframes_17

    Dim sTestText
    
    sTestText = "T"
    
    printlog "- Test protect contents - text insertion in frame must be suppressed"
    
    Call hNewDocument
    
    '/// insert a frame
    Call fInsertFrame(30,30 , 60,60)
    
    '/// Format / Frame / Options , check contents
    Call fFormatFrame("TabZusaetze")
    InhaltSchuetzen.Check
    TabZusaetze.OK
    
    Call wTypeKeys "<ESCAPE>"
    Wait 500
    
    Call gMouseClick(40,40)
    Wait 500
    
    '/// check if contents can be inserted into frame
    Call wTypeKeys sTestText
    
    Kontext "Active"
    if Active.Exists then
        Active.Ok
    else
        Warnlog "The contents should not be inserted into frame!"
    end if
    
    Call hCloseDocument

endcase

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

testcase tTextframes_18

    Dim sTestText as String
    
    sTestText = "T"
    
    printlog "- Test protect position - moving frame with mouse/keyboard suppressed"
    
    Call hNewDocument
    
    '/// insert a frame
    Call fInsertFrame(30,30 , 70,70)
    
    '/// Format / Frame / Options , check contents
    Call fFormatFrame("TabZusaetze")
    InhaltSchuetzen.Check
    PositionSchuetzen.Check
    TabZusaetze.OK
    
    '/// Move the frame to right (Right key 4 times)
    Call wTypeKeys "<Right>" , 4
    Wait 500
    Call wTypeKeys "<ESCAPE>"
    Wait 500
    
    Call gMouseClick(40,40)
    Sleep 2
    
    '/// check if the frame is moved
    Call wTypeKeys sTestText
    
    Kontext "Active"
    if Active.Exists then
        Active.Ok
    else
        Warnlog "The contents should NOT be inserted into the frame!"
    end if
    
    Call wTypeKeys "<Shift Left>"
    try
        EditCopy
        Wait 500
        if GetClipboardText = sTestText then Warnlog "Something wrong in the test !"
    catch
    endcatch
    
    Call hCloseDocument
    
endcase

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

testcase tTextframes_19

    Dim sTestText
    
    sTestText = "T"
    
    printlog "- Test if frame can move when protect content is checked"
    
    Call hNewDocument
    
    '/// insert a frame
    Call fInsertFrame(30,30 , 70,70)
    
    '/// Format / Frame / Options , check contents
    Call fFormatFrame("TabZusaetze")
    InhaltSchuetzen.Check
    TabZusaetze.OK
    
    '/// Move the frame to right (Right key 4 times)
    Call wTypeKeys "<Right>" , 4
    Wait 500
    Call wTypeKeys "<ESCAPE>"
    Wait 500
    
    Call gMouseClick(15,15)
    Wait 500
    
    '/// check if the frame is moved
    Call wTypeKeys sTestText
    
    Kontext "Active"
    if Active.Exists then
        Warnlog "The frame should move by keyboard!"
        Active.Ok
    end if
    
    Call wTypeKeys "<Shift Left>"
    try
        EditCopy
        Wait 500
        if GetClipboardText <> sTestText then Warnlog "Something wrong in the test . Clipboard:" +GetClipboardText
    catch
        Warnlog "The frame should move by keyboard!"
    endcatch
    
    Call hCloseDocument

endcase

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

testcase tTextframes_20

    Dim sTestFile as String
    Dim sTestText as String
    
    sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\textframe\wrap.sxw")
    sTestText = "Test"
    
    printlog "- Test frame without wrap"
    
    '/// Open a test file
    '/// + This test file is designed for without wrap test
    '/// + There are 1 page in the file.
    '/// + The frame is ocupied in the whole 1st page and wraped as Through
    '/// + Some text are behind the frame
    hFileOpenLocally( sTestFile )
    
    
    '/// Set focus to frame
    Call wTypeKeys ( "<Shift F4>" )
    Sleep 1
    
    '/// Format / Frame / Wrap , check None in setting area
    Call fFormatFrame("TabUmlauf")
    Kein.Check
    wait 500
    TabUmlauf.OK
    
    '/// 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
    
    '/// Check if test text are in 2nd page
    Call wTypeKeys "<ESCAPE>"
    Call wTypeKeys "<Home><Shift End>"
    
    try
        EditCopy
        Wait 500
        if GetClipboardText <> sTestText then Warnlog "Test text isn't right , GetClipboardText is " +GetClipboardText
    catch
        Warnlog "EditCopy can't be executed !"
    endcatch
    
    Kontext
    ViewNavigator
    Kontext "NavigatorWriter"
    Sleep 1
    if Seitennummer.GetText <> "2" then
        Warnlog "The test text isn't in the second page!"
    end if
    
    Call fCloseNavigator
    
    printlog " Close active document "
    Do Until GetDocumentCount = 0
        Call hCloseDocument
    Loop
    
endcase

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

testcase tTextframes_21

    Dim sTestFile as String
    Dim sTestText as String
    
    sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\textframe\through.sxw")
    sTestText = "Test"
    
    printlog "- Test frame with wrap "
    
    '/// Open a test file
    '/// + This test file is designed for with through wrap test
    '/// + There are 2 page in the file.
    '/// + The frame is ocupied in the whole 1st page and wraped as None
    '/// + Some text are in the 2nd page
    
    hFileOpenLocally( sTestFile )
    
    
    '/// Set focus to frame
    Call wTypeKeys ( "<Shift F4>" )
    Sleep 1
    
    '/// Format / Frame / Wrap , check through in setting area
    Call fFormatFrame("TabUmlauf")
    Durchlauf.Check
    wait 500
    TabUmlauf.OK
    
    '/// Check if frame are 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
    
    '/// Check if test text are in 1st page
    Call wTypeKeys "<ESCAPE>"
    Call wTypeKeys "<Home><Shift End>"
    
    try
        EditCopy
        Wait 500
        if GetClipboardText <> sTestText then Warnlog "Test text isn't right , GetClipboardText is " +GetClipboardText
    catch
        Warnlog "EditCopy can't be executed !"
    endcatch
    
    Kontext
    ViewNavigator
    Kontext "NavigatorWriter"
    Sleep 1
    if Seitennummer.GetText <> "1" then
        Warnlog "The test text isn't in the first page!"
    end if
    
    Call fCloseNavigator
    
    printlog " Close active document "
    Do Until GetDocumentCount = 0
        Call hCloseDocument
    Loop

endcase

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

testcase tTextframes_22

    Dim sTestFile as String
    Dim sTestText as String
    
    sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\textframe\before.sxw")
    sTestText = "Test"
    
    printlog "- Test wrap - before/after - 1"
    
    '/// Open a test file
    '/// + This test file is designed for with before/after wrap test
    '/// + There are 2 page in the file.
    '/// + The frame is ocupied in the whole 1st page and wraped as None
    '/// + there are some space in the left of the frame.
    '/// + Some text are in the 2nd page
    
    hFileOpenLocally( sTestFile )
    
    
    printlog "- Test wrap - before"
    
    '/// Set focus to frame
    Call wTypeKeys ( "<Shift F4>" )
    Sleep 1
    
    '/// Format / Frame / Wrap , check before in setting area
    Call fFormatFrame("TabUmlauf")
    Links.Check
    wait 500
    TabUmlauf.OK
    
    '/// Check if frame are 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
    
    '/// Check if test text are in 1st page
    Call wTypeKeys "<ESCAPE>"
    Sleep 1
    Call wTypeKeys "<Home><Shift End>"
    
    try
        EditCopy
        Wait 500
        if GetClipboardText <> sTestText then Warnlog "Test text isn't right , GetClipboardText is " +GetClipboardText
    catch
        Warnlog "EditCopy can't be executed !"
    endcatch
    
    Kontext
    ViewNavigator
    Kontext "NavigatorWriter"
    Sleep 1
    if Seitennummer.GetText <> "1" then
        Warnlog "The test text isn't in the first page!"
    end if
    
    Call fCloseNavigator
    
    printlog "- Test wrap - after"
    
    'Set focus to frame
    Call wTypeKeys ( "<Shift F4>" )
    Sleep 1
    
    '/// Format / Frame / Wrap , check after in setting area
    Call fFormatFrame("TabUmlauf")
    Rechts.Check
    wait 500
    TabUmlauf.OK
    
    '/// Check if frame are 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
    
    '/// Check if test text are in 2nd page
    Call wTypeKeys "<ESCAPE>"
    Sleep 1
    Call wTypeKeys "<Home><Shift End>"
    
    try
        EditCopy
        Wait 500
        if GetClipboardText <> sTestText then Warnlog "Test text isn't right , GetClipboardText is " +GetClipboardText
    catch
        Warnlog "EditCopy can't be executed !"
    endcatch
    
    Kontext
    ViewNavigator
    Kontext "NavigatorWriter"
    Sleep 1
    if Seitennummer.GetText <> "2" then
        Warnlog "The test text isn't in the first page!"
    end if
    
    Call fCloseNavigator
    
    printlog " Close active document "
    Do Until GetDocumentCount = 0
        Call hCloseDocument
    Loop

endcase

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

testcase tTextframes_23

    Dim sTestFile as String
    Dim sTestText as String
    
    sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\textframe\after.sxw")
    sTestText = "Test"
    
    printlog "- Test wrap - before/after - 2"
    
    '/// Open a test file
    '/// + This test file is designed for with before/after wrap test
    '/// + There are 2 page in the file.
    '/// + The frame is ocupied in the whole 1st page and wraped as None
    '/// + there are some space in the right of the frame.
    '/// + Some text are in the 2nd page
    
    hFileOpenLocally( sTestFile )
    
    
    printlog "- Test wrap - before"
    
    '/// Set focus to frame
    Call wTypeKeys ( "<Shift F4>" )
    Sleep 1
    
    '/// Format / Frame / Wrap , check before in setting area
    Call fFormatFrame("TabUmlauf")
    Links.Check
    wait 500
    TabUmlauf.OK
    
    '/// Check if frame are 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
    
    '/// Check if test text are in 1st page
    Call wTypeKeys "<ESCAPE>"
    Sleep 1
    Call wTypeKeys "<Home><Shift End>"
    
    try
        EditCopy
        Wait 500
        if GetClipboardText <> sTestText then Warnlog "Test text isn't right , GetClipboardText is " +GetClipboardText
    catch
        Warnlog "EditCopy can't be executed !"
    endcatch
    
    Kontext
    ViewNavigator
    Kontext "NavigatorWriter"
    Sleep 1
    if Seitennummer.GetText <> "2" then
        Warnlog "The test text isn't in the first page!"
    end if
    
    Call fCloseNavigator
    
    printlog "- Test wrap - after"
    
    '/// Set focus to frame
    Call wTypeKeys ( "<Shift F4>" )
    Sleep 1
    
    '/// Format / Frame / Wrap , check after in setting area
    Call fFormatFrame("TabUmlauf")
    Rechts.Check
    wait 500
    TabUmlauf.OK
    
    '/// Check if frame are 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
    
    '/// Check if test text are in 2nd page
    Call wTypeKeys "<ESCAPE>"
    Sleep 1
    Call wTypeKeys "<Home><Shift End>"
    
    try
        EditCopy
        Wait 500
        if GetClipboardText <> sTestText then Warnlog "Test text isn't right , GetClipboardText is " +GetClipboardText
    catch
        Warnlog "EditCopy can't be executed !"
    endcatch
    
    Kontext
    ViewNavigator
    Kontext "NavigatorWriter"
    Sleep 1
    if Seitennummer.GetText <> "1" then
        Warnlog "The test text isn't in the first page!"
    end if
    
    Call fCloseNavigator
    
    printlog " Close active document "
    Do Until GetDocumentCount = 0
        Call hCloseDocument
    Loop

endcase

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

testcase tTextframes_24

    Dim sColumn as String
    
    sColumn = "3"
    
    printlog "- Set more than 1 columns for the frame"
    
    Call hNewDocument
    
    '/// Insert a frame
    Call wInsertFrame
    
    '/// Format / Frame / columns , set columns to 3 , close the dialogue
    Call fFormatFrame("TabSpalten")
    Anzahl.SetText sColumn
    wait 500
    TabSpalten.OK
    
    '/// Check if the column is set correctly
    Call fFormatFrame("TabSpalten")
    if Anzahl.GetText <> sColumn then Warnlog "the column isn't set correctly ! The column you get is:Anzahl.GetText"
    TabSpalten.Cancel
    
    Call hCloseDocument

endcase

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

testcase tTextframes_25

    Dim sWidth            as String
    Dim sSpacingToContent as String
    Dim sColumn           as String
    Dim sWidthColumn1     as String
    Dim sWidthColumn2     as String
    Dim sWidthColumn3     as String
    
    sWidth            = "6"+ gSeperator + "00" + gMeasurementUnit
    sSpacingToContent = "0"+ gSeperator + "00"
    
    sColumn = "3"
    
    sWidthColumn1 = "1"+ gSeperator + "00" + gMeasurementUnit
    sWidthColumn2 = "2"+ gSeperator + "00" + gMeasurementUnit
    sWidthColumn3 = "3"+ gSeperator + "00" + gMeasurementUnit
    
    printlog "- Test columns' width"
    
    Call hNewDocument
    
    '/// Insert a frame
    Call wInsertFrame
    
    'Set frame's width
    Call fFormatFrame("TabType")
    Width.SetText sWidth
    wait 500
    TabType.OK
    
    'Set frame's Spacing to Content
    Call fFormatFrame("TabUmrandung")
    Synchronisieren.Check
    wait 500
    TabUmrandung.TypeKeys "<SHIFT TAB>"
    Links.SetText sSpacingToContent
    Rechts.SetText sSpacingToContent
    Oben.SetText sSpacingToContent
    Unten.SetText sSpacingToContent
    wait 500
    TabUmrandung.TypeKeys "<SHIFT TAB>"
    TabUmrandung.OK
    
    '/// Format / Frame / columns , set columns to 3
    Call fFormatFrame("TabSpalten")
    Anzahl.SetText sColumn
    wait 500
    TabSpalten.OK
    
    '/// + Set 3 columns to different width
    Call fFormatFrame("TabSpalten")
    AutomBreite.Uncheck
    Sleep 1
    TabSpalten.TypeKeys "<SHIFT TAB>"
    Spaltenbreite1.SetText sWidthColumn1
    wait 500
    TabSpalten.TypeKeys "<SHIFT TAB>"
    Spaltenbreite2.SetText sWidthColumn2
    wait 500
    TabSpalten.TypeKeys "<SHIFT TAB>"
    Spaltenbreite3.SetText sWidthColumn3
    wait 500
    TabSpalten.TypeKeys "<SHIFT TAB>"
    TabSpalten.OK
    
    '/// Check if the columns' width is set correctly
    Call fFormatFrame("TabSpalten")
    if Spaltenbreite1.GetText <> sWidthColumn1 then Warnlog "the column1's width isn't set correctly !"
    if Spaltenbreite2.GetText <> sWidthColumn2 then Warnlog "the column2's width isn't set correctly !"
    if Spaltenbreite3.GetText <> sWidthColumn3 then Warnlog "the column3's width isn't set correctly !"
    TabSpalten.Cancel
    
    Call hCloseDocument

endcase

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

testcase tTextframes_26
    
    Dim sWidth            as String
    Dim sSpacingToContent as String
    Dim sColumn           as String
    Dim sWidthColumn1     as String
    Dim sWidthColumn2     as String
    Dim sWidthColumn3     as String
    Dim sSpacing1         as String
    Dim sSpacing2         as String
    Dim sNewWidthColumn1  as String
    Dim sNewWidthColumn2  as String
    Dim sNewWidthColumn3  as String
    Dim sNewWidthColumn4  as String
    
    sWidth            = "6"+ gSeperator + "00" + gMeasurementUnit
    sSpacingToContent = "0"+ gSeperator + "00"
    
    sColumn = "3"
    
    sWidthColumn1     = "1"+ gSeperator + "00" + gMeasurementUnit
    sWidthColumn2     = "2"+ gSeperator + "00" + gMeasurementUnit
    sWidthColumn3     = "3"+ gSeperator + "00" + gMeasurementUnit
    
    sSpacing1         = "0"+ gSeperator + "10" + gMeasurementUnit
    sSpacing2         = "0"+ gSeperator + "20" + gMeasurementUnit
    
    sNewWidthColumn1  = "1"+ gSeperator + "00" + gMeasurementUnit
    sNewWidthColumn2  = "1"+ gSeperator + "90" + gMeasurementUnit
    sNewWidthColumn3  = "2"+ gSeperator + "80" + gMeasurementUnit
    sNewWidthColumn4  = "2"+ gSeperator + "81" + gMeasurementUnit
    
    printlog "- Test columns' spacing"
    
    Call hNewDocument
    
    '/// Insert a frame
    Call wInsertFrame
    
    'Set frame's width
    Call fFormatFrame("TabType")
    Width.SetText sWidth
    wait 500
    TabType.TypeKeys "<SHIFT TAB>"
    TabType.OK
    
    'Set frame's Spacing to Content
    Call fFormatFrame("TabUmrandung")
    Synchronisieren.Check
    wait 500
    Links.SetText sSpacingToContent
    Rechts.SetText sSpacingToContent
    Oben.SetText sSpacingToContent
    Unten.SetText sSpacingToContent
    wait 500
    TabUmrandung.TypeKeys "<SHIFT TAB>"
    TabUmrandung.OK
    
    '/// Format / Frame / columns , set columns to 3
    Call fFormatFrame("TabSpalten")
    Anzahl.SetText sColumn
    wait 500
    TabSpalten.OK
    
    '/// + Set 3 columns to different width
    Call fFormatFrame("TabSpalten")
    AutomBreite.Uncheck
    Sleep 1
    TabSpalten.TypeKeys "<SHIFT TAB>"
    Spaltenbreite1.SetText sWidthColumn1
    wait 500
    TabSpalten.TypeKeys "<SHIFT TAB>"
    Spaltenbreite2.SetText sWidthColumn2
    wait 500
    TabSpalten.TypeKeys "<SHIFT TAB>"
    Spaltenbreite3.SetText sWidthColumn3
    wait 500
    TabSpalten.TypeKeys "<SHIFT TAB>"
    TabSpalten.OK
    
    '/// + Set Spacing1 and Spacing2
    Call fFormatFrame("TabSpalten")
    Abstand12.SetText sSpacing1
    Sleep 2
    Abstand23.SetText sSpacing2
    Sleep 3
    Art.Select 1
    Sleep 1
    TabSpalten.OK
    Sleep 2
    
    '/// Check if the columns' width is set correctly
    Call fFormatFrame("TabSpalten")
    if Spaltenbreite1.GetText <> sNewWidthColumn1 then Warnlog "the column1's width isn't set correctly !"
    if Spaltenbreite2.GetText <> sNewWidthColumn2 then Warnlog "the column2's width isn't set correctly !"
    if (Spaltenbreite3.GetText <> sNewWidthColumn3) then
        if (Spaltenbreite3.GetText <> sNewWidthColumn4) then
            Warnlog "the column3's width isn't set correctly ! (not" & Spaltenbreite3.GetText & " but " & sNewWidthColumn3 & ")"
        end if
    end if
    if Abstand12.GetText <> sSpacing1 then Warnlog "the 1st spacing isn't set correctly !"
    if Abstand23.GetText <> sSpacing2 then Warnlog "the 2nd spacing isn't set correctly !"
    TabSpalten.Cancel
    
    Call hCloseDocument

endcase

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

testcase tTextframes_27
    
    Dim iLine     as Integer
    Dim iPosition as Integer
    Dim sHeight   as String
    
    iLine     = 3
    iPosition = 2
    sHeight   = "50%"
    
    printlog "- Test columns' seperator line"
    
    Call hNewDocument
    
    '/// Insert a frame
    Call wInsertFrame
    
    '/// Format / Frame / columns , set columns to 4
    '/// + default : column is 1 , Line and Height and Position isn't enabled
    Call fFormatFrame("TabSpalten")
    if Anzahl.GetText <> "1" then  Warnlog "the default column number is 1 , but get " +Anzahl.GetText
    
    try
        Art.Select      iLine
        Warnlog "Line : should be inactived !"
        Hoehe.SetText   sHeight
        Warnlog "Height : should be inactived !"
        Position.Select iPosition
        Warnlog "Position : should be inactived !"
    catch
    endcatch
    
    Anzahl.SetText "2"
    Wait 500
    TabSpalten.OK
    
    '/// Check if the columns' width is set correctly
    Call fFormatFrame("TabSpalten")
    Art.Select      iLine
    Sleep 2
    Hoehe.SetText   sHeight
    Sleep 2
    Position.Select iPosition
    Sleep 2
    TabSpalten.OK
    
    Call fFormatFrame("TabSpalten")
    if Art.GetSelIndex      <> iLine      then Warnlog "Line isn't correct!"
    Sleep 1
    if Hoehe.GetText        <> sHeight    then Warnlog "Height isn't correct!"
    Sleep 1
    if Position.GetSelIndex <> iPosition  then Warnlog "Position isn't correct!"
    Sleep 1
    TabSpalten.Cancel
    
    Call hCloseDocument
    
endcase

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

testcase tTextframes_28

    Dim sFrameName1 as String
    Dim sFrameName2 as String
    
    sFrameName1 = "Test1"
    sFrameName2 = "Test2"
    
    printlog "- Test overlap with different wrapping types"
    
    Call hNewDocument
    
    printlog "Insert a frame"
    Call fInsertFrame(30, 30, 60, 60)
    Sleep 2
    printlog "Naming the frame"
    Call fFormatFrame("TabZusaetze")
    ObjektName.SetText sFrameName1
    TabZusaetze.OK
    
    printlog "Set the frame's wrap"
    Call fFormatFrame("TabUmlauf")
    Kein.Check
    Sleep 1
    TabUmlauf.OK
    Sleep 2
    Call wTypeKeys "<ESCAPE>"
    Sleep 2
    
    printlog "Insert another frame"
    Call fInsertFrame(50, 50, 80, 80)
    Sleep 2
    printlog "Naming the frame"
    Call fFormatFrame("TabZusaetze")
    ObjektName.SetText sFrameName2
    TabZusaetze.OK
    
    printlog "Set the frame's wrap"
    Call fFormatFrame("TabUmlauf")
    Sleep 1
    Durchlauf.Check
    Sleep 1
    TabUmlauf.OK
    
    Call wTypeKeys "<ESCAPE>"
    Sleep 2
    
    printlog "Set focus to second frame"
    Call gMouseClick(60,60) ' Click into frame
    wait 500
    Call wTypeKeys "<ESCAPE>" ' Selects frame holding the cursor
    wait 500
    
    printlog "Check second frame's name"
    Call fFormatFrame("TabZusaetze")
    if ObjektName.GetText <> sFrameName2 then Warnlog "The 2nd frame's name is wrong ! Get " +ObjektName.GetText
    TabZusaetze.Cancel
    
    printlog "Check second frame's wrap status"
    Call fFormatFrame("TabUmlauf")
    if Durchlauf.IsChecked <> TRUE then Warnlog "The 2nd frame's wrap status is wrong ! "
    TabUmlauf.Cancel
    
    printlog "Set focus to first frame"
    Call wTypeKeys "<TAB>"
    Sleep 2
    
    printlog "Check first frame's name"
    Call fFormatFrame("TabZusaetze")
    if ObjektName.GetText <> sFrameName1 then Warnlog "The 1st frame's name is wrong ! Get " +ObjektName.GetText
    TabZusaetze.Cancel
    
    printlog "Check first frame's wrap status"
    Call fFormatFrame("TabUmlauf")
    if Kein.IsChecked <> TRUE then Warnlog "The 1st frame's wrap status is wrong ! "
    TabUmlauf.Cancel
    
    Call hCloseDocument

endcase

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

testcase tTextframes_29

    Dim sLeft1   as String
    Dim sRight1  as String
    Dim sTop1    as String
    Dim sBottom1 as String
    
    sLeft1   =  "0"+ gSeperator + "1"
    sRight1  =  "0"+ gSeperator + "2"
    sTop1    =  "0"+ gSeperator + "3"
    sBottom1 =  "0"+ gSeperator + "4"
    
    printlog "- Test 'synchronize' distances for border (Check Synchronize)"
    
    Call hNewDocument
    
    '/// insert a frame
    Call wInsertFrame
    
    '/// Format / Frame / Borders , check Synchronize ,
    '/// + then set spacing to contents
    '/// + to differect number (left, right, top, bottom)
    Call fFormatFrame("TabUmrandung")
    Synchronisieren.Check
    wait 500
    Links.SetText    sLeft1
    wait 500
    TabUmrandung.TypeKeys "<SHIFT TAB>"
    Rechts.SetText   sRight1
    wait 500
    TabUmrandung.TypeKeys "<SHIFT TAB>"
    Oben.SetText     sTop1
    wait 500
    TabUmrandung.TypeKeys "<SHIFT TAB>"
    Unten.SetText    sBottom1
    wait 500
    TabUmrandung.TypeKeys "<SHIFT TAB>"
    TabUmrandung.OK
    
    '/// Check if the spacing to contents is right
    Call fFormatFrame("TabUmrandung")
    if Synchronisieren.IsChecked <> TRUE     then Warnlog "checkbox synchronize should be checked!"
    if Instr(Links.Gettext, sBottom1) = false then Warnlog "spacing to contents (left) isn't right!"
    if Instr(Rechts.GetText, sBottom1) = false then Warnlog "spacing to contents (right) isn't right!"
    if Instr(Oben.GetText, sBottom1) = false then Warnlog "spacing to contents (top) isn't right!"
    if Instr(Unten.GetText, sBottom1) = false then Warnlog "spacing to contents (bottom) isn't right!"
    TabUmrandung.Cancel
    
    Call hCloseDocument

endcase

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

testcase tTextframes_30

    Dim sLeft1   as String
    Dim sRight1  as String
    Dim sTop1    as String
    Dim sBottom1 as String
    
    sLeft1   =  "0"+ gSeperator + "1"
    sRight1  =  "0"+ gSeperator + "2"
    sTop1    =  "0"+ gSeperator + "3"
    sBottom1 =  "0"+ gSeperator + "4"
    
    printlog "- Test 'synchronize' distances for border (UnCheck Synchronize)"
    
    Call hNewDocument
    
    '/// insert a frame
    Call wInsertFrame
    
    '/// Format / Frame / Borders , Uncheck Synchronize ,
    '/// + then set spacing to contents
    '/// + to differect number (left, right, top, bottom)
    Call fFormatFrame("TabUmrandung")
    Synchronisieren.UnCheck
    wait 500
    Links.SetText    sLeft1
    wait 500
    TabUmrandung.TypeKeys "<SHIFT TAB>"
    TabUmrandung.TypeKeys "<SHIFT TAB>"
    Rechts.SetText   sRight1
    wait 500
    TabUmrandung.TypeKeys "<SHIFT TAB>"
    Oben.SetText     sTop1
    wait 500
    TabUmrandung.TypeKeys "<SHIFT TAB>"
    Unten.SetText    sBottom1
    wait 500
    TabUmrandung.TypeKeys "<SHIFT TAB>"
    TabUmrandung.OK
    
    '/// Check if the spacing to contents is right
    Call fFormatFrame("TabUmrandung")
    if Synchronisieren.IsChecked = TRUE then Warnlog "checkbox synchronize should be checked!"
    if Instr(Links.Gettext, sLeft1) = false  then Warnlog "spacing to contents (left) isn't right!"  '<> sLeft1
    if Instr(Rechts.GetText, sRight1) = false then Warnlog "spacing to contents (right) isn't right!"
    if Instr(Oben.GetText, sTop1) = false then Warnlog "spacing to contents (top) isn't right!"
    if Instr(Unten.GetText, sBottom1) = false then Warnlog "spacing to contents (bottom) isn't right!"
    TabUmrandung.Cancel
    
    Call hCloseDocument
    
endcase

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

testcase tTextframes_31

    Dim sTestFile as String
    
    sTestFile = ConvertPath (gOfficePath + "user\work\testFileReadOnly.odt" )
    
    if Dir(sTestFile) <> "" then
        setattr sTestFile , 0
        Sleep 2
        kill sTestFile
    end if
    
    printlog "- Frame should be non-editable in read-only documents"
    
    Call hNewDocument
    
    '/// insert a frame
    Call wInsertFrame
    
    '/// Save the file and set the file's property to Read-only
    Call hFileSaveAs (sTestFile ,true)
    
    Call hCloseDocument
    Sleep 1
    
    setattr sTestFile , 1
    Sleep 2
    
    '/// Check if the frame is non-editable
    hFileOpen( sTestFile )
    
    Call wTypeKeys ( "<Shift F4>" )
    
    try
        FormatFrame
        Kontext
        Active.SetPage TabType
        Kontext "TabType"
        TabType.Cancel
        Warnlog "The frame should be non-editable!"
    catch
    endcatch
    
    Call hCloseDocument
    
endcase

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

testcase tTextframes_32

    Dim sTestFile as String
    Dim sText     as String
    
    sText     = "Test"
    sTestFile = ConvertPath (gOfficePath + "user\work\testFileReadOnly.odt" )
    
    if Dir(sTestFile) <> "" then
        setattr sTestFile , 0
        Sleep 2
        kill sTestFile
    end if
    
    printlog "- Test input text into frame in read-only document when checking 'Editable in read-only document'"
    
    Call hNewDocument
    
    '/// insert a frame
    Call fInsertFrame(30,30 , 70,70)
    
    '/// Format / Frame / Options , check "Editable in read-only document"
    Call fFormatFrame("TabZusaetze")
    Editierbar.Check
    wait 500
    TabZusaetze.OK
    Call wTypeKeys "<ESCAPE>"
    
    '/// Save the file and set the file's property to Read-only
    Call hFileSaveAs (sTestFile ,true)
    
    Call hCloseDocument
    
    setattr sTestFile , 1
    Sleep 2
    
    '/// Check if the text can be inputed into frame
    hFileOpen( sTestFile )
    
    Call wTypeKeys "<SHIFT F4><RETURN>"
    Wait 500
    
    try
        Call wTypeKeys sText
        Sleep 1
    catch
        Warnlog "Can't input text into frame !"
    endcatch
    
    Call wTypeKeys "<Shift Home>"
    Sleep 1
    
    EditCopy
    Sleep 1
    
    if GetClipboardText <> sText then Warnlog "The inputed text isn't right!"
    
    Call hCloseDocument
    
endcase

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