summaryrefslogtreecommitdiff
path: root/testautomation/writer/optional/includes/section/w_section_3.inc
blob: dda8ebda7212b03d0325db4217898837eef6b9cc (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
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
'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@sun.com
'*
'* short description : Hide section /Protect section / Display of dialogues
'*
'************************************************************************
'*
' #1 tBookmarkSection_1
' #1 tBookmarkSection_2
' #1 tFootnoteEndnoteSection_1
' #1 tFootnoteEndnoteSection_2
' #1 tFootnoteEndnoteSection_3
' #1 tFootnoteEndnoteSection_4
' #1 tFootnoteEndnoteSection_5
' #1 tFootnoteEndnoteSection_6
' #1 tMultiColumnSection_1
' #1 tMultiColumnSection_2
' #1 tMultiColumnSection_3
' #1 tOperationSection_1
' #1 tOperationSection_2
' #1 tOperationSection_3
' #1 tPasswordProtectSection_1
' #1 tPasswordProtectSection_2
' #1 tPasswordProtectSection_3
' #1 tPasswordProtectSection_4
' #1 tWrappedSections_1
' #1 tWrappedSections_2
' #1 tWrappedSections_3
' #1 tWrappedSections_4
' #1 tWrappedSections_5
' #1 tWrappedSections_6
' #1 tWrappedSections_7
'*
'\***********************************************************************

sub w_section_3

    printLog Chr(13) + "---------   Insert bookmarks into sections   ----------"
    Call tBookmarkSection_1          'Insert bookmarks into section, jump to
    Call tBookmarkSection_2          'Insert bookmarks into a protect section, jump to
    
    printLog Chr(13) + "---------   Footnotes/Endnotes in sections   ----------"
    Call tFootnoteEndnoteSection_1       'select Text, that contains foot-/endnotes, insert section
    Call tFootnoteEndnoteSection_2       'insert footnote into text of an existing section
    Call tFootnoteEndnoteSection_3       'footnote text must be protected  in a protected section
    Call tFootnoteEndnoteSection_4       'linked sections, where source section contains footnotes , footnote text must be also protected
    Call tFootnoteEndnoteSection_5       'footnotes in hidden areas 1 footnote text must also be hidden
    Call tFootnoteEndnoteSection_6       'ALL footnotes appear before the endnotes
    
    printLog Chr(13) + "---------   Multi-column sections   ----------"
    Call tMultiColumnSection_1       'Create multi-column section directly when inserting via dialogue (TabPage "Columns")
    Call tMultiColumnSection_2       'Create multi-column section from format/section - options (TabPage "Columns")
    Call tMultiColumnSection_3       'Fill columns balanced -- Active
    
    printLog Chr(13) + "---------   Cut/copy/paste/move/delete sections   ----------"
    Call tOperationSection_1          'Cut/copy/paste/move/delete sections -- Shortcut
    Call tOperationSection_2          'Cut/copy/paste/move/delete sections -- function bar
    Call tOperationSection_3          'when inserting from clipboard the sections have to be named automatically with the correct number
    
    printLog Chr(13) + "---------   Password protect sections   ----------"
    Call tPasswordProtectSection_1          'Format - Section: check "Password protected" PW-Dialogue has to appear two times
    Call tPasswordProtectSection_2          'reload document, Format-section 1 PW-Dialog has to appear
    Call tPasswordProtectSection_3          'try wrong password ,Error massage should appear, sections-dialogue not accessible
    Call tPasswordProtectSection_4          'Remove password protection by unchecking, reload document, Format-sections 'PW-dialogue' should NOT appear
    
    printLog Chr(13) + "---------   Wrapping and Wrapped sections   ----------"
    Call tWrappedSections_1          'select Text inside a section and insert a section
    Call tWrappedSections_2          'select text across a section an insert a section
    Call tWrappedSections_3          'wrapped sections are following properties of the wrapping section - write protection
    Call tWrappedSections_4          'wrapped sections are following properties of the wrapping section - visibility
    Call tWrappedSections_5          'wrapped sections are following properties of the wrapping section - Foot-/endnote position
    Call tWrappedSections_6          'The formatting of columns of sectionWrapping and sectionWrapped can be configured separately
    Call tWrappedSections_7          'The background graphic of sectionWrapping and sectionWrapped can be configured separately

end sub

'***********************************************************************

testcase tBookmarkSection_1

    Dim sectionName as String
    Dim testText as String
    Dim bookmarkName as String

    sectionName  = "bookmarkSection"
    bookmarkName = "myBookmark"
    testText     = "Hello World"
    
    PrintLog "   - Insert bookmarks into a section, jump to"
    
    Call hNewDocument
    
    PrintLog " insert a section , and input Text"
    Call wTypeKeys testText
    Call wTypeKeys "<Shift Home>"
    fInsertSection(sectionName)
    
    PrintLog " insert a bookmark in front of Text"
    try
        fInsertBookmark(bookmarkName)
    catch
        Warnlog "   Insert a bookmark into a section failed"
    endcatch

    printlog "set the focus end of Text, make sure no text is marked."
    Call wTypeKeys "<End><SPACE><BACKSPACE>"

    PrintLog " active Navigator, double click the bookmark which be inserted,"
    PrintLog " + then the focus should be in front of $testText"
    Call wNavigatorAuswahl(6,1, true)
    Auswahlliste.TypeKeys "<return>"
    sleep(1)
'    Call wTypeKeys "<Shift End>"  'Outcommented since the bookmark also selects the text. Just like it was when it got bookmarked.
'    sleep(1)
    EditCopy
    sleep(1)
    if GetClipboardText <> testText then Warnlog "The focus is NOT in front of " +testText
    
    printlog "Close Navigator before close the document"
    fCloseNavigator
    
    Call hCloseDocument
endcase

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

testcase tBookmarkSection_2

    Dim sectionName as String
    Dim testText as String
    Dim bookmarkName as String

    sectionName  = "bookmarkSection"
    bookmarkName = "myBookmark"
    testText     = "Hello World"

    PrintLog "   - Jump to for bookmarks in a protect section"

    Call hNewDocument
    sleep(2)
    PrintLog " Open options and check 'Direct-Cursor' in options"
    Call fCheckDirectCursor
    sleep(2)
    PrintLog " insert a bookmark in front of Text"
    Call fInsertBookmark(bookmarkName)
    sleep(2)
    PrintLog " insert Text"
    Call wTypeKeys testText
    Call wTypeKeys "<Shift Home>"
    sleep(1)
    PrintLog " insert a section with protect option"
    InsertSection
    sleep(2)
    Kontext
    Active.Setpage TabBereiche
    Kontext "TabBereiche"
    Bereichsliste.Settext sectionName
    Geschuetzt.Check
    TabBereiche.OK
    sleep(2)
    
    PrintLog " set the focus end of Text"
    Call wTypeKeys "<End>"
    sleep(2)
    PrintLog " active Navigator, double click the bookmark which be inserted,"
    PrintLog " + then the focus should be in front of Text"
    Call wNavigatorAuswahl(6,1, true)
    sleep(2)
    Auswahlliste.TypeKeys "<down><return>"
    sleep(2)
    Call wTypeKeys "<Shift End>"
    sleep(1)
    EditCopy
    sleep(2)
    if GetClipboardText <> testText then Warnlog "The focus is NOT in front of " & testText
    printlog "Close Navigator before close the document"
    Call fCloseNavigator
    sleep(1)
    Call hCloseDocument
endcase

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

testcase tFootnoteEndnoteSection_1

    Dim sectionName as String
    Dim testText as String
    Dim preMessage as String
    
    sectionName  = "FootnoteEndnoteSection"
    testText     = "This is footnotes/endnotes test"

    PrintLog "   - Insert a section that contains foot-/endnotes"

    Call hNewDocument

    PrintLog " insert footnote in front of Text"
    fInsertFootnote("automatic")
    Call wTypeKeys "<PageUp>"

    PrintLog " insert some test words"
    Call wTypeKeys testText

    PrintLog " insert endnote at end of Text"
    fInsertEndnote("automatic")
    Call wTypeKeys "<PageUp>"

    EditSelectAll
    sleep(1)
    EditCopy
    sleep(1)
    preMessage = GetClipBoardtext

    PrintLog " insert a section which include Text, foot-/endnotes"
    try
       fInsertSection(sectionName)
       EditSelectAll
       sleep(1)
       EditCopy
       sleep(1)
       if GetClipboardText <> preMessage then Warnlog "There is something changed aftering inserting the section which include Text, foot-/endnotes"
    catch
       Warnlog "   Could NOT insert a section which include Text, foot-/endnotes"
    endcatch
    
    Call hCloseDocument
endcase

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

testcase tFootnoteEndnoteSection_2

    Dim sectionName as String
    Dim testText as String
    Dim preMessage as String

    sectionName  = "FootnoteEndnoteSection"
    testText     = "This is footnotes/endnotes test"

    PrintLog "   - insert footnote/endnote into text of an existing section "

    Call hNewDocument

    PrintLog " insert some test words"
    Call wTypeKeys testText
    Call wTypeKeys "<Shift Home>"

    PrintLog " insert a section which include Text"
    fInsertSection(sectionName)

    Call wTypeKeys "<Home>"

    PrintLog " insert footnote into the section"
    try
       fInsertFootnote("automatic")
    catch
       Warnlog "   Could NOT insert a footnote into the section"
    endcatch

    Call wTypeKeys "<PageUp><End>"

    PrintLog " insert endnote into the section"
    try
       fInsertEndnote("automatic")
    catch
       Warnlog "   Could NOT insert a endnote into the section"
    endcatch

    Call hCloseDocument
endcase

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

testcase tFootnoteEndnoteSection_3

    Dim sectionName as String
    Dim preMessage as String

    sectionName  = "FootnoteEndnoteSection"

    PrintLog "   - footnote text must be protected  in a protected section"

    Call hNewDocument

    PrintLog " Open options and check 'Direct-Cursor' in options"
    fCheckDirectCursor

    PrintLog " insert a footnote"
    fInsertFootnote("automatic")
    Call wTypeKeys "<PageUp>"

    PrintLog " insert a endnote"
    fInsertEndnote("automatic")
    Call wTypeKeys "<PageUp>"

    EditSelectAll
    sleep(1)
    EditCopy
    sleep(1)

    preMessage = GetClipBoardtext

    PrintLog " insert a section with protect option"
    InsertSection
    sleep 1
    Kontext
    Active.Setpage TabBereiche
    Kontext "TabBereiche"
    Bereichsliste.Settext sectionName
    Geschuetzt.Check
    TabBereiche.OK
    sleep 2

    EditSelectAll
    sleep(1)
    EditCopy
    sleep(1)

    if GetClipBoardtext = preMessage then
        Call wTypeKeys "<Space>"
        Kontext "Active"
        if Active.Exists then
            Active.ok
        else
            Warnlog "-  No warning when trying to write in protected area!"
        end if
    else
        Warnlog "Testtool couldn't find the protected area!"
    end if

    Call hCloseDocument
endcase

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

testcase tFootnoteEndnoteSection_4

    Dim sectionName as String
    Dim sourceSectionName as String
    Dim testText as String
    Dim preMessage as String

    sectionName       = "FootnoteEndnoteSection"
    sourceSectionName = "NormalSection"
    testText          = "The test is in source section"

    if Dir (gOfficePath + "user\work\tFootnoteEndnoteSection_4.odt") <> "" then kill (gOfficePath + "user\work\tFootnoteEndnoteSection_4.odt")

        PrintLog "   - linked sections, where source section contains footnotes , footnote text must be also protected "

    PrintLog " insert a footnote in a section, then save the file"
    Call hNewDocument

    fInsertFootnote("automatic")
    Call wTypeKeys "<PageUp>"

    Call wTypeKeys testText

    fInsertEndnote("automatic")
    Call wTypeKeys "<PageUp>"

    Call wTypeKeys "<Shift Home>"
    fInsertSection(sourceSectionName)

    EditSelectAll
    sleep(1)
    EditCopy
    sleep(1)
    preMessage = GetClipBoardtext

    Call hFileSaveAsKill (gOfficePath + "user\work\tFootnoteEndnoteSection_4.odt")
    Call hCloseDocument

    Call hNewDocument

    PrintLog " Open options and check 'Direct-Cursor' in options"
    fCheckDirectCursor

    PrintLog " insert a section with link option"
    InsertSection
    sleep 1
    Kontext
    Active.Setpage TabBereiche
    Kontext "TabBereiche"
    Bereichsliste.Settext sectionName
    Verknuepfung.Check

    DateiVerknuepfung.Settext ConvertPath(gOfficePath + "user\work\tFootnoteEndnoteSection_4.odt")
    TabBereiche.OK
    sleep 2

    EditSelectAll
    sleep(1)
    EditCopy
    sleep(1)

    PrintLog " the footnote should be protected"
    if GetClipBoardtext = preMessage then
        Call wTypeKeys "<Space>"
        Kontext "Active"
        if Active.Exists then
            Active.ok
        else
            Warnlog "-  No warning when trying to write in protected area!"
        end if
    else
        Warnlog "Testtool couldn't find the protected area!"
    end if

    Call hCloseDocument
endcase

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

testcase tFootnoteEndnoteSection_5
    Dim sectionName as String
    sectionName  = "FootnoteEndnoteSection"
    printlog "   - Footnotes in hidden areas 1 footnote text must also be hidden"
    Call hNewDocument

    PrintLog " Insert a footnote"
    fInsertFootnote("automatic")
    Call wTypeKeys "<PAGEUP>"
    PrintLog " Insert a endnote"
    fInsertEndnote("automatic")
    Call wTypeKeys "<PAGEUP>"
    Call wTypeKeys "<HOME>"
    Call wTypeKeys "<RETURN>"
    Call wTypeKeys "<SHIFT END>"
    PrintLog " Insert a section with hide option"
    InsertSection
    sleep(1)
    Kontext
    Active.Setpage TabBereiche
    Kontext "TabBereiche"
        Bereichsliste.Settext sectionName
        Ausblenden.Check
    TabBereiche.OK
    sleep(1)
    try
        EditSelectAll
        sleep(1)
        EditCopy
        sleep(1)
        warnlog "'Edit / Copy' is usable but if there is nothing in the document (hidden section in footnote) it should be disabled!"
    catch
        printlog "Clipboard should be and is empty."
    endcatch

    Call hCloseDocument
endcase

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

testcase tFootnoteEndnoteSection_6

    Dim sectionName as String
    
    sectionName  = "FootnoteEndnoteSection"
    
    PrintLog "   - ALL footnotes appear before the endnotes "
    
    Call hNewDocument
    
    fInsertSection(sectionName)
    Call wTypeKeys "<Up>"
    
    PrintLog " insert the first footnote"
    fInsertFootnote("automatic")
    Call wNavigatorAuswahl(7,1, true)
    if Seitennummer.GetText <> "1" then warnlog "The first footnote should be in the first page"
    fCloseNavigator
    Call wTypeKeys "<PageUp>"
    
    PrintLog " insert a endnote"
    fInsertEndnote("automatic")
    Call wNavigatorAuswahl(7,1, true)
    if Seitennummer.GetText <> "2" then warnlog "The first endnote should be in the second page"
    fCloseNavigator
    Call wTypeKeys "<PageUp>"
    
    PrintLog " insert the second footnote"
    fInsertFootnote("automatic")
    Call wNavigatorAuswahl(7,1, true)
    if Seitennummer.GetText <> "1" then warnlog "The second footnote should be in the first page"
    fCloseNavigator
    
    Call hCloseDocument
endcase

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

testcase tMultiColumnSection_1

    Dim columnNumber as String

    columnNumber  =  "3"

    PrintLog "   - Create multi-column section directly when inserting via dialogue (TabPage 'Columns')"

    Call hNewDocument

    PrintLog " insert a section(insert/section with TabPage 'Columns',"
    PrintLog " + set column to $columnNumber"
    InsertSection
    sleep 1
    
    Kontext
    Active.Setpage TabSpalten
    Kontext "TabSpalten"
    Anzahl.Settext columnNumber
    TabSpalten.OK
    sleep 1
    
    Kontext
    FormatSections
    Kontext "BereicheBearbeiten"
    Optionen.Click
    
    Kontext
    Active.Setpage TabSpalten
    Kontext "TabSpalten"
    
    'Check volumn number
    if Anzahl.Gettext <> columnNumber then  Warnlog "The volumn we hope is " +columnNumber +" but get " + Anzahl.Gettext
    
    'Check volumn width
    if Spaltenbreite1.Gettext <> Spaltenbreite2.Gettext OR Spaltenbreite1.Gettext <> Spaltenbreite3.Gettext then Warnlog "column width is NOT Balance"
    
    TabSpalten.Cancel
    
    Kontext
    Kontext "BereicheBearbeiten"
    BereicheBearbeiten.Cancel
    
    Call hCloseDocument

endcase

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

testcase tMultiColumnSection_2

    Dim columnNumber , sectionName as String

    sectionName   =  "MultiColumnSection"
    columnNumber  =  "3"

    PrintLog "   - Create multi-column section from format/section - options (TabPage Columns)"

    Call hNewDocument

    PrintLog " insert a section with only 1 culumn, that means a normal section"
    fInsertSection(sectionName)

    PrintLog " change the volumn number (format/section) with"
    PrintLog " + TabPage 'Columns', set column to $columnNumber"
    Kontext
    FormatSections
    Kontext "BereicheBearbeiten"
    Optionen.Click

    Kontext
    Active.Setpage TabSpalten
    Kontext "TabSpalten"

    'Set volumn number
    Anzahl.Settext columnNumber
    TabSpalten.OK

    Kontext
    Kontext "BereicheBearbeiten"
    BereicheBearbeiten.OK

    PrintLog " Check the volumn number"
    Kontext
    FormatSections
    Kontext "BereicheBearbeiten"
    Optionen.Click

    Kontext
    Active.Setpage TabSpalten
    Kontext "TabSpalten"

    'Check volumn number
    if Anzahl.Gettext <> columnNumber then  Warnlog "The volumn we hope is " +columnNumber +" but get " + Anzahl.Gettext

    TabSpalten.Cancel

    Kontext
    Kontext "BereicheBearbeiten"
    BereicheBearbeiten.Cancel

    Call hCloseDocument
endcase

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

testcase tMultiColumnSection_3

    Dim columnNumber as String
    Dim testText1 as String
    Dim testText2 as String
    Dim i as Integer

    columnNumber  =  "2"
    testText1     =  "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV"
    testText2     =  "-"

    PrintLog " fill columns balanced -- Active"

    PrintLog " when text inserted into a section, the columns have"
    PrintLog " + to be filled equally"

    PrintLog "   - fill columns balanced -- Active"

    Call hNewDocument

    PrintLog " input some text , less 1 line"
    Call wTypeKeys testText1
    EditSelectAll

    PrintLog " insert a section ,set column to $columnNumber"
    InsertSection
    sleep 1

    Kontext
    Active.Setpage TabSpalten
    Kontext "TabSpalten"
    Anzahl.Settext columnNumber
    TabSpalten.OK
    sleep 1

    Call wTypeKeys "<Escape>"

    PrintLog " input '-' in the end of the text check if"
    PrintLog " + the '-' will appare to second colum"
    For i = 0 to 100
        Call wTypeKeys testText2
        Call wTypeKeys "<Shift Home>"
        sleep(1)
        EditCopy
        sleep(1)
        if GetClipboardText = testText2 then goto GoON
        Call wTypeKeys "<Escape>"
        Call wTypeKeys "<End>"
    next i
    Warnlog "We can't get " +hopeResult2 +" in second column"
    
GoON:
    Call hCloseDocument
endcase

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

testcase tOperationSection_1
    Dim testText1 as String
    Dim testText2 as String
    Dim testText3 as String
    Dim sectionName as String

    sectionName   =  "OperationSection"
    testText1     =  "The operation CUT  for Section test"
    testText2     =  "The operation COPY for Section test"
    testText3     =  "The operation DELETE for Section test"

    PrintLog "   - Cut/copy/paste/move/delete sections - Via key shortcuts"

    Call hNewDocument

    PrintLog " insert a section"
    Call wTypeKeys "<Return>"
    fInsertSection(sectionName)
    Call wTypeKeys "<Up>"
    Call wTypeKeys testText1
    Call wTypeKeys "<Up>"
    EditSelectAll

    PrintLog " Cut section"
    Call wTypeKeys "<Mod1 x>"

    try
        FormatSections
        Kontext "BereicheBearbeiten"
        BereicheBearbeiten.Cancel
        Warnlog "Cut section is failed!"
    catch
   endcatch

    PrintLog " Paste section"
    Call wTypeKeys "<Mod1 v>"

    'start up Navigator
    Call wNavigatorAuswahl(7,1, true)
    PrintLog " 1)check section name"
    if Auswahlliste.GetSelText = sectionName then
        PrintLog " 2)check the content in section"
        Call wTypeKeys "<home><Shift End>"
        sleep(1)
        EditCopy
        sleep(1)
        if GetClipboardText <> testText1 then  Warnlog "The content is the section is NOT right in cut/paste section!"
    else
        warnlog "The Section Name is wrong, should be " + sectionName +" but get " +Auswahlliste.GetSelText
    end if

    'Close Navigator before close the document
    Kontext
    Call fCloseNavigator

    Call hCloseDocument

    Call hNewDocument

    PrintLog " insert a section"
    Call wTypeKeys "<Return>"
    Call fInsertSection(sectionName)
    Call wTypeKeys "<Up>"
    Call wTypeKeys testText2
    Call wTypeKeys "<Up>"
    EditSelectAll

    PrintLog " Copy section"
    Call wTypeKeys "<Mod1 c>"

    Call hCloseDocument

    Call hNewDocument

    'Paste section
    Call wTypeKeys "<Mod1 v>"

    'start up Navigator
    Call wNavigatorAuswahl(7,1, true)

    PrintLog " 1)check section name"
    if Auswahlliste.GetSelText = sectionName then
        PrintLog " 2)check the content in section"
        sleep 1
        Call wTypeKeys "<home><Shift End>"
        sleep(1)
        EditCopy
        sleep(1)
        if GetClipboardText <> testText2 then  Warnlog "The content is the section is NOT right in copy/paste section!"
    else
        warnlog "The Section Name is wrong, should be " + sectionName +" but get " +Auswahlliste.GetSelText
    end if

    printlog "'Close Navigator before close the document"
    Call fCloseNavigator

    Call hCloseDocument

    Call hNewDocument

    PrintLog " insert a section"
    Call wTypeKeys "<Return>"
    Call fInsertSection(sectionName)
    Call wTypeKeys "<Up>"
    Call wTypeKeys testText3
    Call wTypeKeys "<Up>"
    EditSelectAll

    PrintLog " delete the section"
    Call wTypeKeys "<Delete>"

    PrintLog " check if section exists or not"
    try
        FormatSections
        Kontext "BereicheBearbeiten"
        BereicheBearbeiten.Cancel
        Warnlog "Delete section is failed!"
    catch
    endcatch

    Call hCloseDocument
endcase

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

testcase tOperationSection_2

    Dim testText1 as String
    Dim testText2 as String
    Dim testText3 as String
    Dim sectionName as String

    sectionName   =  "OperationSection"
    testText1     =  "The operation CUT  for Section test"
    testText2     =  "The operation COPY for Section test"
    testText3     =  "The operation DELETE for Section test"

    PrintLog "   - Cut/copy/paste/move/delete sections - Via function bar"

    Call hNewDocument

    PrintLog " insert a section"
    Call wTypeKeys "<Return>"
    Call fInsertSection(sectionName)
    Call wTypeKeys "<Up>"
    Call wTypeKeys testText1
    Call wTypeKeys "<Up>"
    EditSelectAll
    sleep 1
    PrintLog " Cut section"
    Kontext "Standardbar"
    Ausschneiden.Click

    try
        FormatSections
        Kontext "BereicheBearbeiten"
        BereicheBearbeiten.Cancel
        Warnlog "Cut section is failed!"
    catch
    endcatch

    PrintLog " Paste section"
    Kontext "Standardbar"
    Einfuegen.Click

    'start up Navigator
    Call wNavigatorAuswahl(7,1, true)

    PrintLog " 1)check section name"
    if Auswahlliste.GetSelText = sectionName then
        PrintLog " 2)check the content in section"
        Call wTypeKeys "<home><Shift End>"
        sleep(1)
        EditCopy
        sleep(1)
        if GetClipboardText <> testText1 then  Warnlog "The content is the section is NOT right in cut/paste section!"
    else
        warnlog "The Section Name is wrong, should be " + sectionName +" but get " +Auswahlliste.GetSelText
    end if

    printlog "Close Navigator before close the document"
    Call fCloseNavigator
    Call hCloseDocument
    Call hNewDocument

    PrintLog " insert a section"
    Call wTypeKeys "<Return>"
    Call fInsertSection(sectionName)
    Call wTypeKeys "<Up>"
    Call wTypeKeys testText2
    Call wTypeKeys "<Up>"
    EditSelectAll
    sleep 1

    PrintLog " Copy section"
    Kontext "Standardbar"
    Kopieren.Click

    Call hCloseDocument

    Call hNewDocument

    PrintLog " Paste section"
    Kontext "Standardbar"
    Einfuegen.Click

    'start up Navigator
    Call wNavigatorAuswahl(7,1, true)

    PrintLog " 1)check section name"
    if Auswahlliste.GetSelText = sectionName then
        PrintLog " 2)check the content in section"
        sleep 1
        Call wTypeKeys "<home><Shift End>"
        sleep(1)
        EditCopy
        sleep(1)
        if GetClipboardText <> testText2 then  Warnlog "The content is the section is NOT right in copy/paste section!"
    else
        warnlog "The Section Name is wrong, should be " + sectionName +" but get " +Auswahlliste.GetSelText
    end if

    Call fCloseNavigator
    Call hCloseDocument
endcase

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

testcase tOperationSection_3

    Dim sectionName  as String
    
    PrintLog " when inserting from clipboard the sections have to be named automatically"
    PrintLog " + with the correct number, means:"
    PrintLog " + when copying 1 section inside a document, the new section must be"
    PrintLog " + named 'Section2' automatically, if the copied section is named Section1"
    
    PrintLog "   - when inserting from clipboard the sections have to be named automatically with the correct number"
    
    sectionName = gDefaultSectionName + 2
    
    PrintLog " New document"
    Call hNewDocument
    Call wTypeKeys "<Return>"
    
    PrintLog " Insert a section with default name"
    InsertSection
    sleep 1
    Kontext
    Kontext "TabBereiche"
    TabBereiche.OK
    sleep 1
    
    PrintLog " Copy and Paste the section into the document"
    EditSelectAll
    sleep(1)
    EditCopy
    sleep(1)
    Call wTypeKeys "<Escape>"
    sleep(1)
    EditPaste
    
    Kontext
    FormatSections
    sleep(1)
    Kontext "BereicheBearbeiten"
    Bereich.TypeKeys "<Up>",2
    Bereich.TypeKeys "<Down>"
    
    if  BereichsName.GetText <> sectionName then warnlog "We hope the section name is " & sectionName & " but get " & BereichsName.GetText
    BereicheBearbeiten.Cancel
    
    PrintLog " Close document"
    Call hCloseDocument
endcase

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

testcase tPasswordProtectSection_1

    Dim Password as String
    Dim newPassword as String

    Password    = "protectedarea"
    newPassword = "newProtectedArea"

    PrintLog "   - Format - Section: check 'Password protected' 1 PW-Dialogue has to appear two times "

    Call hNewDocument

    PrintLog " Insert a section with password"
    InsertSection
    sleep 1
    Kontext
    Active.Setpage TabBereiche
    Kontext "TabBereiche"
    Geschuetzt.Check
    sleep 1
    Passwort.Check
    
    Kontext "BereicheSchuetzen"
     PasswortName.Settext Password
     PasswortBestaetigen.Settext Password
    BereicheSchuetzen.Ok
    
    Kontext
    Kontext "TabBereiche"
    TabBereiche.OK
    
    FormatSections
    Kontext "BereicheBearbeiten"
    
    EnterPasswort.Click
    
    Kontext
    Kontext "BereicheSchuetzen"
    
    PrintLog " PassWord-Dialogue should  appear first time"
    if BereicheSchuetzen.NotExists then
        Warnlog "Unable to enter passwort for section, because dialog is not up!"
    else
        PasswortName.Settext Password
        BereicheSchuetzen.Ok
        sleep 1

       PrintLog " + PW-Dialogue should  appear second time"
        if BereicheSchuetzen.NotExists then
             Warnlog "Unable to enter passwort for section, because dialog is not up!"
        else
             PasswortName.Settext newPassword
             PasswortBestaetigen.Settext newPassword
             BereicheSchuetzen.Ok
    
             Kontext
             Kontext "BereicheBearbeiten"
             PrintLog " + 'Password protected' checkbox must be checked after inputing new password"
             if Passwort.IsChecked <> TRUE then Warnlog "The 'password protected' checkbox should be checked"
        end if
    end if

    Kontext
    Kontext "BereicheBearbeiten"
    BereicheBearbeiten.OK

    Call hCloseDocument
endcase

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

testcase tPasswordProtectSection_2

    Dim Password as String
    
    Password = "protectedarea"
    
    if Dir (gOfficePath + "user\work\tPasswordProtectSection_2.odt") <> "" then
        kill (gOfficePath + "user\work\tPasswordProtectSection_2.odt")
    end if
    PrintLog "   - reload document, Format-section 1 PW-Dialog has to appear "
    
    Call hNewDocument
    
    PrintLog " Insert a section with password , and save the file"
    InsertSection
    sleep 1
    Kontext
    Active.Setpage TabBereiche
    Kontext "TabBereiche"
    Geschuetzt.Check
    sleep 1
    Passwort.Check
    
    Kontext "BereicheSchuetzen"
    PasswortName.Settext Password
    PasswortBestaetigen.Settext Password
    BereicheSchuetzen.Ok
    
    Kontext "TabBereiche"
    TabBereiche.OK
    
    Call hFileSaveAsKill (gOfficePath + "user\work\tPasswordProtectSection_2.odt")
    
    Call hCloseDocument
    
    PrintLog " Reload the file"
    Call hFileOpen (gOfficePath + "user\work\tPasswordProtectSection_2.odt")
    
    FormatSections
    Kontext "BereicheBearbeiten"
    
    Optionen.Click
    
    Kontext "BereicheSchuetzen"
    PrintLog " PassWord-Dialogue should appear when clicking 'option' button"
    if BereicheSchuetzen.NotExists then
        Warnlog "Unable to enter passwort for section, because dialog is not up!"
    else
        BereicheSchuetzen.Cancel
    end if

    Kontext "BereicheBearbeiten"
    BereicheBearbeiten.Cancel

    Call hCloseDocument
endcase

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

testcase tPasswordProtectSection_3

    Dim Password as String
    Dim wrongPassword as String
    
    Password       = "protectedarea"
    wrongPassword  = "wrongPW"
    
    PrintLog "   - Input wrong password ,Error massage should appear, sections-dialogue not accessible "
    
    Call hNewDocument
    
    PrintLog " Insert a section with password"
    InsertSection
    sleep 1
    Kontext
    Active.Setpage TabBereiche
    Kontext "TabBereiche"
    Geschuetzt.Check
    sleep 1
    Passwort.Check
    
    Kontext "BereicheSchuetzen"
     PasswortName.Settext Password
     PasswortBestaetigen.Settext Password
    BereicheSchuetzen.Ok
    
    Kontext "TabBereiche"
    TabBereiche.OK
    
    FormatSections
    Kontext "BereicheBearbeiten"
    
    EnterPasswort.Click
    
    Kontext "BereicheSchuetzen"
    
    PasswortName.Settext wrongPassword
    
    BereicheSchuetzen.Ok
    sleep 1
    
    Kontext
    Kontext "Active"
    if Active.Exists then
        if Active.GetRT <> 304 then  warnlog "Error message box is NOT up! The active box is " +Active.GetRT
        Active.OK
    else
        Warnlog "Error message box is NOT up!"
    end if
    
    Kontext
    Kontext "BereicheBearbeiten"
    BereicheBearbeiten.Cancel
    Call hCloseDocument
endcase

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

testcase tPasswordProtectSection_4

    Dim Password as String
    
    Password = "protectedarea"
    
    if Dir (gOfficePath + "user\work\tPasswordProtectSection_4.odt") <> "" then
        kill (gOfficePath + "user\work\tPasswordProtectSection_4.odt")
    end if
    
    PrintLog "   - Remove password protection by unchecking, reload document, Format-sections 'PW-dialogue' may not appear"
    
    Call hNewDocument
    
    PrintLog " Insert a section with password"
    InsertSection
    sleep 1
    Kontext
    Active.Setpage TabBereiche
    Kontext "TabBereiche"
    Geschuetzt.Check
    sleep 1
    Passwort.Check
    
    Kontext "BereicheSchuetzen"
    PasswortName.Settext Password
    PasswortBestaetigen.Settext Password
    BereicheSchuetzen.Ok
    
    Kontext "TabBereiche"
    TabBereiche.OK
    
    PrintLog " Remove the password protection and save the file"
    FormatSections
    Kontext "BereicheBearbeiten"
    
    Passwort.Uncheck
    Kontext "BereicheSchuetzen"    
    PrintLog " PassWord-Dialogue should appear when clicking 'option' button"
    if BereicheSchuetzen.NotExists then
        Warnlog "Unable to uncheck password for section, because dialog is not up!"
    else
        PasswortName.Settext Password
        BereicheSchuetzen.OK
    end if
    
    Kontext "BereicheBearbeiten"
    BereicheBearbeiten.OK
    
    Call hFileSaveAsKill (gOfficePath + "user\work\tPasswordProtectSection_4.odt")
    
    Call hCloseDocument
    
    PrintLog " Reload the file"
    Call hFileOpen (gOfficePath + "user\work\tPasswordProtectSection_4.odt")
    
    PrintLog " In format/section, PW-Dialogue should appear when clicking 'option' button"
    FormatSections
    Kontext "BereicheBearbeiten"
    
    Optionen.Click
    
    Kontext "BereicheSchuetzen"
    
    if BereicheSchuetzen.Exists then
        Warnlog "Unable to enter passwort for section, because dialog is not up!"
        PasswortName.Settext Password
        BereicheSchuetzen.OK
    end if
    
    Kontext
    Active.Setpage TabSpalten
    Kontext "TabSpalten"
    TabSpalten.Cancel
    
    Kontext "BereicheBearbeiten"
    BereicheBearbeiten.Cancel
    
    Call hCloseDocument

endcase


'****************************************************************************
'** After the Wrapping section and Wrapped section are generated, the display
'** is like
'**
'** This is                          <----|--------------------
'** wrapped   <---- Wrapped section  <----| Wrapping section
'** sections test                    <----|--------------------
'*****************************************************************************
testcase tWrappedSections_1

    Dim wrappingSection as String
    Dim wrappedSection as String
    Dim testText as String

    wrappingSection =  "wrappingSection"
    wrappedSection  =  "wrappedSection"
    testText        =  "This is wrapped section test"

    PrintLog "   - select Text inside a section and insert a section "

    Call hNewDocument

    PrintLog " insert wrapping section"
    Call wTypeKeys testText
    EditSelectAll
    fInsertSection(wrappingSection)

    Call wTypeKeys "<Home>"
    Call wTypeKeys "<Mod1 Right>",2
    Call wTypeKeys "<Mod1 Shift Right>"

    try
        PrintLog " insert wrapped section"
        fInsertSection(wrappedSection)

        Kontext
        FormatSections
        Kontext "BereicheBearbeiten"
        Bereich.TypeKeys "<Up>"

        if  BereichsName.GetText <> wrappingSection then Warnlog "The wrapping section names is wrong : " +BereichsName.GetText
        Bereich.TypeKeys "<Down>"
        if  BereichsName.GetText <> wrappedSection then Warnlog "The wrapped section names is wrong : " +BereichsName.GetText

        BereicheBearbeiten.Cancel
    catch
        Warnlog "Can't generate wrapped section"
    endcatch

    Call hCloseDocument

endcase

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

testcase tWrappedSections_2

    Dim wrappingSection as String
    Dim wrappedSection as String
    Dim testTextInFirstline as String
    Dim testTextInSecondline as String

    wrappingSection      =  "wrappingSection"
    wrappedSection       =  "wrappedSection"
    testTextInFirstline  =  "This is wrapped section test in first line"
    testTextInSecondline =  "This is wrapped section test in second line"

    printlog "   - select text across a section an insert a section "
    Call hNewDocument

    PrintLog " Insert wrapped section"
    Call wTypeKeys "<Return>"
    Call wTypeKeys(testTextInFirstline)
    Call wTypeKeys "<Return>"
    Call wTypeKeys(testTextInSecondline)
    Call wTypeKeys "<MOD1 HOME><SHIFT END>"
    Call fInsertSection(wrappedSection)

    EditSelectAll
    try
        PrintLog " Insert wrapping section"
        Call fInsertSection(wrappingSection)
        Kontext
        FormatSections
        Kontext "BereicheBearbeiten"
        Bereich.TypeKeys "<UP>"
        if BereichsName.GetText <> wrappingSection then
            QAErrorLog "#102552# - The wrapping section names is wrong."
        end if
        Bereich.TypeKeys "<Down>"
        if BereichsName.GetText <> wrappedSection then
            QAErrorLog "#102552# - The wrapped section names is wrong."
        end if
        BereicheBearbeiten.Cancel
     catch
         Warnlog "Can't generate wrapping section"
     endcatch

    Call hCloseDocument
endcase

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

testcase tWrappedSections_3

    Dim wrappingSection as String
    Dim wrappedSection as String
    Dim testText as String
    Dim contentInWrappedSection as String
    
    wrappingSection =  "wrappingSection"
    wrappedSection  =  "wrappedSection"
    testText        =  "This is wrapped section test"
    contentInWrappedSection = "wrapped "
    
    PrintLog "   - wrapped sections are following properties of the wrapping section - write protection"
    
    Call hNewDocument
    
    PrintLog " Open options and check 'Direct-Cursor' in options"
    fCheckDirectCursor
    
    PrintLog " insert wrapping section"
    Call wTypeKeys testText
    EditSelectAll
    fInsertSection(wrappingSection)
    
    Call wTypeKeys "<Home>"
    Call wTypeKeys "<Mod1 Right>",2
    Call wTypeKeys "<Mod1 Shift Right>"
    
    PrintLog " insert wrapped section"
    fInsertSection(wrappedSection)
    
    PrintLog " format/section, choose protect in wrappingSection"
    Kontext
    FormatSections
    Kontext "BereicheBearbeiten"
    Bereich.TypeKeys "<Up>"
    Geschuetzt.Check
    BereicheBearbeiten.OK
    
    Call wTypeKeys "<Home><Shift End>"
    sleep(1)
    EditCopy
    sleep(1)
    if GetClipBoardtext = contentInWrappedSection then
        Call wTypeKeys "<Space>"
        Kontext "Active"
        if Active.Exists then
            Active.ok
        else
            Warnlog "-  No warning when trying to write in protected area!"
        end if
    else
        Warnlog "The focus is NOT in the wrapped section!"
    end if
    Call hCloseDocument
endcase

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

testcase tWrappedSections_4

    Dim wrappingSection as String
    Dim wrappedSection as String
    Dim testText as String
    
    wrappingSection =  "wrappingSection"
    wrappedSection  =  "wrappedSection"
    testText        =  "This is wrapped section test"
    
    printlog "   - wrapped sections are following properties of the wrapping section - visibility"
    
    Call hNewDocument
    
    PrintLog " insert wrapping section"
    Call wTypeKeys "<RETURN>"
    Call wTypeKeys testText
    Call wTypeKeys "<SHIFT HOME>"
    Call fInsertSection(wrappingSection)
    Call wTypeKeys "<HOME>"
    Call wTypeKeys "<MOD1 RIGHT>" , 2
    Call wTypeKeys "<MOD1 SHIFT RIGHT>"
    PrintLog " insert wrapped section"
    Call fInsertSection(wrappedSection)
    PrintLog " format/section, choose hide checkbox in wrappingSection"
    Kontext
    FormatSections
    Kontext "BereicheBearbeiten"
    Bereich.TypeKeys "<UP>"
    Ausblenden.check
    BereicheBearbeiten.OK
    
    try
        EditSelectAll
        sleep(1)
        EditCopy
        sleep(1)
        warnlog "There should be nothing visible in the document but 'Edit / Copy' is available!"
        warnlog "Clipboard: " & GetClipBoardtext
    catch
        printlog "All sections are invisible."
    endcatch
    
    Call hCloseDocument
endcase

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

testcase tWrappedSections_5

    Dim wrappingSection as String
    Dim wrappedSection as String
    Dim testText as String
    
    wrappingSection =  "wrappingSection"
    wrappedSection  =  "wrappedSection"
    testText        =  "This is wrapped section test"

    PrintLog "   - wrapped sections are following properties of the wrapping section - Foot-/endnote position"

    Call hNewDocument
    PrintLog " insert wrapping section"
    Call wTypeKeys testText
    EditSelectAll
    Call fInsertSection(wrappingSection)
    
    Call wTypeKeys "<Home>"
    Call wTypeKeys "<Mod1 Right>",2
    Call wTypeKeys "<Mod1 Shift Right>"
    
    PrintLog " insert wrapped section"
    fInsertSection(wrappedSection)
    
    PrintLog " format/section, choose wrappingSection , then press options button,"
    PrintLog " + then tabpage footnotes/endnotes ,"
    PrintLog " + check collect at end of text in footnotes area and"
    PrintLog " + check collect at end of text in endnotes area"
    Kontext
    FormatSections
    Kontext "BereicheBearbeiten"
    Bereich.TypeKeys "<Up>"
    'press options button
    Optionen.Click
    
    'tabpage footnotes/endnotes
    Kontext
    Active.Setpage TabFussEndnoten
    Kontext "TabFussEndnoten"
    
    'check collect at end of text in footnotes area and
    'check collect at end of text in endnotes area
    FussnotenAmTextendeSammeln.Check
    EndnotenAmBereichsendeSammeln.Check
    
    TabFussEndnoten.OK
    Kontext "BereicheBearbeiten"
    BereicheBearbeiten.OK
    
    PrintLog " format/section again, choose wrappedSection , then press options button,"
    PrintLog " + then tabpage footnotes/endnotes ,"
    PrintLog " + check if collect at end of text in footnotes area and"
    PrintLog " + collect at end of text in endnotes area are checked"
    FormatSections
    Kontext "BereicheBearbeiten"
    Bereich.TypeKeys "<Down>"
    'press options button
    Optionen.Click
    
    'tabpage footnotes/endnotes
    Kontext
    Active.Setpage TabFussEndnoten
    Kontext "TabFussEndnoten"
    
    PrintLog " check if collect at end of text in footnotes area is checked"
    if FussnotenAmTextendeSammeln.IsChecked <> TRUE then
        Warnlog "The footnotes check option is NOT checked in wrappedSection"
    end if
    
    PrintLog " check if collect at end of text in endnotes area  is checked"
    if EndnotenAmBereichsendeSammeln.IsChecked  <> TRUE then
        Warnlog "The endnotes check option is NOT checked in wrappedSection"
    end if
    
    TabFussEndnoten.Cancel
   
    Kontext "BereicheBearbeiten"
    BereicheBearbeiten.Cancel
    
    Call hCloseDocument
endcase

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

testcase tWrappedSections_6

    Dim wrappingSection as String
    Dim wrappedSection as String
    Dim testText as String
    Dim columnInwrappingSection as String
    Dim columnInwrappedSection as String

    wrappingSection         =  "wrappingSection"
    wrappedSection          =  "wrappedSection"
    testText                =  "This is wrapped section test"
    columnInwrappingSection =  "2"
    columnInwrappedSection  =  "3"
    
    PrintLog "   - The formatting of columns of sectionWrapping and sectionWrapped can be configured separately"
    
    Call hNewDocument
    
    PrintLog " insert wrapping section"
    Call wTypeKeys testText
    EditSelectAll
    fInsertSection(wrappingSection)
    
    Call wTypeKeys "<Home>"
    Call wTypeKeys "<Mod1 Right>",2
    Call wTypeKeys "<Mod1 Shift Right>"
    
    PrintLog " insert wrapped section"
    fInsertSection(wrappedSection)
    
    PrintLog " format/section, choose wrappingSection , then press options button,"
    PrintLog " + then tabpage columns, set columns to $columnInwrappingSection"
    FormatSections
    Kontext "BereicheBearbeiten"
    Bereich.TypeKeys "<Up>"
    'press options button
    Optionen.Click
    
    Kontext
    Active.Setpage TabSpalten
    Kontext "TabSpalten"
    
    'Set column to $columnInwrappingSection
    Anzahl.Settext columnInwrappingSection
    TabSpalten.OK
    
    PrintLog " format/section, choose wrappedSection , then press options button,"
    PrintLog " + then tabpage columns, set columns to $columnInwrappedSection"
    Kontext "BereicheBearbeiten"
    Bereich.TypeKeys "<Down>"
    'press options button
    Optionen.Click
    
    Kontext
    Active.Setpage TabSpalten
    Kontext "TabSpalten"
    
    'Set column to $columnInwrappedSection
    Anzahl.Settext columnInwrappedSection
    TabSpalten.OK
    
    Kontext "BereicheBearbeiten"
    BereicheBearbeiten.OK
    
    PrintLog " format/section again, then check if columns is configured separately"
    'check columns in wrappingSection
    Kontext
    FormatSections
    Kontext "BereicheBearbeiten"
    Bereich.TypeKeys "<Up>"
    Optionen.Click
    
    Kontext
    Active.Setpage TabSpalten
    Kontext "TabSpalten"
    if Anzahl.Gettext <> columnInwrappingSection then
        Warnlog "The volumn in wrappingSection should be " +columnInwrappingSection +" but get " + Anzahl.Gettext
    end if
    TabSpalten.Cancel

    'check columns in wrappedSection
    Kontext "BereicheBearbeiten"
    Bereich.TypeKeys "<Down>"
    Optionen.Click

    Kontext
    Active.Setpage TabSpalten
    Kontext "TabSpalten"
    if Anzahl.Gettext <> columnInwrappedSection then
        Warnlog "The volumn in wrappedSection should be " +columnInwrappedSection +" but get " + Anzahl.Gettext
    end if
    TabSpalten.Cancel

    Kontext "BereicheBearbeiten"
    BereicheBearbeiten.Cancel
    Call hCloseDocument
endcase

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

testcase tWrappedSections_7

    Dim wrappingSection as String
    Dim wrappedSection as String
    Dim testText as String
    Dim testFileWrapping , testFileWrapped    as String
    
    wrappingSection  =  "wrappingSection"
    wrappedSection   =  "wrappedSection"
    testText         =  "This is wrapped section test"
    testFileWrapping =   ConvertPath ( gTesttoolPath + "writer\optional\input\graphics\jolink.jpg")
    testFileWrapped  =   ConvertPath ( gTesttoolPath + "writer\optional\input\graphics\bild.jpg")

    PrintLog "   - The background graphic of sectionWrapping and sectionWrapped can be configured separately"

    Call hNewDocument    
    PrintLog " insert wrapping section"
    Call wTypeKeys testText
    EditSelectAll
    Call fInsertSection(wrappingSection)

    Call wTypeKeys "<Home>"
    Call wTypeKeys "<Mod1 Right>",2
    Call wTypeKeys "<Mod1 Shift Right>"
    
    PrintLog " insert wrapped section"
    Call fInsertSection(wrappedSection)
    
    PrintLog " format/section,"
    PrintLog " + choose wrappingSection , then press options button ,"
    PrintLog " + then tabpage backgroud / graphic, browse a picture ,"
    PrintLog " + choose 'Position' in type ."
    FormatSections
    Kontext "BereicheBearbeiten"
    Bereich.TypeKeys "<Up>"
    'press options button
    Optionen.Click

    Kontext
    Active.SetPage TabHintergrund
    sleep 1
    Kontext "TabHintergrund"

    Als.Select (2)
    sleep 1
    Durchsuchen.click

    Kontext "GrafikEinfuegenDlg"
    Dateiname.SetText testFileWrapping
    sleep 1
    Oeffnen.Click
    sleep 2
    
    Kontext "TabHintergrund"
    Position.Check
    
    TabHintergrund.OK
    PrintLog " choose wrappingSection , then press options button ,"
    PrintLog " + then tabpage backgroud / graphic, browse a picture ,"
    PrintLog " + choose 'area' in type ."
    Kontext "BereicheBearbeiten"
    Bereich.TypeKeys "<Down>"
    'press options button
    Optionen.Click

    Kontext
    Active.SetPage TabHintergrund
    sleep 1
    Kontext "TabHintergrund"

    Als.Select (2)
    sleep 1
    Durchsuchen.click

    Kontext "GrafikEinfuegenDlg"
    Dateiname.SetText testFileWrapped
    sleep 1
    Oeffnen.Click
    sleep 2

    Kontext "TabHintergrund"
    Flaeche.Check
    TabHintergrund.OK

    Kontext "BereicheBearbeiten"
    BereicheBearbeiten.OK

    PrintLog " format/section again,"
    PrintLog " + choose wrappingSection , then press options button,"
    PrintLog " + then tabpage background / graphic,"
    PrintLog " + check if 'Position' is checked in type"
    FormatSections
    Kontext "BereicheBearbeiten"
    Bereich.TypeKeys "<Up>"
    'press options button
    Optionen.Click
    
    Kontext
    Active.SetPage TabHintergrund
    sleep 1
    Kontext "TabHintergrund"
    Als.Select (2)
    sleep 1
    
    if Position.IsChecked <> TRUE then
        Warnlog "'Position' is NOT checked in type"
    end if
    
    TabHintergrund.Cancel
    
    PrintLog " choose wrappedSection , then press options button,"
    PrintLog " + then tabpage backgroud / graphic,"
    PrintLog " + check if 'Area' is checked in type ."
    Kontext "BereicheBearbeiten"
    Bereich.TypeKeys "<Down>"
    'press options button
    Optionen.Click
    
    Kontext
    Active.SetPage TabHintergrund
    sleep 1
    Kontext "TabHintergrund"
    Als.Select (2)
    sleep 1
    
    if Flaeche.IsChecked <> TRUE then
        Warnlog "'Area' is NOT checked in type"
    end if
    TabHintergrund.Cancel
    
    Kontext "BereicheBearbeiten"
    BereicheBearbeiten.Cancel
    
    Call hCloseDocument
endcase