summaryrefslogtreecommitdiff
path: root/testautomation/writer/optional/includes/option/wr_o_4.inc
blob: 6a3ca9dd50f30d3bb553ea7b4ccb163559318314 (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
'**************************************************************************
'* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
'* 
'* Copyright 2008 by Sun Microsystems, Inc.
'*
'* OpenOffice.org - a multi-platform office productivity suite
'*
'* $RCSfile: wr_o_4.inc,v $
'*
'* $Revision: 1.2 $
'*
'* last change: $Author: vg $ $Date: 2008-08-18 12:33:17 $
'*
'* 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 :
'*
'\***********************************************************************

sub wr_o_4

    Call tToolsOptionsWriterOther
    Call tToolsOptionsWriterAutoCaption
    Call tToolsOptionsWriterGeneral
    Call tToolsOptionsWriterMailMerge

end sub

'------------------------------------------------------------------------------
testcase tToolsOptionsWriterOther
    dim irgendwas(7) as boolean    ' Checkbox states
    dim bRadioBut(3) as boolean    ' RadioButton states
    dim bTempRadioBut(3) as boolean
    dim iMasseinheit as integer
    dim sTabAbstand as string
    dim sTemp as string
    dim iTemp as integer
    dim sTemp2 as string


    ' irgendwas(i)
    '-(1) = NurFuerAktuellesDokument

    '(2) = Feldbefehle
    '(3) = Diagramme
    '-(4) = FelderUndDiagrammeAktuellesDokument

    '(5) = Abstaende
    '(6) = AbstaendeSeitenanfang
    '(7) = TabulatorpositionAusrichten

    ' bRadioBut(i) and bTempRadioBut(i)
    '(1) = Immer
    '(2) = AufNachfrage
    '(3) = Nie

    ' !!! -Feldbefehle- has to be checked, to get -Diagramme- enabeld !!!

    '- !!! -Current Document only- ist bei office beenden zu beachten!!!

    Call hNewDocument
    printlog ("- Tools/Options/Writer: General ")

    printlog (" - save states ")
    ToolsOptions
    Call hToolsOptions ("WRITER","GENERAL")

    irgendwas(2) = Feldbefehle.IsChecked
    irgendwas(3) = Diagramme.IsChecked

    bRadioBut(1) = Immer.IsChecked
    bRadioBut(2) = AufNachfrage.IsChecked
    bRadioBut(3) = Nie.IsChecked

    iMasseinheit = Masseinheit.GetSelIndex
    sTabAbstand = Tabulatorenabstand.GetText

    printlog ("- all states inverting ")

    if irgendwas(2) Then Feldbefehle.UnCheck Else Feldbefehle.Check
    if Feldbefehle.IsChecked  Then if irgendwas(3) Then Diagramme.UnCheck Else Diagramme.Check

    if (Immer.IsChecked = True) Then AufNachfrage.Check Else Immer.Check

    bTempRadioBut(1) = Immer.IsChecked
    bTempRadioBut(2) = AufNachfrage.IsChecked
    bTempRadioBut(3) = Nie.IsChecked

    Tabulatorenabstand.ToMax
    sTemp = Tabulatorenabstand.GetText
    Tabulatorenabstand.More

    if (LiberalMeasurement (sTemp,Tabulatorenabstand.GetText) <> TRUE) Then Warnlog ("BugID: 82740: Tab stops max. isn't max.")
    Tabulatorenabstand.SetText (sTabAbstand)

    if ( Masseinheit.GetItemCount <> iMasseinheit ) Then Masseinheit.Select (Masseinheit.GetItemCount) _
    Else Masseinheit.Select (1)
    iTemp = Masseinheit.GetSelIndex

    sTemp = Tabulatorenabstand.GetText
    Tabulatorenabstand.ToMax
    if ( Tabulatorenabstand.GetText = sTemp ) Then Tabulatorenabstand.ToMin
    sTemp = Tabulatorenabstand.GetText

    Kontext "ExtrasOptionenDlg"
    ExtrasOptionenDlg.OK

    printlog ("- SO quit - start ")

    Call wOfficeRestart

    printlog ("- checking states ")
    ToolsOptions
    Call hToolsOptions ( "WRITER" , "GENERAL" )

    if ( irgendwas(2) = Feldbefehle.IsChecked                         ) Then WarnLog "Feldbefehle state changed"
    if Feldbefehle.IsChecked Then if ( irgendwas(3) = Diagramme.IsChecked ) Then WarnLog "Diagramme state changed"
    if ( bTempRadioBut(1) <> Immer.IsChecked       ) Then WarnLog "Immer state changed"
    if ( bTempRadioBut(2) <> AufNachfrage.IsChecked) Then WarnLog "AufNachfrage state changed"
    if ( bTempRadioBut(3) <> Nie.IsChecked         ) Then WarnLog "Nie state changed"

    if ( Masseinheit.GetSelIndex <> iTemp ) Then WarnLog "Masseinheit state changed"
    if (LiberalMeasurement (sTemp,Tabulatorenabstand.GetText) <> TRUE ) Then WarnLog "Tabulatorenabstand state changed - watch BugID: 82744 for Status"

    Kontext "ExtrasOptionenDlg"
    ExtrasOptionenDlg.OK

    printlog ("- all UnCheck -> o ")
    ToolsOptions
    Call hToolsOptions ( "WRITER" , "GENERAL" )

    Feldbefehle.UnCheck

    if (AufNachfrage.IsChecked = True) Then Nie.Check Else AufNachfrage.Check

    bTempRadioBut(1) = Immer.IsChecked
    bTempRadioBut(2) = AufNachfrage.IsChecked
    bTempRadioBut(3) = Nie.IsChecked

    Masseinheit.Select (1)
    Tabulatorenabstand.ToMin
    sTemp = Tabulatorenabstand.GetText
    printlog ("More test ///'")
    Tabulatorenabstand.More
    if ( sTemp = Tabulatorenabstand.GetText ) Then WarnLog "Tabulatorenabstand More-Button not working; stemp1: "+sTemp + " =? (2) " +Tabulatorenabstand.GetText
    sTemp = Tabulatorenabstand.GetText

    Kontext "ExtrasOptionenDlg"
    ExtrasOptionenDlg.OK

    printlog ("- check if all UnChecked ")
    ToolsOptions
    Call hToolsOptions ( "WRITER" , "GENERAL" )

    if Feldbefehle.IsChecked                         Then WarnLog "Feldbefehle x"

    if ( bTempRadioBut(1) <> Immer.IsChecked       ) Then WarnLog "Immer state changed"
    if ( bTempRadioBut(2) <> AufNachfrage.IsChecked) Then WarnLog "AufNachfrage state changed"
    if ( bTempRadioBut(3) <> Nie.IsChecked         ) Then WarnLog "Nie state changed"

    if ( Masseinheit.GetSelIndex <> 1 ) Then WarnLog "Masseinheit is not item 1"
    sTemp2 = Tabulatorenabstand.GetText
    if (LiberalMeasurement (sTemp, sTemp2) <> TRUE ) Then WarnLog "Tabulatorenabstand is not min. is: " +Tabulatorenabstand.GetText + " should: " +sTemp

    Kontext "ExtrasOptionenDlg"
    ExtrasOptionenDlg.OK

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

    printlog ("- check if tab stops get saved in document ")
    Call hNewDocument

    ' set Default Tab Stop to 2,5cm
    ToolsOptions
    Call hToolsOptions ("WRITER","GENERAL")
    Masseinheit.Select (2) ' cm
'   printlog "before " + Tabulatorenabstand.GetText
    Tabulatorenabstand.SetText ("2" + GetDecimalSeperator(Tabulatorenabstand.GetText) + "50" + mUnit)
'   printlog "after " + Tabulatorenabstand.GetText
'   printlog "seperator: " + GetDecimalSeperator(Tabulatorenabstand.GetText)
'   printlog "generated string: " + "2" + GetDecimalSeperator(Tabulatorenabstand.GetText) + "50cm"
    Kontext "ExtrasOptionenDlg"
    ExtrasOptionenDlg.OK

'   creating document with tabstops and save it
    Kontext "DocumentWriter"
    DocumentWriter.TypeKeys "a<Tab>b<Tab>c<Tab>d<Tab>e<Tab>f<Tab>g<Tab>h<Tab>i<Tab>j"
    Call hFileSaveAsWithFilterKill ( gOfficePath + "user\work\tab25cm.odt", "Writer8")
    Call hCloseDocument
    sleep (2)

'   change tab stops
    Call hNewDocument
'   set Default Tab Stop to 2,9cm
    ToolsOptions
    Call hToolsOptions ("WRITER","GENERAL")
    Masseinheit.Select (2) ' cm
'   printlog "before " + Tabulatorenabstand.GetText
    Tabulatorenabstand.SetText ( "2" + GetDecimalSeperator(Tabulatorenabstand.GetText) + "90" + mUnit )
'   printlog "after " + Tabulatorenabstand.GetText
    Kontext "ExtrasOptionenDlg"
    ExtrasOptionenDlg.OK
    sleep (2)

'   load file in this environment
    '///use "output\\writer\\w95\\tab25cm.odt" ///
    Call hFileOpen (gOfficePath + "user\work\tab25cm.odt")
    sleep (2)
'   check TabStops, have to be the ones this file was saved with
    ToolsOptions
    Call hToolsOptions ("WRITER","GENERAL")
    Masseinheit.Select (2) ' cm
'   printlog "before " + Tabulatorenabstand.GetText
    if Tabulatorenabstand.GetText <> ("2" + GetDecimalSeperator(Tabulatorenabstand.GetText) + "50" + mUnit) Then
        warnlog "the tab stops didn't get saved in the document !!!"
        printlog "should be 2,.50" + mUnit + ", is" + Tabulatorenabstand.GetText
    end if
    Kontext "ExtrasOptionenDlg"
    ExtrasOptionenDlg.OK
    Call hCloseDocument
    Call hCloseDocument

'---------------------------------------------------------------------------------
    Printlog ("- all Check -> x ")

    ToolsOptions
    Call hToolsOptions ("WRITER","GENERAL")

'   NurFuerAktuellesDokument.Check
    Feldbefehle.Check
    Diagramme.Check
'   FelderUndDiagrammeAktuellesDokument.Check

    if (Nie.IsChecked = True) Then Immer.Check Else Nie.Check

    bTempRadioBut(1) = Immer.IsChecked
    bTempRadioBut(2) = AufNachfrage.IsChecked
    bTempRadioBut(3) = Nie.IsChecked

    Masseinheit.Select (2)
    itemp = Masseinheit.GetSelIndex
    sTemp = "3" + GetDecimalSeperator(Tabulatorenabstand.GetText) + "21" + mUnit
    Tabulatorenabstand.SetText (sTemp)

    Kontext "ExtrasOptionenDlg"
    ExtrasOptionenDlg.OK

    printlog ("- check if all Checked ")
    ToolsOptions
    Call hToolsOptions ( "WRITER" , "GENERAL" )

'   if not NurFuerAktuellesDokument.IsChecked            Then WarnLog "NurFuerAktuellesDokument o"
    if not Feldbefehle.IsChecked                         Then WarnLog "Feldbefehle o"
    if not Diagramme.IsChecked                           Then WarnLog "Diagramme o"
'   if not FelderUndDiagrammeAktuellesDokument.IsChecked Then WarnLog "FelderUndDiagrammeAktuellesDokument o"

    if ( bTempRadioBut(1) <> Immer.IsChecked       ) Then WarnLog "Immer state changed"
    if ( bTempRadioBut(2) <> AufNachfrage.IsChecked) Then WarnLog "AufNachfrage state changed"
    if ( bTempRadioBut(3) <> Nie.IsChecked         ) Then WarnLog "Nie state changed"

    if ( Masseinheit.GetSelIndex <> iTemp ) Then WarnLog "Masseinheit is not item " + iTemp + " it's: " + Masseinheit.GetSelIndex
    if (LiberalMeasurement (sTemp,Tabulatorenabstand.GetText) <> TRUE ) Then WarnLog "Tabulatorenabstand is not " + sTemp + " it's: " + Tabulatorenabstand.GetText

    printlog ("- restore states ")

'   if ( irgendwas(1) =  TRUE ) Then NurFuerAktuellesDokument.Check            Else NurFuerAktuellesDokument.UnCheck
    if ( irgendwas(2) =  TRUE ) Then Feldbefehle.Check                         Else Feldbefehle.UnCheck
    if ( irgendwas(3) =  TRUE ) Then Diagramme.Check                           Else _
    if Feldbefehle.IsChecked Then Diagramme.UnCheck
'   if Diagramme.IsVisible Then Diagramme.UnCheck
'   if ( irgendwas(4) =  TRUE ) Then FelderUndDiagrammeAktuellesDokument.Check Else FelderUndDiagrammeAktuellesDokument.UnCheck

    if ( bRadioBut(1) = TRUE ) Then Immer.Check
    if ( bRadioBut(2) = TRUE ) Then AufNachfrage.Check
    if ( bRadioBut(3) = TRUE ) Then Nie.Check

    Masseinheit.Select (iMasseinheit) 'sw:ListBox:TP_LAYOUT_O
    Tabulatorenabstand.SetText (sTabAbstand) '     sw:MetricField:TP_LAYOUT_OPT:MF_TAB

    Kontext "ExtrasOptionenDlg"
    ExtrasOptionenDlg.OK

    Do Until GetDocumentCount = 0
        Call hCloseDocument
    Loop
endcase

'------------------------------------------------------------------------------
sub hGetAllOptionsWriterGeneralCaption
    Dim fHoleTabPage as String
    Dim fHoleTabPage2 as String
    Dim lsHoleTabPage(100) as String
    Dim lsHoleTabPage2(100) as String
    dim i as integer
    dim x as integer
    dim y as integer ' for schleifen stuff

    '/// usually there are 4 entries in the list for Options->Writer->General->Caption->Categorie ///'
    '///+ if not, this routine is called ///'
    '///+ The error only appears, if the wrong listItem is not called yet! ///'

    lsHoleTabPage(0)=0
    lsHoleTabPage2(0)=0

    '/// on error, save before selecting entries to "output\\writer\\opt__" + iSprache + "." + gPlatGroup) ///
    '/// on error, save entries after selecting all to "output\\writer\\opt2__" + iSprache + "." + gPlatGroup) ///
    fHoleTabPage = ConvertPath(gOfficePath + "user\work\opt__" + iSprache + "." + gPlatGroup)
    fHoleTabPage2 = ConvertPath(gOfficePath + "user\work\opt2_" + iSprache + "." + gPlatGroup)

    '------------------------
    Printlog "(1/3) Get all items before selecting smth. "
    ' put them in lsHoleTabPage and write them to 'user\work\opt__...'

    Call hNewDocument

    ToolsOptions
    Call hToolsOptions ("WRITER","AutoCaption")
    Kontext "TabAutoCaption"

    for x=1 to ObjectList.GetItemCount
'       Printlog x
        ObjectList.Select (x)
        ListAppend ( lsHoleTabPage(), ObjectList.GetText + " " + Category.GetItemCount)
        for y=1 to Category.GetItemCount
            Category.Select (y)
            sleep (1)
            ListAppend ( lsHoleTabPage(), "   " + Category.GetSelText )
        next y
    next x

    Kontext "ExtrasOptionenDlg"
    ExtrasOptionenDlg.OK

    Call ListWrite(lsHoleTabPage(),fHoleTabPage, "utf8")
    Printlog "list with all entries written to: "+fHoleTabPage

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

    Printlog "(2/3) Select every ListItem & exit with OK "
    ToolsOptions
    Call hToolsOptions ("WRITER","AutoCaption")
    Kontext "TabAutoCaption"

    for x=1 to ObjectList.GetItemCount
'       Printlog "-" + x
        ObjectList.Select (x)
        i=0
        while ( i < Category.GetItemCount )
            try
                Category.Select (i+1)
            catch
                Category.Select (i)
            endcatch
            i = Category.GetSelIndex
'           Printlog i
            sleep (2)
            Kontext "TabAutoCaption"
        Wend
    next x

    Kontext "ExtrasOptionenDlg"
    ExtrasOptionenDlg.OK

    '------------------------
    Printlog "(3/3) Get all items after selecting all "
    ' put them in lsHoleTabPage2 and write them to 'user\work\opt2_...'

    ToolsOptions
    Call hToolsOptions ("WRITER","AutoCaption")
    Kontext "TabAutoCaption"
    for x=1 to ObjectList.GetItemCount
'       Printlog x
        ObjectList.Select (x)
        ListAppend ( lsHoleTabPage2(), ObjectList.GetText + " " + Category.GetItemCount)
        for y=1 to Category.GetItemCount
            Category.Select (y)
            sleep (1)
            ListAppend ( lsHoleTabPage2(), "   " + Category.GetSelText )
        next y
    next x

    Call ListWrite(lsHoleTabPage2(),fHoleTabPage2, "utf8")
    Printlog "list with all entries after selecting every entry written to: "+fHoleTabPage2

end sub

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

testcase tToolsOptionsWriterAutoCaption

    '/// look if properties get saved for each list item ///
    '///+ take "Numbering" ListBox to verify this ///

    ' checking Listentry '(7) = StarOffice 6.0 Impress' completely

    dim vObjectList(10) as integer
    dim vObjectListDescription(10) as string
    Dim vCategory(10) as integer
    Dim vCategoryTmp(10) as string
    Dim vNumbering(10) as integer
    Dim vCaptionSeparator(10) as string
    Dim vPosition(10) as integer
    Dim vLevel(10) as integer
    Dim vChapterSeparator(10) as string
    Dim vCharacterStyle(10) as integer
    Dim vApplyBorderAndShadow(10) as boolean 
    Dim NumberOfObjects as integer
    dim i as integer
    dim y as integer ' for schleifen stuff

    '/// !no more Listentries than 9, you have to update the allocation for the var's! ///'
    Call hNewDocument
    printlog "- Tools/Options/Writer: AutoCaption "

    printlog ("- save states ")
    ToolsOptions
    Call hToolsOptions ("WRITER","AutoCaption")
    Kontext "TabAutoCaption"

    NumberOfObjects = ObjectList.GetItemCount
    Select Case gPlatGroup
        Case "w95"
            if (NumberOfObjects <> 9) then
                warnlog "Number of Object List is not correct"
            end if
        Case else
            if (NumberOfObjects <> 8) then
                warnlog "Number of Object List is not correct"
            end if
    end select

    for i=1 to NumberOfObjects
        ObjectList.Select (i)
        vObjectList(i) = ObjectList.IsChecked
        vObjectListDescription(i) = ObjectList.GetText
        vCategory(i) = Category.GetSelIndex
        vNumbering(i) = Numbering.GetSelIndex
        vCaptionSeparator(i) = CaptionSeparator.GetText
        vPosition(i) = Position.GetSelIndex
        vLevel(i) = Level.GetSelIndex
        vChapterSeparator(i) = ChapterSeparator.GetText
        vCharacterStyle(i) = CharacterStyle.GetSelIndex
        vApplyBorderAndShadow(i) = ApplyBorderAndShadow.IsChecked
    next i

    '-- just checking the checkboxes of 'ObjectList'
    printlog ("- uncheck all object - checkboxes ")
    for i=1 to NumberOfObjects
        ObjectList.Select (i)
        ObjectList.UnCheck
    next i
    Kontext "ExtrasOptionenDlg"
    ExtrasOptionenDlg.OK
    
    printlog ("- verify if all unchecked and check all ")
    ToolsOptions
    Call hToolsOptions ("WRITER","AutoCaption")
    Kontext "TabAutoCaption"
    for i=1 to NumberOfObjects
        ObjectList.Select (i)
        if ObjectList.IsChecked Then
            WarnLog ObjectList.GetText & " is checked though it had been unchecked before"
        else
            ObjectList.Check
        end if
    next i
    Kontext "ExtrasOptionenDlg"
    ExtrasOptionenDlg.OK

    printlog ("- verify all checkboxes are checked ")
    ToolsOptions
    Call hToolsOptions ("WRITER","AutoCaption")
    Kontext "TabAutoCaption"
    for i=1 to NumberOfObjects
        ObjectList.Select (i)
        if ( ObjectList.IsChecked = FALSE ) Then
            WarnLog ObjectList.GetText & " is unchecked though it had been checked before"
            ObjectList.Check
        end if
    next i

    printlog ("- change states ")
    '/// look if properties get saved for each list item
    for i=1 to NumberOfObjects
        ObjectList.Select (i)
        printlog " - " & ObjectList.GetText
        if ObjectList.IsChecked Then
            if i <= 7 then Numbering.Select i
            CaptionSeparator.Settext "Caption Separator " & cstr(i)
            ChapterSeparator.Settext cstr(i)
            Level.Select i
            CharacterStyle.Select i
            Select Case i
                case 1:
                    Category.Select 2 
                    Position.Select 1
                case 2:
                    Category.Select 3
                    Position.Select 2
                case 3:
                    Category.Select 4
                    ApplyBorderAndShadow.Check
                case 4:
                    Category.Select 5
                case 5:
                    Category.Select 2
                case 6:
                    Category.Select 3
                case 7:
                    Category.Select 4
                case 8:
                    Category.Select 5
                    if Numbering.GetItemCount > 7 then
                        Numbering.Select Numbering.GetItemCount
                    else
                        Numbering.Select 4
                    end if
                case 9:
                    Category.Select 2
                    if Numbering.GetItemCount > 7 then
                        Numbering.Select Numbering.GetItemCount
                    else
                        Numbering.Select 5
                    end if

                end select
                vCategoryTmp(i) = Category.GetSelText
        else
            Warnlog ObjectList.GetText & " is not checked: Verify test script"
        end if
    next i
    Kontext "ExtrasOptionenDlg"
    ExtrasOptionenDlg.OK

    printlog ("- SO quit - start")

    Call wOfficeRestart

    printlog ("- checking states ")
    ToolsOptions
    Call hToolsOptions ("WRITER","AutoCaption")
    Kontext "TabAutoCaption"
    for i=1 to NumberOfObjects
        ObjectList.Select (i)
        printlog " - " & ObjectList.GetText
		wait 500
        if ObjectList.IsChecked Then
            if i <= 7 then
                if Numbering.GetSelIndex <> i then
                    Warnlog "-    'Numbering' changed after restart"
                else
                    printlog "-   'Numbering' => ok"
                end if
            end if
            if CaptionSeparator.Gettext <> "Caption Separator " & cstr(i) then
                Warnlog "-    'Caption Separator' changed after restart"
            else
                printlog "-    'Caption Separator' => ok"
            end if
            if ChapterSeparator.Gettext <>  cstr(i) then
                Warnlog "-    'Chapter Separator' changed after restart"
            else
                printlog "-    'Chapter Separator' => ok"
            end if
            if Level.GetSelIndex <> i then 
                Warnlog "-    'Level' changed after restart"
            else
                Printlog "-    'Level' => ok"
            end if
            if CharacterStyle.GetSelIndex <> i then
                Warnlog "-    'Character Style' changed after restart"
            else
                printlog "-    'Character Style' => ok"
            end if

            if Category.GetSelText <> vCategoryTmp(i) then
                Warnlog "-    'Category' changed after restart. Not " & vCategoryTmp(i) & " but " & Category.GetSelText
            else
                printlog "-    'Category' => ok"
            end if

            Select Case i
                case 1:
                    if Position.GetSelIndex <> 1 then
                        Warnlog "-    'Position' changed after restart"
                    else
                        printlog "-    'Position' => ok"
                    end if

                case 2:
                    if Position.GetSelIndex <> 2 then
                        Warnlog "-    'Position' changed after restart"
                    else
                        printlog "-    'Position' => ok"
                    end if

                case 3:
                    if Position.IsEnabled = true then
                        Warnlog "-    'Position' should be disabled"
                    else
                        printlog "-    'Position' disabled => ok"
                    end if
                    
                    if ApplyBorderAndShadow.IsChecked = false then
                        Warnlog "-    'Apply Border and Shadow' changed after restart"
                    else
                        printlog "-    'Apply Border and Shadow => ok"
                    end if

                case 4:
                    if Position.IsEnabled = true then
                        Warnlog "-    'Position' should be disabled"
                    else
                        printlog "-    'Position' disabled => ok"
                    end if

                case 5:
                    if Position.IsEnabled = true then
                        Warnlog "-    'Position' should be disabled"
                    else
                        printlog "-    'Position' disabled => ok"
                    end if

                case 6:
                    if Position.IsEnabled = true then
                        Warnlog "-    'Position' should be disabled"
                    else
                        printlog "-    'Position' disabled => ok"
                    end if

                case 7:
                    if Position.IsEnabled = true then
                        Warnlog "-    'Position' should be disabled"
                    else
                        printlog "-    'Position' disabled => ok"
                    end if

                case 8:
                    if Numbering.GetItemCount > 7 then
                        if Numbering.GetSelIndex <> Numbering.GetItemCount then
                            Warnlog "-    'Numbering' changed after restart"
                        else
                            printlog "-    'Numbering' => ok"
                        end if
                    else
                        if Numbering.GetSelIndex <> 4 then
                            Warnlog "-    'Numbering' changed after restart"
                        else
                            printlog "-    'Numbering' => ok"
                        end if
                    end if

                    if Position.IsEnabled = true then
                        Warnlog "-    'Position' should be disabled"
                    else
                        printlog "-    'Position' disabled => ok"
                    end if

                case 9:
                    if Numbering.GetItemCount > 7 then
                        if Numbering.GetSelIndex <> Numbering.GetItemCount then
                            Warnlog "-    Numbering changed after restart"
                        else
                            printlog "-    Numbering => ok"
                        end if
                    else
                        if Numbering.GetSelIndex <> 5 then
                            Warnlog "-    'Numbering changed after restart"
                        else
                            printlog "-    'Numbering' => ok"
                        end if
                    end if

                    if Position.IsEnabled = true then
                        Warnlog "-    'Position' should be disabled"
                    else
                        printlog "-    'Position' disabled => ok"
                    end if

            end select
        else
            Warnlog "-   " & ObjectList.GetText & " is not checked"
        end if
    next i

    Kontext "ExtrasOptionenDlg"
    ExtrasOptionenDlg.OK

    printlog ("- restore states ")

    ToolsOptions
    Call hToolsOptions ("WRITER","AutoCaption")
    Kontext "TabAutoCaption"

    for i=1 to NumberOfObjects
        ObjectList.Select (i)
        if ObjectList.IsChecked then
            if vCategory(i) > Category.GetItemCount then
                Category.Select Category.GetItemCount
            else
                Category.Select vCategory(i)
            end if
            Numbering.Select vNumbering(i)
            CaptionSeparator.SetText vCaptionSeparator(i)
            if Position.IsEnabled then Position.Select vPosition(i)
            Level.Select vLevel(i)
            ChapterSeparator.Settext vChapterSeparator(i)
            CharacterStyle.Select vCharacterStyle(i)
            if ApplyBorderAndShadow.IsEnabled then
                Select Case vApplyBorderAndShadow(i)
                    Case true
                        ApplyBorderAndShadow.Check
                    case false
                        ApplyBorderAndShadow.Uncheck
                end select
            end if
        end if
        Select case vObjectList(i)
            Case true
                ObjectList.Check
            case false
                ObjectList.Uncheck
        end select
    next i


    Kontext "ExtrasOptionenDlg"
    ExtrasOptionenDlg.OK

    Do Until GetDocumentCount = 0
        Call hCloseDocument
    Loop
endcase

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

testcase tToolsOptionsWriterGeneral
    Dim i as integer
    Dim ist_aktualisiert as boolean
    Dim CompareThis as string

    ' State is saved with document. Thats why I use 3 docs
    Call hNewDocument
    printlog "- Extras / Optionen / Sonstiges / Verkn?pfungen aktualisieren "
    ToolsOptions
    Call hToolsOptions("WRITER","GENERAL")
    printlog "- Update links when loading -> always "
    Immer.Check
    Kontext "ExtrasOptionenDlg"
    ExtrasOptionenDlg.OK
    FileOpen
    Kontext "OeffnenDlg"
    Dateiname.SetText ConvertPath(gtesttoolpath + "writer\optional\input\masterdoc\update1.sxg")
    Oeffnen.Click
    Kontext "Active"
    if active.exists then
        if Active.GetRT = 304 then
            Warnlog Active.Gettext
            Warnlog "Update all links should not appear!"
            wait 500
            try
                Active.yes
            catch
                Active.Ok
            endcatch
        end if
    end if
    Sleep 2
    Call hCloseDocument
    Sleep 2

    ToolsOptions
    Call hToolsOptions("WRITER","GENERAL")
    if not Immer.IsChecked then Warnlog "Option 'always' has not been changed"
    printlog "- Update links when loading -> On request "
    AufNachfrage.Check
    Kontext "ExtrasOptionenDlg"
    ExtrasOptionenDlg.OK
    FileOpen
    Kontext "OeffnenDlg"
    Dateiname.SetText ConvertPath(gtesttoolpath + "writer\optional\input\masterdoc\update2.sxg")
    Oeffnen.Click
    Sleep 2
    Kontext "Active"
    if active.exists then
        if Active.GetRT = 304 then
            Active.yes
        else
            Warnlog "Update all links should appear!"
        end if
    end if
    Sleep 2
    Call hCloseDocument
    Sleep 2

    ToolsOptions
    Call hToolsOptions("WRITER","GENERAL")
    if not AufNachfrage.IsChecked then Warnlog "Option 'On request' has been changed"
    printlog "- Update links when loading -> Never "
    Nie.Check
    Kontext "ExtrasOptionenDlg"
    ExtrasOptionenDlg.OK
    FileOpen
    Kontext "OeffnenDlg"
    Dateiname.SetText ConvertPath(gtesttoolpath + "writer\optional\input\masterdoc\update3.sxg")
    Oeffnen.Click
    Kontext "Active"
    if active.exists then
        if Active.GetRT = 304 then
            Warnlog "Update all links should not appear!"
            Active.yes
         end if
    end if
    Sleep 3
    Kontext "DocumentWriter"
    DocumentWriter.TypeKeys "<Up>",10
    DocumentWriter.TypeKeys "<Mod1 Home>", 4
    for i=1 to 4
        DocumentWriter.TypeKeys "<Shift End>"
        try
            EditCopy
            if i <> 4 and GetClipboardtext <> "Dies ist der Text" then ist_aktualisiert = true
        catch
            ist_aktualisiert=false
        endcatch
        DocumentWriter.TypeKeys "<Mod1 End>"
        wait 500
        DocumentWriter.TypeKeys "<Down><Home>"
    next i
    if ist_aktualisiert=true then Warnlog " Document has been updated !"
    Sleep 2
    Call hCloseDocument
    Sleep 2

    ToolsOptions
    Call hToolsOptions("WRITER","GENERAL")
    if Nie.IsChecked = false then Warnlog "Option 'Never' is not checked"
    AufNachfrage.Check
    Kontext "ExtrasOptionenDlg"
    ExtrasOptionenDlg.OK

    Do Until GetDocumentCount = 0
        Call hCloseDocument
    Loop
endcase

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

testcase tToolsOptionsWriterMailMerge

    Call hNewDocument
    printlog ("- Tools/Options/Writer: Mail Merge ")
    Kontext "Navigator"
    if Navigator.Exists then ViewNavigator
    ToolsOptions
    Call hToolsOptions ("WRITER","MailMergeEMail")

    '/// Fill out all fields
    printlog " - fill out Mail Settings"
    Kontext "TabMailMergeEmail"
    YourName.Settext "Fredrik Haegg"
    EmailAddress.Settext "helge.delfs@sun.com"
    SendReplies.Check
    ReplyAddress.Settext "fredrikh@openoffice.org"
    ServerName.Settext "MySMTP-Server"
    UseSecure.Check
    
    '/// Change details for Server Authentication
    printlog " - fill out Authentication Settings"
    ServerAuthentication.Click
    wait 500
    Kontext "ServerAuthentication"
    SMTPauthentication.Check
    
    IncomingMailServer.Check
    Server.Settext "MySMTP-Server"
    Port.Settext "111"
    IMAP.Check
    User.Settext "MyAuthenticationUserName"
    Password.Settext "MyAuthenticationPassword"
    ServerAuthentication.Ok
    
    '/// Close 'Server Authentication dialog, reopen and check values set
    printlog " - check settings"
    Kontext "TabMailMergeEmail"
    ServerAuthentication.Click
    wait 500
    Kontext "ServerAuthentication"
    if Not SMTPauthentication.IsChecked then Warnlog "SMTP Authentication is not checked anymore"
    if Not IncomingMailServer.IsChecked then Warnlog "Incoming Mail Server has been changed"
    if Server.Gettext <> "MySMTP-Server" then Warnlog "Servername has been changed"
    if Port.Gettext <> "111" then Warnlog "Server Port has been changed"
    if Not IMAP.IsChecked then Warnlog "IMAP-state has been changed"
    if User.Gettext <> "MyAuthenticationUserName" then Warnlog "Authentication username has been changed"
    if Password.Gettext <> "MyAuthenticationPassword" then Warnlog "Authentication password has been changed"
    
    '/// Change settings for SMTP outgoing
    SMTPOutgoing.Check
    OutgoingUsername.Settext "MyOutgoingUsername"
    OutgoingPassword.Settext "MyOutgoingPassword"
    ServerAuthentication.Ok
    
    '/// Close options dialog and restart the office
    Kontext "ExtrasOptionenDlg"
    ExtrasOptionenDlg.Ok
    printlog " - restart office"
    Call wOfficeRestart

    '/// Reopen Tools/Options and check settings
    printlog " - check settings"
    ToolsOptions
    Call hToolsOptions ("WRITER","MailMergeEMail")

    Kontext "TabMailMergeEmail"
    if YourName.Gettext <> "Fredrik Haegg" then Warnlog "'Your Name' has been changed after a restart"
    if EmailAddress.Gettext <> "helge.delfs@sun.com" then Warnlog "'Email Address' has been changed after a restart"
    if Not SendReplies.IsChecked then Warnlog "'Send replies' has been changed after a restart"
    if ReplyAddress.Gettext <> "fredrikh@openoffice.org" then Warnlog "'Reply adresses' has been changed after a restart"
    if ServerName.Gettext <> "MySMTP-Server" then Warnlog "'Server name' has been changed after a restart"
    if UseSecure.IsChecked = false then Warnlog "'Secure' has been changed after a restart"

    ServerAuthentication.Click
    wait 500
    Kontext "ServerAuthentication"
    if Not SMTPOutgoing.IsChecked then Warnlog "'SMTP Server' has been changed after a restart"
    if OutgoingUsername.Gettext <> "MyOutgoingUsername" then Warnlog "'Username' has been changed after a restart"
    if OutgoingPassword.Gettext <> "MyOutgoingPassword" then Warnlog "'Password' has been changed after a restart"
    
    ServerAuthentication.Ok

    '/// Check 'Test Settings' button
    Kontext "TabMailMergeEmail"
    TestSettings.Click
    
    Kontext "TestAccountSettings"
    Do
        if TaskStatusListBox.GetItemCount > 0 then
            TestAccountSettings.Cancel
            exit do
        end if
        wait 500
    Loop
    if TestAccountSettings.Exists then TestAccountSettings.Cancel
    
    '/// Reset all states
    Kontext "TabMailMergeEmail"
    ServerAuthentication.Click
    
    Kontext "ServerAuthentication"
    IncomingMailServer.Check
    Server.Settext ""
    Port.Settext "110"
    User.Settext ""
    Password.Settext ""

    SMTPOutgoing.Check
    OutgoingUsername.Settext ""
    OutgoingPassword.Settext ""

    SMTPauthentication.UnCheck
    ServerAuthentication.Ok

    Kontext "TabMailMergeEmail"
    YourName.Settext ""
    EmailAddress.Settext = ""
    ReplyAddress.Settext ""
    ServerName.Settext ""
    SendReplies.UnCheck
    UseSecure.Uncheck

    '/// Close options dialog and restart the office
    Kontext "ExtrasOptionenDlg"
    ExtrasOptionenDlg.Ok

    Do Until GetDocumentCount = 0
        Call hCloseDocument
    Loop
endcase
'------------------------------------------------------------------------------