summaryrefslogtreecommitdiff
path: root/testautomation/writer/optional/includes/section/w_section_4.inc
blob: fde6ab07020e88670b28657679e66e6715d56f4b (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
'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 : Functional-Test for Section.
'*
'************************************************************************
'*
' #1 tSectionInTables_1
' #1 tSectionInTables_2
' #1 tSectionInTables_3
' #1 tSectionInTables_4
' #1 tSectionInTables_5
' #1 tSectionInTables_6
' #1 tSectionInTables_7
' #1 tSectionInFootnotes_1
' #1 tSectionInFootnotes_2
' #1 tEditSection_1
' #1 tEditSection_2
' #1 tEditSection_3
' #1 tEditSection_4
' #1 tEditSection_5
' #1 tParagraphSection_1
' #1 tParagraphSection_2
' #1 tParagraphSection_3
' #1 tScenarioSection_1
' #1 tScenarioSection_2
' #1 tCTLSection_1
' #1 tCTLSection_2
'*
'\***********************************************************************

sub w_section_4

   printLog Chr(13) + "- Sections in special areas -"

   printLog Chr(13) + "--- Sections in tables ---"
     Call tSectionInTables_1          'insert section in empty cell
     Call tSectionInTables_2          'select text in a cell and insert section
     Call tSectionInTables_3          'insert multicolumn-section into cell
     Call tSectionInTables_4          'insert footnote into section which is in table
     Call tSectionInTables_5          'hide section in cell, resize cell via key shortcuts, make section visible again
     Call tSectionInTables_6          'insert a section when you have a multi-selection in a table must be impossible
     Call tSectionInTables_7          'insert a section when cells are selected must be impossible

   printLog Chr(13) + "--- Sections in footnote areas  ---"
     Call tSectionInFootnotes_1       'insert a simple section over some words or lines
     Call tSectionInFootnotes_2       'insert section into footnote that spreads over several pages

   printLog Chr(13) + "- Edit sections later on (via Format - Sections...) -"
     Call tEditSection_1              'uncheck "Autowidth" and vary width manually
     Call tEditSection_2              'hide section
     Call tEditSection_3              'protect section
     Call tEditSection_4              'remove link(s), also via Edit - Links
     Call tEditSection_5              'Remove section

   printLog Chr(13) + "- section breaks (several following sections) -"
     Call tParagraphSection_1         'Keep paragraphs together
     Call tParagraphSection_2         'paragraph spacing
     Call tParagraphSection_3         'paragraph borders

   printLog Chr(13) + "- Test scenarios -"
     Call tScenarioSection_1          'create Masterdocument from another document that also contains sections
     Call tScenarioSection_2          'create Masterdocument from another document that also contains sections and footnotes

   printLog Chr(13) + "- CTL specials -"
     Call tCTLSection_1               'CTL specials -- insert/sections /Columns
     Call tCTLSection_2               'CTL specials -- format/section/options /Columns

end sub

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

testcase tSectionInTables_1

  Dim tableName as String
  Dim columnNumber as String
  Dim rowNumber as String
  Dim sectionName as String

  tableName     = "testTable"
  columnNumber  = "4"
  rowNumber     = "2"

  sectionName   = "tableSection"

  '/// insert section in empty cell ///
   PrintLog "      - insert section in empty cell  "

    Call hNewDocument

   '/// insert a table
    Call fInsertTable(tableName , columnNumber, rowNumber)

   '/// insert section in empty cell
    try
        Call fInsertSection(sectionName)

      ' Check the section name is correct or NOT (Format/Section)
        Kontext
        FormatSections
        Kontext "BereicheBearbeiten"
        if BereichsName.GetText <> sectionName then warnlog "The section Name is wrong : " & BereichsName.Gettext
        BereicheBearbeiten.Cancel
    catch
        Warnlog "insert section in empty cell failed"
    endcatch

    Call hCloseDocument

endcase

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

testcase tSectionInTables_2

  Dim tableName as String
  Dim columnNumber as String
  Dim rowNumber as String
  Dim testText as String
  Dim sectionName as String

  tableName     = "testTable"
  columnNumber  = "4"
  rowNumber     = "2"
  testText      = "Table-Section"

  sectionName   = "tableSection"

  '/// select text in a cell and insert section  ///
   PrintLog "      - select text in a cell and insert section   "

    Call hNewDocument

   '/// insert a table
    Call fInsertTable(tableName , columnNumber, rowNumber)

   '/// input some test text in the table
    Call wTypeKeys testText

   '/// select text
    Call wTypeKeys "<Shift Home>"

   '/// insert section include select text
    try
        Call fInsertSection(sectionName)

      ' Check the section name is correct or NOT (Format/Section)
        Kontext
        FormatSections
        Kontext "BereicheBearbeiten"
        if BereichsName.GetText <> sectionName then warnlog "The section Name is wrong : " & BereichsName.Gettext
        BereicheBearbeiten.Cancel

      ' Check the content in section is correct or NOT
        Call wTypeKeys "<Home>"
        Call wTypeKeys "<Shift End>"
        EditCopy
        if GetClipBoardText <> testText then Warnlog "The content in section is NOT right : " +GetClipBoardText

    catch
        Warnlog "insert section which include text failed"
    endcatch

    Call hCloseDocument

endcase

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

testcase tSectionInTables_3

  Dim tableName as String
  Dim columnNumber as String
  Dim rowNumber as String
  Dim sectionName as String
  Dim columnInSection as String

  tableName       = "testTable"
  columnNumber    = "4"
  rowNumber       = "2"
  sectionName     = "tableSection"
  columnInSection = "3"

  '/// insert multicolumn-section into cell  ///
   PrintLog "      - insert multicolumn-section into cell  "

    Call hNewDocument

   '/// insert a table
    Call fInsertTable(tableName , columnNumber, rowNumber)

   '/// insert section with column = columnInSection in empty cell
    try
        InsertSection
        Sleep 1

        Kontext
        Active.Setpage TabBereiche
        Kontext "TabBereiche"
        Bereichsliste.Settext sectionName

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

      ' Check the section name is correct or NOT (Format/Section)
        Kontext
        FormatSections
        Kontext "BereicheBearbeiten"
        if BereichsName.GetText <> sectionName then warnlog "The section Name is wrong : " & BereichsName.Gettext

      ' Check the section column is correct or NOT (options button)
        Optionen.Click
        Kontext
        Active.Setpage TabSpalten
        Kontext "TabSpalten"
        if Anzahl.Gettext <> columnInSection then  Warnlog "The volumn should be " +columnInSection +" but get " + Anzahl.Gettext
        TabSpalten.Cancel

        Kontext
        Kontext "BereicheBearbeiten"
        BereicheBearbeiten.Cancel
    catch
        Warnlog "insert section in empty cell failed"
    endcatch

    Call hCloseDocument

endcase

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

testcase tSectionInTables_4

  Dim tableName as String
  Dim columnNumber as String
  Dim rowNumber as String
  Dim sectionName as String
  Dim footNote as String
  Dim endNote as String

  tableName     = "testTable"
  columnNumber  = "4"
  rowNumber     = "2"

  sectionName   = "tableSection"
  footNote      = "Foot"
  endNote       = "End"

  '///insert footnote into section which is in table  ///
   PrintLog "      - insert footnote into section which is in table "

   Call hNewDocument

   '/// insert a table
    Call fInsertTable(tableName , columnNumber, rowNumber)

    try
       '/// insert section
        Call fInsertSection(sectionName)

        Call wTypeKeys "<Up>"

       '/// insert a footnote
        Call fInsertFootnote("character",footNote)

        Call wTypeKeys "<PageUp>"

       '/// insert a endnote
        fInsertEndnote("character",endNote)

        Call wTypeKeys "<PageUp>"

       '/// Check the section name is correct or NOT (Format/Section)
        Kontext
        FormatSections
        Kontext "BereicheBearbeiten"
        if BereichsName.GetText <> sectionName then warnlog "The section Name is wrong : " & BereichsName.Gettext
        BereicheBearbeiten.Cancel

       '/// Check the footnote and endnote are correct or NOT
        Call wTypeKeys "<Shift Home>"
        EditCopy
        if GetClipBoardText <> footNote+endNote then Warnlog "The footnote/endnote are NOt inserted into section correctly!"
    catch
        Warnlog "insert section in empty cell failed"
    endcatch

    Call hCloseDocument

endcase

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

testcase tSectionInTables_5
    Dim tableName as String
    Dim columnNumber as String
    Dim rowNumber as String
    Dim testText as String
    Dim sectionName as String

    tableName     = "testTable"
    columnNumber  = "4"
    rowNumber     = "2"
    testText      = "Hide-Section"
    sectionName   = "tableSection"

    '/// Hide section in cell, resize cell via key shortcuts, make section visible again   ///
    printlog "      - hide section in cell, resize cell via key shortcuts, make section visible again"
    Call hNewDocument

     '/// insert a table
     Call wTypeKeys "<RETURN>"
     Call fInsertTable(tableName , columnNumber, rowNumber)
     '/// input some test text , select text and insert a section with hide option
     Call wTypeKeys testText
     Call wTypeKeys "<SHIFT HOME>"
     try
         InsertSection
         Kontext
             Active.Setpage TabBereiche
             Kontext "TabBereiche"
                 Bereichsliste.Settext sectionName
                 Ausblenden.check
             TabBereiche.OK
             sleep(1)
         '/// Check the content in section is hidden or NOT
         SetClipboard = ""
         Call wTypeKeys "<LEFT><DOWN>"
         Call wTypeKeys "<SHIFT END>"
         try
             EditCopy
         catch
             printlog "There is no text in the document. Good."
         endcatch
         if GetClipboardText = "" then
             '/// Resize cell via key shortcuts
             Call wTypeKeys "<MOD1 MOD2 RIGHT>" , 2
             '/// UnCheck hide option (Format/Section)
             Kontext
             FormatSections
             Kontext "BereicheBearbeiten"
                 Ausblenden.Uncheck
             BereicheBearbeiten.OK
             sleep(2)
             Call wTypeKeys "<LEFT><HOME>"
             Call wTypeKeys "<SHIFT END>"
             EditCopy
             if GetClipBoardText <> testText then warnlog "The content in section should be visible but get : " & GetClipBoardText
         else
             QAErrorLog "#99460# The content in section is NOT hidden!"
         end if
     catch
         warnlog "insert section which include text failed"
     endcatch

    Call hCloseDocument
endcase

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

testcase tSectionInTables_6

  Dim tableName as String
  Dim columnNumber as String
  Dim rowNumber as String
  Dim testText as String
  Dim selectedString as String
  Dim sectionName as String

  tableName       =  "testTable"
  columnNumber    =  "4"
  rowNumber       =  "2"
  testText        =  "Mul-s-Mul"
  selectedString  =  "Mul"

  sectionName     =  "tableSection"

  '/// insert a section when you have a multi-selection in a table must be impossible  ///
   PrintLog "      - insert a section when you have a multi-selection in a table must be impossible"

    Call hNewDocument

   '/// insert a table
    Call fInsertTable(tableName , columnNumber, rowNumber)

   '/// input some words and do multi-selection
    Call wTypeKeys testText
    fMultiSelection(selectedString)

   '/// insert section
    try
        Call fInsertSection(sectionName)
        Warnlog "Create section should be impossible!"
    catch
    endcatch

    Call hCloseDocument

endcase

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

testcase tSectionInTables_7

  Dim tableName as String
  Dim columnNumber as String
  Dim rowNumber as String
  Dim sectionName as String

  tableName       =  "testTable"
  columnNumber    =  "4"
  rowNumber       =  "2"

  sectionName     =  "tableSection"

  '/// insert a section when cells are selected must be impossible  ///
   PrintLog "      - insert a section when cells are selected must be impossible"

    Call hNewDocument

   '/// insert a table
    Call fInsertTable(tableName , columnNumber, rowNumber)

   '/// more than one cell are selected
    Call wTypeKeys "<Shift Right>",2

   '/// insert section
    try
        Call fInsertSection(sectionName)
        Warnlog "Create section should be impossible!"
    catch
    endcatch

    Call hCloseDocument

endcase

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

testcase tSectionInFootnotes_1

  Dim sectionName  as String

  sectionName = "footnoteSection"

  '/// insert a simple section over some words or lines ///
   PrintLog "      - insert a simple section over some words or lines "

   Call hNewDocument

   '/// + insert footnote
    Call fInsertFootnote("automatic")

   '/// + insert some dummy text in the footnote area
    wBlindtextEinfuegen

    EditSelectAll

   '/// + insert a section for selected words
    try
        Call fInsertSection(sectionName)

      ' Check the section name is correct or NOT (Format/Section)
        Kontext
        FormatSections
        Kontext "BereicheBearbeiten"
        if BereichsName.GetText <> sectionName then warnlog "The section Name is wrong : " & BereichsName.Gettext
        BereicheBearbeiten.Cancel
    catch
        Warnlog "insert a section failed !"
    endcatch

   Call hCloseDocument

endcase

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

testcase tSectionInFootnotes_2

  Dim sectionName  as String

  sectionName = "footnoteSection"

  '/// insert section into footnote that spreads over several pages ///
   PrintLog "      - insert section into footnote that spreads over several pages "

   Call hNewDocument

   '/// insert footnote
    Call fInsertFootnote("automatic")
    sleep(2)
   '/// insert some dummy text that spreads over several pages in the footnote area
    Call wBlindtextEinfuegen
    Call wBlindtextEinfuegen
    Call wBlindtextEinfuegen
    Call wBlindtextEinfuegen
    Call wBlindtextEinfuegen
    Call wBlindtextEinfuegen
    Call wBlindtextEinfuegen

    Kontext
    ViewNavigator
    sleep(1)
    Kontext "NavigatorWriter"

    '/// Check if dummy text is enough in footnote area
     if Seitennummer.GetText > "1" then
        EditSelectAll
        sleep(1)
        '/// + insert a section for selected words
         try
             Call fInsertSection(sectionName)
             ' Check the section name is correct or NOT (Format/Section)
               Kontext
               FormatSections
               Kontext "BereicheBearbeiten"
               if BereichsName.GetText <> sectionName then warnlog "The section Name is wrong : " & BereichsName.Gettext
               BereicheBearbeiten.Cancel
        catch
               Warnlog "insert a section failed !"
        endcatch
     else
         QAErrorLog "Not enough dummy text in the footnote area!"
     end if
    Call fCloseNavigator
   Call hCloseDocument
endcase

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

testcase tEditSection_1

  Dim columnNumber as String
  Dim sectionName as String
  Dim width1 as String
  Dim width2 as String

  sectionName   =  "MultiColumnSection"
  columnNumber  =  "3"

  '/// uncheck "Autowidth" and vary width manually ///
   PrintLog "   - Create multi-column section from format/section - options (TabPage Columns)"

   Call hNewDocument

  '/// insert a section with only 1 culumn, that means a normal section
   Call fInsertSection(sectionName)
   Call wTypeKeys "<Up>"

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

    Kontext
    Active.Setpage TabSpalten
    Kontext "TabSpalten"

   '/// + Set column number
    Anzahl.Settext columnNumber
    Sleep 1

   'This step is useless , but must be done ! Because after the aboved step, all control are NOT actived !
    Kontext
    Active.Setpage TabHintergrund
    Kontext "TabHintergrund"

    Kontext
    Active.Setpage TabSpalten
    Kontext "TabSpalten"

   '/// uncheck "Autowidth" and vary width manually
    AutomBreite.UnCheck

    width1 = "4" + gSeperator + "00" + gMeasurementUnit
    width2 = "3" + gSeperator + "00" + gMeasurementUnit

    Spaltenbreite1.Settext width1
    Sleep 1
    Spaltenbreite2.Settext width2
    Sleep 1
    TabSpalten.TypeKeys "<Tab>"
    Sleep 1

    TabSpalten.OK

    Kontext
    Kontext "BereicheBearbeiten"
    BereicheBearbeiten.OK

    Call wTypeKeys "<Up>"
   '/// Check the column's width
    Kontext
    FormatSections
    Kontext "BereicheBearbeiten"
    Optionen.Click

    Kontext
    Active.Setpage TabSpalten
    Kontext "TabSpalten"

    if Spaltenbreite1.Gettext <> width1 then Warnlog "column1 width is NOT correct , hope to get " + width1 + " but get " +Spaltenbreite1.Gettext
    if Spaltenbreite2.Gettext <> width2 then Warnlog "column2 width is NOT correct , hope to get " + width2 + " but get " +Spaltenbreite2.Gettext

    TabSpalten.Cancel

    Kontext
    Kontext "BereicheBearbeiten"
    BereicheBearbeiten.Cancel

    Call hCloseDocument

endcase

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

testcase tEditSection_2

    Dim sectionName as String
    Dim testText as String

    sectionName   =  "HideSection"
    testText      =  "Hide Section"

    '/// hide section in format/section ///
    printlog "   - hide section in format/section"

    Call hNewDocument

     '/// insert a normal section, and input some words
     Call wTypeKeys "<RETURN>"
     Call wTypeKeys testText
     Call wTypeKeys "<SHIFT HOME>"
     Call fInsertSection(sectionName)
     '/// Edit section with Format/Section and choose 'Hide'
     Kontext
         FormatSections
         Kontext "BereicheBearbeiten"
             Ausblenden.check
             BereicheBearbeiten.OK
             sleep(1)
     '/// check the section and its contents
     printlog "  -- check the section and its contents "
     try
         EditSelectAll
         EditCopy
         warnlog "'Edit / Copy' is usable but if there is nothing in the document (hidden section) it should be disabled!"
     catch
         printlog "Clipboard should be and is empty."
     endcatch
    Call hCloseDocument
endcase

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

testcase tEditSection_3

  Dim sectionName as String
  Dim testText as String

  sectionName   =  "ProtectSection"
  testText      =  "Protect Section"

  '/// protect section in format/section ///
   PrintLog "   - protect section in format/section"

    Call hNewDocument

  '/// Open options and check 'Direct-Cursor' in options ///
    fCheckDirectCursor

  '/// insert a normal section, and input some words
    Call wTypeKeys testText
    Call wTypeKeys "<Shift Home>"

    Call fInsertSection(sectionName)

  '/// Edit section with Format/Section and choose 'Protect'
    Kontext
    FormatSections
    Kontext "BereicheBearbeiten"
    Geschuetzt.Check
    BereicheBearbeiten.OK
    sleep 1

    Call wTypeKeys "<Home>"
    Call wTypeKeys "<Space>"
    Kontext "Active"
    If Active.Exists then
      Active.ok
    else
      Warnlog "-  No warning when trying to write in protected area!"
    end if

    Call hCloseDocument

endcase

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

testcase tEditSection_4

  Dim sectionName as String
  Dim testText as String

  sectionName   =  "LinkSection"
  testText      =  "Link Section"

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

  '/// remove link(s), also via Edit - Links ///
   PrintLog "   - remove link(s), also via Edit - Links "

  '/// edit a test file and save it
   Call hNewDocument
   Call wTypeKeys testText
   Call hFileSaveAsKill (gOfficePath + "user\work\tEditSection_4.odt")
   Call hCloseDocument

   Call hNewDocument

  '/// insert a section and link the test file
   InsertSection
   Sleep 1
   Kontext
   Active.Setpage TabBereiche
   Kontext "TabBereiche"
   Bereichsliste.Settext sectionName
   Verknuepfung.Check

   DateiVerknuepfung.Settext ConvertPath(gOfficePath + "user\work\tEditSection_4.odt")
   TabBereiche.OK
   Sleep 1

  '/// Edit section with Format/Section and unCheck 'link'
   Kontext
   FormatSections
   Kontext "BereicheBearbeiten"
   Verknuepfung.UnCheck
   BereicheBearbeiten.OK
   sleep 1

  '/// the test file's content should be reserved after
  '/// + unlinking the test file
   EditSelectAll
   EditCopy
   if GetClipBoardText <> testText then Warnlog "the test file's content should be reserved after unlinking the test file"

  '/// check if the unlink is taken effect
   Kontext
   FormatSections
   Kontext "BereicheBearbeiten"
   If Verknuepfung.IsChecked = TRUE then Warnlog "The link option should be UnChecked!"
   BereicheBearbeiten.Cancel

   Call hCloseDocument

endcase

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

testcase tEditSection_5

  Dim sectionName as String
  Dim testText as String

  sectionName   =  "RemoveSection"
  testText      =  "Remove Section Test"

  '/// remove section via Edit - undo ///
   PrintLog "   - remove section via Edit - undo"

   Call hNewDocument

  '/// insert a normal section, and input some words
    Call wTypeKeys testText
    Call wTypeKeys "<Shift Home>"
    Call fInsertSection(sectionName)

  '/// remove section with Format/Section and click undo button
   Kontext
   FormatSections
   Kontext "BereicheBearbeiten"

  'click undo button
   Aufheben.Click
   Sleep 1
   BereicheBearbeiten.OK
   sleep 1

  'check if section is still existed
   try
       Kontext
       FormatSections
       Kontext "BereicheBearbeiten"
       BereicheBearbeiten.Cancel
       Warnlog "There are should be no section existed!"
   catch
   endcatch

  '/// the test file's content should be reserved after removing the section
   EditSelectAll
   EditCopy
   if GetClipBoardText <> testText then Warnlog "the test file's content should be reserved after removing the section"

   Call hCloseDocument

endcase

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

testcase tParagraphSection_1

  Dim documentName as String
  Dim sectionName as String
  Dim hopeResult as String

   documentName  =  ConvertPath(gTesttoolpath + "writer\optional\input\section\tParagraphSection_1.sxw")
   sectionName   =  "ParagraphSection"
   hopeResult    =  "He "

  '/// Keep paragraphs together ///
   PrintLog "   - Keep paragraphs together"

  '/// Open a file with 4 paragraphs, the 4th paragraph is crossing the page
   Call hFileOpen(documentName)
   Call sMakeReadOnlyDocumentEditable

   EditSelectAll
   Call fInsertSection(sectionName)
   Call wTypeKeys "<MOD1 End>"
   Call wTypeKeys "<Up>",3

   FormatParagraph
   Kontext
   active.SetPage TabTextfluss
   kontext "TabTextfluss"

  '/// Check option "Do not split paragraphs"
   AbsatzNichtTrennen.Check

   TabTextfluss.OK

   Call wTypeKeys "<MOD1 Home>"

  'Set the focus to the head of second page
   Kontext
   ViewNavigator
   Kontext "NavigatorWriter"
   Seitennummer.SetText "2"
   Sleep 2
   fCloseNavigator

   Call wTypeKeys "<Shift MOD1 Right>"
   EditCopy

   if GetClipBoardText <> hopeResult then Warnlog "Something wrong in Keep paragraphs together test!"

   Call hCloseDocument

endcase

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

testcase tParagraphSection_2

    Dim sectionName as String
    Dim beforeTextIntent1 as String
    Dim afterTextIntent1 as String
    Dim firstTextIntent1 as String
    Dim beforeTextSpace1 as String
    Dim afterTextSpace1 as String
    Dim beforeTextIntent2 as String
    Dim afterTextIntent2 as String
    Dim firstTextIntent2 as String
    Dim beforeTextSpace2 as String
    Dim afterTextSpace2 as String
    
    sectionName   =  "ParagraphSection"
    
    '/// paragraph spacing  ///
    PrintLog "   - paragraph spacing "
    
    Call hNewDocument
    
    '/// insert first paragraph , and do some configurations
    if wBlindtextEinfuegen() = false then
        Call hCloseDocument
        goto endsub
    end if
       
    if iSprache = 82 then
        Call wTypeKeys "<Return>"
    end if
    Call wTypeKeys "<Up>"
    
    FormatParagraph
    Kontext
    active.SetPage TabEinzuegeUndAbstaende
    kontext "TabEinzuegeUndAbstaende"
    
    beforeTextIntent1 = "0" + gSeperator + "10" + gMeasurementUnit
    afterTextIntent1  = "0" + gSeperator + "20" + gMeasurementUnit
    firstTextIntent1  = "0" + gSeperator + "30" + gMeasurementUnit
    beforeTextSpace1  = "0" + gSeperator + "40" + gMeasurementUnit
    afterTextSpace1   = "0" + gSeperator + "50" + gMeasurementUnit
    
    Vonlinks.SetText   beforeTextIntent1
    VonRechts.SetText  afterTextIntent1
    ErsteZeile.SetText firstTextIntent1
    Oben.SetText       beforeTextSpace1
    Unten.SetText      afterTextSpace1
    Automatisch.Check
    Registerhaltigkeit.UnCheck
    TabEinzuegeUndAbstaende.OK
    
    call wTypeKeys "<Down>"
    call wTypeKeys "<RETURN>"
    
    '/// insert second paragraph , and do some configurations which is different from the first one
    wBlindtextEinfuegen
    Call wTypeKeys "<Up>"
    
    FormatParagraph
    Kontext
    active.SetPage TabEinzuegeUndAbstaende
    kontext "TabEinzuegeUndAbstaende"
    
    beforeTextIntent2 = "0" + gSeperator + "60" + gMeasurementUnit
    afterTextIntent2  = "0" + gSeperator + "70" + gMeasurementUnit
    firstTextIntent2  = "0" + gSeperator + "80" + gMeasurementUnit
    beforeTextSpace2  = "0" + gSeperator + "90" + gMeasurementUnit
    afterTextSpace2   = "0" + gSeperator + "10" + gMeasurementUnit
    
    Vonlinks.SetText   beforeTextIntent2
    VonRechts.SetText  afterTextIntent2
    Automatisch.UnCheck
    ErsteZeile.SetText firstTextIntent2
    Oben.SetText       beforeTextSpace2
    Unten.SetText      afterTextSpace2
    Registerhaltigkeit.Check
    TabEinzuegeUndAbstaende.OK
    
    EditSelectAll
    Call fInsertSection(sectionName)
    
    'Check the first paragraph's configuration
    Call wTypeKeys "<MOD1 Home>"
    FormatParagraph
    Kontext
    active.SetPage TabEinzuegeUndAbstaende
    kontext "TabEinzuegeUndAbstaende"

    if Automatisch.IsChecked <> TRUE then Warnlog "Something wrong with the checkbox 'Automatic' in first paragraph!"
    if Registerhaltigkeit.IsChecked = TRUE then Warnlog "Something wrong with the checkbox 'Register' in first paragraph!"

    if Vonlinks.GetText   <>  beforeTextIntent1 then Warnlog "Something wrong with the before-text-intent-area in the first paragraph"
    if VonRechts.GetText  <>  afterTextIntent1 then Warnlog "Something wrong with the after-text-intent-area in the first paragraph"
    if ErsteZeile.GetText <>  firstTextIntent1 then Warnlog "Something wrong with the first-text-intent-area in the first paragraph"
    if Oben.GetText       <>  beforeTextSpace1 then Warnlog "Something wrong with the before-sparcing area in the first paragraph"
    if Unten.GetText      <>  afterTextSpace1 then Warnlog "Something wrong with the after-sparcing area in the first paragraph"

    TabEinzuegeUndAbstaende.Cancel

    Call wTypeKeys "<MOD1 End>"
    Call wTypeKeys "<Up>",3
    
    'Check the second paragraph's configuration
    FormatParagraph
    Kontext
    active.SetPage TabEinzuegeUndAbstaende
    kontext "TabEinzuegeUndAbstaende"
    
    if Automatisch.IsChecked = TRUE then Warnlog "Something wrong with the checkbox 'Automatic' in the second paragraph!"
    if Registerhaltigkeit.IsChecked <> TRUE then Warnlog "Something wrong with the checkbox 'Register' in the second paragraph!"

    if Vonlinks.GetText     <>  beforeTextIntent2  then Warnlog "Something was wrong with the before-text-intent in the second paragraph!"
    if VonRechts.GetText <>  afterTextIntent2     then Warnlog "Something wrong with the after-text-intent in the second paragraph!"
    if ErsteZeile.GetText  <>  firstTextIntent2      then Warnlog "Something wrong with the first-text-intent in the second paragraph!"
    if Oben.GetText          <>  beforeTextSpace2 then Warnlog "Something wrong with the before-text-sparcing area in the second paragraph!"
    if Unten.GetText         <>  afterTextSpace2 then Warnlog "Something wrong with the after-text-sparcing area in the second paragraph!"

    TabEinzuegeUndAbstaende.Cancel

    Call hCloseDocument

endcase

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

testcase tParagraphSection_3

    Dim sectionName as String
    Dim left1 as String
    Dim right1 as String
    Dim top1 as String
    Dim bottom1 as String
    Dim distance1 as String
    Dim left2 as String
    Dim distance2 as String
    Dim COMPAREvar1 as String
    Dim COMPAREvar2 as String
    Dim COMPAREvar3 as String
    Dim COMPAREvar4 as String
    
    sectionName   =  "ParagraphSection"
    
    '/// paragraph borders   ///
    PrintLog "   - paragraph borders  "
    
    Call hNewDocument
    
    '/// insert first paragraph , and do some configurations
    if wBlindtextEinfuegen() = false then
        Call hCloseDocument
        goto endsub
    end if
    if iSprache = 82 then
        Call wTypeKeys "<Return>"
    end if   
    Call wTypeKeys "<Up>"
    
    FormatParagraph
    Kontext
    active.SetPage TabUmrandung
    kontext "TabUmrandung"
    
    Vorgaben.Typekeys "<home><right>"        ' 2nd from the left
    synchronisieren.UnCheck
    
    left1     =  "0" + gSeperator + "1" 
    right1    =  "0" + gSeperator + "2" 
    top1      =  "0" + gSeperator + "3" 
    bottom1   =  "0" + gSeperator + "4" 
    distance1 =  "4" + gSeperator + "2" 
    
    Links.SetText  left1
    Rechts.SetText right1
    Oben.SetText   top1
    Unten.SetText  bottom1
    
    Position.TypeKeys "<home><right>"        ' 2nd. from the left
    Groesse.SetText distance1
    SchattenFarbe.Select 2
    TabUmrandung.OK
    
    Call wTypeKeys "<Down>",2
    
    '/// insert second paragraph , and do some configurations
    '/// + which is different from the first one
    wBlindtextEinfuegen
    Call wTypeKeys "<Up>"
    
    FormatParagraph
    Kontext
    active.SetPage TabUmrandung
    kontext "TabUmrandung"
    
    Vorgaben.Typekeys "<home><right><right>"       ' 3nd from the left
    synchronisieren.Check
    
    left2     =  "0" + gSeperator + "6" 
    distance2 =  "4" + gSeperator + "7" 
    
    Links.SetText  left2
    
    Position.TypeKeys "<home><right><right>"       ' 3nd. from the left
    Groesse.SetText distance2
    SchattenFarbe.Select 5
    TabUmrandung.OK
    
    EditSelectAll
    Call fInsertSection(sectionName)
    
    '<<< Check the FIRST paragraph's configuration >>>
    Call wTypeKeys "<MOD1 Home>"
    
    FormatParagraph
    Kontext
    active.SetPage TabUmrandung
    kontext "TabUmrandung"
    
    '   if synchronisieren.IsChecked = TRUE then Warnlog "The Synchronize option should NOT be checked in first paragraph!"
    COMPAREvar1 = Links.GetText
    COMPAREvar2 = Rechts.GetText
    COMPAREvar3 = Oben.GetText
    COMPAREvar4 = Unten.GetText
    
    printlog (InStr( COMPAREvar1, left1   ) = false)
    if InStr( COMPAREvar1, left1 ) = false then Warnlog "Something wrong with the Left -space to contents area in first paragraph"
    if InStr( COMPAREvar2, right1 ) = false then Warnlog "Something wrong with the Right -space to contents area in first paragraph"
    if InStr( COMPAREvar3, top1 ) = false then Warnlog "Something wrong with the Top -space to contents area in first paragraph"
    if InStr( COMPAREvar4, bottom1 ) = false then Warnlog "Something wrong with the Bottom -space to contents area in first paragraph"

    if InStr( Groesse.GetText, distance1 ) = false then Warnlog "Something wrong with the size in first paragraph"
'    Groesse.GetText <> distance1 then Warnlog "Something wrong with the size in first paragraph"
    if SchattenFarbe.GetSelIndex <> 2 then Warnlog "Something wrong in shadow color in the first paragraph"

    TabUmrandung.Cancel

    Call wTypeKeys "<MOD1 End>"
    Call wTypeKeys "<Up>",3
    
    '<<<Check the SECOND paragraph's configuration>>>
    FormatParagraph
    Kontext
    active.SetPage TabUmrandung
    kontext "TabUmrandung"
    
    '   if synchronisieren.IsChecked <> TRUE then Warnlog "The Synchronize option should be checked in second paragraph!"
    
    if  InStr( Links.GetText, left2 ) = false OR InStr( Rechts.GetText, left2 ) = false OR InStr( Oben.GetText, left2 ) = false OR InStr( Unten.GetText, left2 ) = false then 
        Warnlog "Something wrong in space to contents area in second paragraph"
    end if
    
    if InStr( Groesse.GetText, distance2 ) = false then Warnlog "Something wrong with the size in first paragraph"
    if SchattenFarbe.GetSelIndex <> 5 then Warnlog "Something wrong in shadow style area in the first paragraph"
    
    TabUmrandung.Cancel
    
    Call hCloseDocument

endcase

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

testcase tScenarioSection_1

   Dim SectionName() as String
   Dim tempFile as String
   DIM sectionInMasterDoc
   Dim MasterDoc    as String
   DIM ContentInMasterDoc() as String
   Dim i as integer
   Dim j as Integer
   Dim temp1 as String
   Dim temp2 as String
   Dim LinkFile as String

  '/// create Masterdocument from another document that also contains sections  ///
   PrintLog "   - create Masterdocument from another document that also contains sections"

   MasterDoc = Convertpath( gOfficePath + "user\work\tScenarioSection_1.odm" )

   SectionName = Array( _
                       "tScenarioSection_11.odt", _
                       "tScenarioSection_12.odt", _
                       "tScenarioSection_13.odt", _
                       )

   ContentInMasterDoc = Array( _
                              "This is scenario Section test" , _
                              "The content in hide section"   , _
                              "The content in protect section", _
                             )


   j = UBound(SectionName)

   if hFileExists ( MasterDoc ) then app.kill ( MasterDoc )

   For i = 0 to j
       tempFile =  Convertpath( gOfficePath + "user\work\" + SectionName(i) )
       if hFileExists ( tempFile ) then app.kill ( tempFile )
   next i

  '/// open testdocument (tScenarioSection_1.sxw) ///
   Call hFileOpen ( gTesttoolpath + "writer\optional\input\section\tScenarioSection_1.sxw")
   Call sMakeReadOnlyDocumentEditable

  '/// Select 'File /Send -> Create Masterdocument ///
   FileSendCreateMasterdocument

  '/// the 'Save as...' dialog has to appear ///
   Kontext "SendMasterDocument"
   if SendMasterDocument.NotExists then Warnlog "Save As - Dialog didn't appear!"

  '/// Select as template 'Default' ///
   Vorlage.Select 1

  '/// Save document as 'tScenarioSection_1.odm' ///
   Dateiname.SetText Convertpath( gOfficePath + "user\work\tScenarioSection_1" )

   Speichern.Click
   Sleep 3

   Kontext "Active"
   if Active.Exists then
      Active.yes
   else
      Warnlog "- No messagebox asking for the actualizationing of the master document !"
   end if
   Sleep 1

   Kontext "Navigator"
   if Navigator.Exists then
      Navigator.Close
   else
      Warnlog "Navigator in Master document isn't up!"
   end if

   Call wTypeKeys "<Up>" , 3

  '/// Check the sections in MasterDoc
  '/// 1) check the content is section
  '/// 2) check the section name
  '/// 3) check if the section is hidden    (should NOT be hidden)
  '/// 4) check if the section is protected (should be protected)
  '/// 5) check if the section is linked and linked file is correct or not   (should be linked)

   For i = 0 to j

      Call wTypeKeys "<Home><Shift End>"
      EditCopy

      if GetClipboardText = ContentInMasterDoc(i) then
         Kontext
         FormatSections
         Kontext "BereicheBearbeiten"

         if BereichsName.GetText <> SectionName(i) then
            Warnlog "The first section's name is wrong !"
            Warnlog "We hope it is " + SectionName(i) + " but get: " +BereichsName.GetText
         end if
         if Ausblenden.IsChecked   =   TRUE then Warnlog "The section should NOT be hidden"
         if Geschuetzt.IsChecked   <>  TRUE then Warnlog "The section should be protected"
         if Verknuepfung.IsChecked =   TRUE then
             temp1 = LCase("user/work/" & SectionName(i))
             temp2 = LCase(Dateiname.GetText)

             if Instr(temp2, temp1) = 0 then Warnlog "The linked file is NOT correct!"
         else
             Warnlog "The section should be linked"
         end if
         BereicheBearbeiten.Cancel
      else
         Warnlog "The content in first section in Master file is wrong!"
      end if

      Call wTypeKeys "<Down>"

   next i

   Call hCloseDocument
endcase

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

testcase tScenarioSection_2

   Dim SectionName() as String
   Dim tempFile as String
   DIM sectionInMasterDoc as String
   Dim MasterDoc as String
   DIM ContentInMasterDoc() as String
   Dim i as Integer
   Dim j as Integer
   Dim k as Integer
   Dim sValue as String

  '/// create Masterdocument from another document that also contains sections and footnotes
   PrintLog "   - create Masterdocument from another document that also contains sections and footnotes"

   MasterDoc = Convertpath( gOfficePath + "user\work\tScenarioSection_2.sxg" )

   SectionName = Array( _
                       "tScenarioSection_21.odt", _
                       "tScenarioSection_22.odt", _
                       "tScenarioSection_23.odt", _
                       )

   ContentInMasterDoc = Array( _
                              "This is scenario Section test"                  , _
                              "FootNote1The content in hide sectionEndNote1"   , _
                              "FootNote2The content in protect sectionEndNote2", _
                             )

   j = UBound(SectionName)

   if hFileExists ( MasterDoc ) then app.kill ( MasterDoc )

   For i = 0 to j
       tempFile =  Convertpath( gOfficePath + "user\work\" + SectionName(i) )
       if hFileExists ( tempFile ) then app.kill ( tempFile )
   next i

  '/// open testdocument (tScenarioSection_2.sxw) ///
   Call hFileOpen ( gTesttoolpath + "writer\optional\input\section\tScenarioSection_2.sxw")
   Call sMakeReadOnlyDocumentEditable

  '/// Select 'File -> Send -> Create Masterdocument ///
   FileSendCreateMasterdocument

  '/// the 'Save as...' dialog has to appear ///
   Kontext "SendMasterDocument"
   if SendMasterDocument.NotExists then Warnlog "Save As - Dialog didn't appear!"

  '/// Select as template 'Default' ///
   Vorlage.Select 1

  '/// Save document as 'masterdoc.odm' ///
   Dateiname.SetText Convertpath( gOfficePath + "user\work\tScenarioSection_2" )

   Speichern.Click
   Sleep 3

   Kontext "Active"
   if Active.Exists then
      Active.yes
   else
      Warnlog "- No messagebox asking for the actualizationing of the master document !"
   end if
   Sleep 1

   Kontext "Active"
   if Active.Exists(5) then
       Active.Yes
   end if

   Kontext "Navigator"
   if Navigator.Exists then
      Navigator.Close
   else
      Warnlog "Navigator in Master document isn't up!"
   end if

   Call wTypeKeys "<Up>" , 3

  '/// Check the sections in MasterDoc
  '/// 1) check the content is section
  '/// 2) check the section name
  '/// 3) check if the section is hidden    (should NOT be hidden)
  '/// 4) check if the section is protected (should be protected)
  '/// 5) check if the section is linked and linked file is correct or not (should be linked)

   For i = 0 to j

      Call wTypeKeys "<Home><Shift End>"
      EditCopy

      if GetClipboardText = ContentInMasterDoc(i) then
         Kontext
         FormatSections
         Kontext "BereicheBearbeiten"

         if BereichsName.GetText <> SectionName(i) then
            Warnlog "The first section's name is wrong !"
            Warnlog "We hope it is " + SectionName(i) + " but get: " +BereichsName.GetText
         end if

		if Ausblenden.IsChecked   =   TRUE then Warnlog "The section should NOT be hidden"
		if Geschuetzt.IsChecked   <>  TRUE then Warnlog "The section should be protected"
		if Verknuepfung.IsChecked =   TRUE then
			sValue = ConvertPath ( gOfficePath & "user/work/" + SectionName(i) )
			if Instr( ConvertPath(Dateiname.Gettext), sValue) = false then
			 	Warnlog "The linked file is NOT correct!"
			end if				
		else
        	Warnlog "The section should be linked"
        end if
        BereicheBearbeiten.Cancel
      else
         Warnlog "The content in first section in Master file is wrong!"
      end if

      Call wTypeKeys "<Down>"

   next i

   Call hCloseDocument

endcase

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

testcase tCTLSection_1

  '/// CTL specials Check  -- insert/sections  ///
   PrintLog "   - CTL specials -- insert/sections  "

   Call hNewDocument

  '/// 1)Switch on "Complex scripts support" in Tools/Options/Language Settings/Languages
   ActiveDeactivateCTLSupport(True)

  '/// 2)Insert/sections / Columns
   InsertSection
   Sleep 1
   Kontext
   Active.Setpage TabSpalten
   Kontext "TabSpalten"

  '/// 3)Check if text direction listbox is visible
   if (TextDirection.Exists) then

      '/// 4)Check the default name
       if TextDirection.GetSelIndex <> 3 then
          Warnlog "The default name we hope is :" + TextDirection.GetItemText(3) +" but get: "+TextDirection.GetSelText
       end if

      '/// 5)Check the available values ( Should 3 items )
          if TextDirection.GetItemCount <> 3 then
              Warnlog "The values in TextDirection should be 3, but get " +TextDirection.GetItemCount
          end if

   else
       Warnlog "the textdirection listbox doesn't exist!"
   end if

   TabSpalten.Cancel

  'Recover to default
   ActiveDeactivateCTLSupport(False)

   Call hCloseDocument

endcase

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

testcase tCTLSection_2

   Dim SectionName as String

   SectionName =  "CTLSection"

  '/// CTL specials -- format/section/options /Columns ///
   PrintLog "   - CTL specials -- format/section/options /Columns "

   Call hNewDocument

  '/// 1)Switch on "Complex scripts support" in Tools/Options/Language Settings/Languages
   ActiveDeactivateCTLSupport(True)

  '/// 2)Insert a section
   Call fInsertSection(SectionName)

  '/// 3)format/section/options /Columns
   Kontext
   FormatSections
   Kontext "BereicheBearbeiten"
   Optionen.Click

   Kontext
   Active.Setpage TabSpalten
   Kontext "TabSpalten"

  '/// 4)Check if text direction listbox is visible
   if (TextDirection.Exists) then

      '/// 5)Check the default name
       if TextDirection.GetSelIndex <> 3 then
          Warnlog "The default name we hope is :" + TextDirection.GetItemText(3) +" but get: "+TextDirection.GetSelText
       end if

      '/// 6)Check the available values ( Should 3 items )
       if TextDirection.GetItemCount <> 3 then
           Warnlog "The values in TextDirection should be 3, but get " +TextDirection.GetItemCount
       end if

   else
       Warnlog "the textdirection listbox doesn't exist!"
   end if

   TabSpalten.Cancel

   Kontext
   Kontext "BereicheBearbeiten"
   BereicheBearbeiten.Cancel

  'Recover to default
   ActiveDeactivateCTLSupport(False)

   Call hCloseDocument

endcase