summaryrefslogtreecommitdiff
path: root/testautomation/writer/optional/includes/formatpage/w_formatpage1.inc
blob: 0bd255e472b343b88d7e470c8949c44f313b284b (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
'encoding UTF-8  Do not remove or change this line!
'**************************************************************************
' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
'
' Copyright 2000, 2010 Oracle and/or its affiliates.
'
' OpenOffice.org - a multi-platform office productivity suite
'
' This file is part of OpenOffice.org.
'
' OpenOffice.org is free software: you can redistribute it and/or modify
' it under the terms of the GNU Lesser General Public License version 3
' only, as published by the Free Software Foundation.
'
' OpenOffice.org is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
' GNU Lesser General Public License version 3 for more details
' (a copy is included in the LICENSE file that accompanied this code).
'
' You should have received a copy of the GNU Lesser General Public License
' version 3 along with OpenOffice.org.  If not, see
' <http://www.openoffice.org/license.html>
' for a copy of the LGPLv3 License.
'
'/************************************************************************
'*
'* owner : helge.delfs@oracle.com
'*
'* short description : Test the functionality of Page Formatting / Page Styles - 1
'*
'************************************************************************
'*
' #1 tFormatPage_1       'Open format/page dialog
' #1 tFormatPage_2       'Test Portrait in tabpage Page
' #1 tFormatPage_3       'Test Landscape in tabpage Page
' #1 tFormatPage_4       'Width and Height boxes must change after changing between Portrait and Landscape
' #1 tFormatPage_5       'The sum of "Left margin" and "Right margin" must always stay below the Paper width.(Same for top/bottom and height)
' #1 tFormatPage_6       'Test predefined formats
' #1 tFormatPage_7       'Test user defined formats
' #1 tFormatPage_8       'Check Listbox Text Direction when Asian language support is enabled
' #1 tFormatPage_9       'Check Listbox Text Direction when CTL is enabled
' #1 tFormatPage_10      'when Asian support and CTL are all enabled , 3 entries should be in Text Direction listbox
' #1 TFormatPage_11      'Test Page layout - Right and left
' #1 tFormatPage_12      'Test Page layout - Mirrored
' #1 tFormatPage_13      'Test Page layout - Only right
' #1 tFormatPage_14      'Test Page layout - Only left
' #1 tFormatPage_15      'Insertfields / other / Document / Type/Page -> As page Style must be set
'*
'\***********************************************************************

testcase tFormatPage_1

	PrintLog "- Open format/page dialog"
	'/// <b> Open format/page dialog </b> ///
	
	Call hNewDocument
	
	'/// 1. via Mouse clicks in Menu: Format-Page
	try
		fFormatPageWriter("TabSeite")
		TabSeite.Cancel
	catch
	endcatch
	
	'/// 2. via shortcuts in menu  (manual test is needed)
	
	'/// 3. via Context menu when Cursor is in the document
	try
		hMenuSelectNr(5)
		Sleep 2
		hMenuSelectNr(5)
		Sleep 2
		Kontext
		Active.SetPage TabSeite
		Kontext "TabSeite"
		TabSeite.Cancel
	catch
	endcatch
	
	Call hCloseDocument

endcase

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

testcase tFormatPage_2

  	Dim sTestString   as String
	Dim iRepectLength as Integer
	Dim iFormat       as Integer

	sTestString   =  "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQ"
	iRepectLength =  26
	iFormat       =  2   'A4 paper

	PrintLog "- Test Portrait in tabpage Page"
	'/// <b> Test Portrait in tabpage Page </b> ///

	Call hNewDocument

	'/// Input a long test string
    Call wTypeKeys sTestString

   '/// Format/Page , tabpage page , check 'Portrait'
    fFormatPageWriter("TabSeite")
    Papierformat.Select iFormat
    Wait 500
    Hoch.Check
    Wait 500
    TabSeite.OK

	'/// Check if Checkbox -- Portrait works fine
    Call wTypeKeys "<Shift Home>"
    EditCopy
    wait 500
    if Len(GetClipboardText) < iRepectLength then Warnlog "Checkbox Portrait doesn't work fine!"

	Call hCloseDocument

endcase

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

testcase tFormatPage_3

    Dim iTextLength as integer
	
	PrintLog "- Test Landscape in tabpage Page"
	'/// Test Landscape in tabpage Page
	
	Call hNewDocument

	Call wOptionsUndo( "Grundschriften" )
	
	'/// Input a long test string
	Call wTypeKeys "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQ"
    Call wTypeKeys "<Mod1 Home>"
    Call wTypeKeys "<Shift End>"
    EditCopy
    iTextLength = Len(GetClipBoardtext)
	
	'/// Format/Page , tabpage page , check 'Landscape'
	fFormatPageWriter("TabSeite")
	Papierformat.Select 2 ' A4 Paper
	Wait 500
	Quer.Check
	Wait 500
	TabSeite.OK
	
	'/// Check if Checkbox -- Landscape works fine
	Call wTypeKeys "<Mod1 Home>"
    Call wTypeKeys "<Shift End>"
	EditCopy
	wait 500
	if Len(GetClipboardText) <= iTextLength then Warnlog "Checkbox Landscape doesn't work fine!"
	
	Call hCloseDocument

endcase

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

testcase tFormatPage_4

	Dim iFormat as Integer
	Dim sWidth  as String
    Dim sHeight as String
	
	iFormat = 2   'A4 paper
	
	PrintLog "- Width and Height boxes must change after changing between Portrait and Landscape"
	'/// Width and Height boxes must change after changing between Portrait and Landscape
	
	Call hNewDocument
	
	'/// Format/Page  tabpage page ,
	'/// + check 'Portrait' first and get width and height ,
	'/// + then change from Portrait to Landscape
	'/// + check if the change is effective
	fFormatPageWriter("TabSeite")
	Papierformat.Select iFormat
	Wait 500
	Hoch.Check
	Sleep 1
	sWidth  = Breite.GetText
	sHeight = Hoehe.GetText
	
	Quer.Check
	Sleep 1
	if Breite.GetText <> sHeight  then Warnlog "Width isn't changed when changing from Portrait to Landscape !"
	if Hoehe.GetText  <> sWidth   then Warnlog "Height isn't changed when changing from Portrait to Landscape !"
	TabSeite.Cancel
	
	'/// Format/Page  tabpage page ,
	'/// + check 'Landscape' first and get width and height ,
	'/// + then change from Landscape to Portrait
	'/// + check if the change is effective
	fFormatPageWriter("TabSeite")
	Papierformat.Select iFormat
	Wait 500
	Quer.Check
	Sleep 1
	sWidth  = Breite.GetText
	sHeight = Hoehe.GetText
	
	Hoch.Check
	Sleep 1
	if Breite.GetText <> sHeight  then Warnlog "Width isn't changed when changing from Landscape to Portrait !"
	if Hoehe.GetText  <> sWidth   then Warnlog "Height isn't changed when changing from Landscape to Portrait !"
	TabSeite.Cancel
	
	Call hCloseDocument

endcase

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

testcase tFormatPage_5

	Dim iFormat as Integer
	Dim sWidth  as String , sHeight as String
	Dim sLeft   as String , sRight as String   , sUp as String  , sBottom as String  ' set page size
	Dim sLeft1 as String  , sRight1 as String  ,  sUp1 as String  , sBottom1 as String  ' get page size
	
	iFormat    = 2   'A4 paper
	sWidth     = "20" + gSeperator + "00" + gMeasurementUnit
	sHeight    = "25" + gSeperator + "00" + gMeasurementUnit
	
	sLeft      = "15" + gSeperator + "00" + gMeasurementUnit
	sRight     = "15" + gSeperator + "00" + gMeasurementUnit
	sUp        = "15" + gSeperator + "00" + gMeasurementUnit
	sBottom    = "15" + gSeperator + "00" + gMeasurementUnit
	
	sLeft1     = "15" + gSeperator + "00" + gMeasurementUnit
	sRight1    = "4"  + gSeperator + "50" + gMeasurementUnit
	sUp1       = "15" + gSeperator + "00" + gMeasurementUnit
	sBottom1   = "9"  + gSeperator + "50" + gMeasurementUnit
	
	PrintLog "- The sum of 'Left margin' and 'Right margin' must always stay below the Paper width."
	PrintLog "  (Same for top/bottom and height)"
	'/// The sum of "Left margin" and "Right margin" must always stay below the Paper width.
	'/// (Same for top/bottom and height)
	
	Call hNewDocument
	
	'/// Format/Page , tabpage Page , set width and height , close the dialog
	fFormatPageWriter("TabSeite")
	Papierformat.Select iFormat
	Wait 500
	Hoch.Check
	Sleep 1
	Breite.SetText sWidth
	Wait 500
	Hoehe.SetText sHeight
	Wait 500
	TabSeite.OK
	
	'/// Format/Page , tabpage Page ,
	'/// + Set the sum of "Left margin" and "Right margin" more than Width
	fFormatPageWriter("TabSeite")
	Links.SetText   sLeft
	Wait 500
	Rechts.SetText  sRight
	Wait 500
	TabSeite.OK
	
	'/// Check if the setting is OK
	fFormatPageWriter("TabSeite")
	if Left$(Links.GetText,5)   <>  Left$(sLeft1,5)   then Warnlog "The Margin(left) is wrong!"
	if Left$(Rechts.GetText,4)  <>  Left$(sRight1,4)  then Warnlog "The Margin(right) is wrong!"
	TabSeite.Cancel
	
	'/// Format/Page , tabpage Page ,
	'/// + Set the sum of "Up margin" and "Bottom margin" more than Heigth
	fFormatPageWriter("TabSeite")
	Oben.SetText   sUp
	Wait 500
	Unten.SetText  sBottom
	Wait 500
	TabSeite.OK
	
	'/// Check if the setting is OK
	fFormatPageWriter("TabSeite")
	if Left$(Oben.GetText,5)   <>  Left$(sUp1,5)      then Warnlog "The Margin(Up) is wrong!"
	if Left$(Unten.GetText,4)  <>  Left$(sBottom1,4)  then Warnlog "The Margin(Bottom) is wrong!"
	TabSeite.Cancel
	
	Call hCloseDocument

endcase

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

testcase tFormatPage_6

	Dim iPaperTray as Integer  ,  iPageLayout as Integer
	Dim iFormatLayout as Integer  ,  iReferenceStyle as Integer
	Dim sWidth as String, sHeight as String
	Dim sLeft as String  ,  sRight as String  ,  sUp as String  ,  sBottom as String
	
	iPaperTray    = 1 :  iPageLayout     = 2
	iFormatLayout = 2 :  iReferenceStyle = 5
	
	sWidth        = "20" + gSeperator + "00" + gMeasurementUnit
	sHeight       = "25" + gSeperator + "00" + gMeasurementUnit
	sLeft         = "2"  + gSeperator + "00" + gMeasurementUnit
	sRight        = "2"  + gSeperator + "00" + gMeasurementUnit
	sUp           = "2"  + gSeperator + "00" + gMeasurementUnit
	sBottom       = "2"  + gSeperator + "00" + gMeasurementUnit
	
	PrintLog "- Test Pre-defined formats"
	'/// Test Pre-defined formats
	
	Call hNewDocument
	
	'/// Format/Page , tabpage page , do some configuration
	fFormatPageWriter("TabSeite")
	Hoch.Check
	Wait 500
	Breite.SetText       sWidth
	Wait 500
	Hoehe.SetText        sHeight
	Wait 500
	Schacht.Select       iPaperTray
	Wait 500
	Links.SetText        sLeft
	Wait 500
	Rechts.SetText       sRight
	Wait 500
	Oben.SetText         sUp
	Wait 500
	Unten.SetText        sBottom
	Wait 500
	Seitenlayout.Select  iPageLayout
	Wait 500
	Numerierung.Select   iFormatLayout
	Wait 500
	Einschalten.Check
	Sleep 1
	AbsatzVorlage.Select iReferenceStyle
	Wait 500
	TabSeite.OK
	
	'/// Save the file  , close the file and reload the file
    Call hFileSaveAsWithFilterKill (gOfficepath + "user\work\tFormatPage_6.odt", "writer8")
	Call hCloseDocument
	
	Call hNewDocument
	
	Call hFileOpen(gOfficepath + "user\work\tFormatPage_6.odt")
	
	'/// Check if Pre-defined formats are correct
	fFormatPageWriter("TabSeite")
	if Hoch.IsChecked            <> TRUE             then Warnlog "Portrait should be checked!"
	if Left$(Breite.GetText,5)   <> Left$(sWidth,5)  then Warnlog "The width is wrong!"
	if Left$(Hoehe.GetText,5)    <> Left$(sHeight,5) then Warnlog "The height is wrong!"
	if Schacht.GetSelIndex       <> iPaperTray       then Warnlog "The Paper tray is wrong!"
	if Left$(Links.GetText,4)    <> Left$(sLeft,4)   then Warnlog "The Margin(left) is wrong!"
	if Left$(Rechts.GetText,4)   <> Left$(sRight,4)  then Warnlog "The Margin(right) is wrong!"
	if Left$(Oben.GetText,4)     <> Left$(sUp,4)     then Warnlog "The Margin(top) is wrong!"
	if Left$(Unten.GetText,4)    <> Left$(sBottom,4) then Warnlog "The Margin(bottom) is wrong!"
	if Seitenlayout.GetSelIndex  <> iPageLayout      then Warnlog "The paper layout is wrong!"
	if Numerierung.GetSelIndex   <> iFormatLayout    then Warnlog "The layout settings(format) is wrong!"
	if Einschalten.IsChecked     <> TRUE             then Warnlog "Portrait should be checked!"
	if AbsatzVorlage.GetSelIndex <> iReferenceStyle  then Warnlog "The reference style is wrong!"
	TabSeite.Cancel
	
	Call hCloseDocument

endcase

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

testcase tFormatPage_7

	Dim iPaperTray as Integer  ,  iPageLayout as Integer
	Dim iFormatLayout as Integer  ,  iReferenceStyle as Integer
	Dim sWidth as String  ,  sHeight as String
	Dim sLeft as String  ,  sRight as String  ,  sUp as String  ,  sBottom as String
	
	iPaperTray    = 1 :  iPageLayout     = 2
	iFormatLayout = 2 :  iReferenceStyle = 5
	
	sWidth        = "20" + gSeperator + "00" + gMeasurementUnit
	sHeight       = "25" + gSeperator + "00" + gMeasurementUnit
	sLeft         = "2"  + gSeperator + "00" + gMeasurementUnit
	sRight        = "2"  + gSeperator + "00" + gMeasurementUnit
	sUp           = "2"  + gSeperator + "00" + gMeasurementUnit
	sBottom       = "2"  + gSeperator + "00" + gMeasurementUnit
	
	PrintLog "- Test user defined formats"
	'/// Test user defined formats
	
	Call hNewDocument
	
	'/// Format/Page , tabpage page , do some configuration
	fFormatPageWriter("TabSeite")
	Hoch.Check
	Wait 500
	Breite.SetText       sWidth
	Wait 500
	Hoehe.SetText        sHeight
	Wait 500
	Schacht.Select       iPaperTray
	Wait 500
	Links.SetText        sLeft
	Wait 500
	Rechts.SetText       sRight
	Wait 500
	Oben.SetText         sUp
	Wait 500
	Unten.SetText        sBottom
	Wait 500
	Seitenlayout.Select  iPageLayout
	Wait 500
	Numerierung.Select   iFormatLayout
	Wait 500
	Einschalten.Check
	Sleep 1
	AbsatzVorlage.Select iReferenceStyle
	Wait 500
	TabSeite.OK
	
	'/// Check if user defined formats are correct
	fFormatPageWriter("TabSeite")
	if Hoch.IsChecked            <> TRUE                then Warnlog "Portrait should be checked!"
	if Left$(Breite.GetText,5)   <> Left$(sWidth,5)     then Warnlog "The width is wrong!"
	if left$(Hoehe.GetText,5)    <> Left$(sHeight,5)    then Warnlog "The height is wrong!"
	if Schacht.GetSelIndex       <> iPaperTray          then Warnlog "The Paper tray is wrong!"
	if Left$(Links.GetText,4)    <> Left$(sLeft,4)      then Warnlog "The Margin(left) is wrong!"
	if Left$(Rechts.GetText,4)   <> Left$(sRight,4)     then Warnlog "The Margin(right) is wrong!"
	if Left$(Oben.GetText,4)     <> Left$(sUp,4)        then Warnlog "The Margin(top) is wrong!"
	if Left$(Unten.GetText,4)    <> Left$(sBottom,4)    then Warnlog "The Margin(bottom) is wrong!"
	if Seitenlayout.GetSelIndex  <> iPageLayout         then Warnlog "The paper layout is wrong!"
	if Numerierung.GetSelIndex   <> iFormatLayout       then Warnlog "The layout settings(format) is wrong!"
	if Einschalten.IsChecked     <> TRUE                then Warnlog "Portrait should be checked!"
	if AbsatzVorlage.GetSelIndex <> iReferenceStyle     then Warnlog "The reference style is wrong!"
	TabSeite.Cancel
	
	Call hCloseDocument
endcase

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

testcase tFormatPage_8
    Dim RecheckCTLSupport   as string
    Dim RecheckAsianSupport as string
    RecheckCTLSupport = gCTLSup
    RecheckAsianSupport = gAsianSup

    Select Case iSystemSprache
        Case 81, 82, 86, 88
            printlog "No test with asian lovale, because checkbox 'Asian language support' is disabled by default!"
            goto endsub
    end select

    PrintLog "- Check Listbox Text Direction when Asian language support is enabled"
    '/// Check Listbox Text Direction when Asian language support is enabled

    Call hNewDocument

   '/// Set CTL unable
    Call ActiveDeactivateCTLSupport(FALSE)
    '/// Enable Asian Support
    Call ActiveDeactivateAsianSupport(TRUE)
   '/// - the Listbox Text Direction should be visible when Asian language support is enabled
    Call fFormatPageWriter("TabSeite")
    if Not Textfluss.IsVisible then
        Warnlog "Listbox 'Text Direction' isn't visible though asian support is enabled"
    end if
    TabSeite.Cancel

    '/// Disable Asian Support
    Call ActiveDeactivateAsianSupport(FALSE)
    '/// - the Listbox Text Direction should be invisible when Asian language support is unabled
    Call fFormatPageWriter("TabSeite")
    if Textfluss.IsVisible then
        Warnlog "Listbox 'Text Direction' is visible though asian support is disabled"
    end if
    TabSeite.Cancel
    
    if RecheckCTLSupport = True then
        Call ActiveDeactivateCTLSupport(TRUE)
    else
        Call ActiveDeactivateCTLSupport(FALSE)
    end if
    if RecheckAsianSupport = True then
        Call ActiveDeactivateAsianSupport(TRUE)
    else
        Call ActiveDeactivateAsianSupport(FALSE)
    end if

    Call hCloseDocument

endcase

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

testcase tFormatPage_9

    Dim RecheckCTLSupport as string
    Dim RecheckAsianSupport as string
    RecheckCTLSupport = gCTLSup
    RecheckAsianSupport = gAsianSup

    PrintLog "- Check Listbox Text Direction when CTL is enabled"
    '/// Check Listbox Text Direction when CTL is enabled

    Call hNewDocument

    '/// Set CTL enabled
    Call ActiveDeactivateAsianSupport(FALSE)
    Call ActiveDeactivateCTLSupport(TRUE)
    '/// Check if 'Text direction' appears
    Call fFormatPageWriter("TabSeite")
    if Textfluss.IsVisible = False then
        Warnlog "Right to Left (horizontal) should appear when CTL is checked!"
    end if
    TabSeite.Cancel

    '/// Set CTL unable
    Call ActiveDeactivateCTLSupport(FALSE)

    '/// Check if 'Text direction' appears
    Call fFormatPageWriter("TabSeite")
    if Textfluss.IsVisible = TRUE then
        Warnlog "Left to Right (horizontal) appears though CTL is disabled"
    end if
    TabSeite.Cancel

    if RecheckCTLSupport = True then
        Call ActiveDeactivateCTLSupport(TRUE)
    else
        Call ActiveDeactivateCTLSupport(FALSE)
    end if
    if RecheckAsianSupport = True then
        Call ActiveDeactivateAsianSupport(TRUE)
    else
        Call ActiveDeactivateAsianSupport(FALSE)
    end if

    Call hCloseDocument
endcase

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

testcase tFormatPage_10

    Dim RecheckCTLSupport   as string
    Dim RecheckAsianSupport as string
    RecheckCTLSupport = gCTLSup
    RecheckAsianSupport = gAsianSup
    
    PrintLog "- when Asian support and CTL are all enabled , 3 entries should be in Text Direction listbox"
    '/// when Asian support and CTL are all enabled , 3 entries should be in Text Direction listbox
    
    Call hNewDocument
    
    '/// Set Asian support enabled and Set CTL enabled
    Call ActiveDeactivateAsianSupport(TRUE)
    Call ActiveDeactivateCTLSupport(TRUE)
    
    '/// Check if there are 3 entires in Text Direction listbox
    fFormatPageWriter("TabSeite")
    if Textfluss.GetItemCount <> 3 then
        Warnlog "There should be 3 entries in Text direction listbox , but get " & Textfluss.GetItemCount
    end if
    TabSeite.Cancel

    if RecheckCTLSupport = True then
        Call ActiveDeactivateCTLSupport(TRUE)
    else
        Call ActiveDeactivateCTLSupport(FALSE)
    end if
    if RecheckAsianSupport = True then
        Call ActiveDeactivateAsianSupport(TRUE)
    else
        Call ActiveDeactivateAsianSupport(FALSE)
    end if
    
    Call hCloseDocument
endcase

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

testcase tFormatPage_11

    Dim sTestFile    as String
    Dim sMarginsLeft as String
    Dim iPageLayout  as Integer

    sTestFile    = Convertpath (gTesttoolpath + "writer\optional\input\formatpage\pageLayout.sxw")
    sMarginsLeft = "10" + gSeperator + "00" + gMeasurementUnit
    iPageLayout  = 1

    PrintLog "- Test Page layout - Right and left"
    '/// Test Page layout - Right and left

     Call hNewDocument

    '/// Open a test file ,
    '/// + There are 2 pictures in 2 pages separately ,
    '/// + and they are anchored as character
     Call hFileOpen(sTestFile)
     Call sMakeReadOnlyDocumentEditable

    '/// FormatPage / tabpage Page , Set left margins to 10cm ,
    '/// + and set page layout to "Right to left"
     fFormatPageWriter("TabSeite")
     Links.SetText  sMarginsLeft
     Sleep 1
     Seitenlayout.Select iPageLayout
     Sleep 1
     TabSeite.OK

    '/// Set focus to first picture , format/anchor to Page
    Call wTypeKeys ( "<Shift F4>" )
    Call wTypeKeys "<Tab>"

    FormatAnchorToPage
    Sleep 1

    '/// Check its position
     fPositionAndSize("TabPositionAndSizeWriter")
     if Left$(Horizontalby.Gettext,5) <> Left$(sMarginsLeft,5) then  Warnlog "1-The position X isn't right , should be " &sMarginsLeft & " but get " & Horizontalby.Gettext
     TabPositionAndSizeWriter.Cancel

    '/// Set focus to second picture , format/anchor to Page
     Call wTypeKeys "<Tab>"

     FormatAnchorToPage
     Sleep 1

    '/// Check its position
     fPositionAndSize("TabPositionAndSizeWriter")
     if Left$(Horizontalby.Gettext,5) <> Left$(sMarginsLeft,5) then  Warnlog "2-The position X isn't right , should be " &sMarginsLeft & " but get " & Horizontalby.Gettext
     TabPositionAndSizeWriter.Cancel

   Call hCloseDocument

endcase

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

testcase tFormatPage_12

    Dim sTestFile    as String
    Dim sMarginsLeft as String
    Dim sMarginsRight as String
    Dim iPageLayout  as Integer

    sTestFile     = Convertpath (gTesttoolpath + "writer\optional\input\formatpage\pageLayout.sxw")
    sMarginsLeft  = "10" + gSeperator + "00" + gMeasurementUnit
    sMarginsRight = "4"  + gSeperator + "00" + gMeasurementUnit
    iPageLayout   = 2

    PrintLog "- Test Page layout - Mirrored"
    '/// Test Page layout - Mirrored

     Call hNewDocument

    '/// Open a test file ,
    '/// + there are 2 pictures in 2 pages separately , and they are anchored as character
     Call hFileOpen(sTestFile)
     Call sMakeReadOnlyDocumentEditable

    '/// FormatPage / tabpage Page , Set left margins to 10cm ,
    '/// + and set page layout to "Mirrored"
     fFormatPageWriter("TabSeite")
     Links.SetText  sMarginsLeft
     Sleep 1
     Rechts.SetText sMarginsRight
     Sleep 1
     Seitenlayout.Select iPageLayout
     Sleep 1
     TabSeite.OK

    '/// Set focus to first picture , format/anchor to Page
    Call wTypeKeys ( "<Shift F4>" )
    Call wTypeKeys "<Tab>"

     FormatAnchorToPage
     Sleep 1

    '/// Check its position
     fPositionAndSize("TabPositionAndSizeWriter")
     if Left$(Horizontalby.Gettext,5) <> Left$(sMarginsLeft,5) then  Warnlog "1-The position X isn't right , should be " &sMarginsLeft & " but get " & Horizontalby.Gettext
     TabPositionAndSizeWriter.Cancel

    '/// Set focus to second picture , format/anchor to Page
     Call wTypeKeys "<Tab>"

     FormatAnchorToPage
     Sleep 1

    '/// Check its position
     fPositionAndSize("TabPositionAndSizeWriter")
     if Left$(Horizontalby.Gettext,4) <> Left$(sMarginsRight,4) then  Warnlog "2-The position X isn't right , should be " &sMarginsRight & " but get " & Horizontalby.Gettext
     TabPositionAndSizeWriter.Cancel

   Call hCloseDocument

endcase

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

testcase tFormatPage_13

    Dim sTestFile as String
    Dim sPage1 as String
    Dim sPage2 as String
    Dim iPageLayout as Integer

    sTestFile     = Convertpath (gTesttoolpath + "writer\optional\input\formatpage\pageLayout.sxw")
    sPage1        = "1"
    sPage2        = "3"
    iPageLayout   = 3

    PrintLog "- Test Page layout - Only right"
    '/// Test Page layout - Only right

     Call hNewDocument

    '/// Open a test file ,
    '/// + there are 2 pictures in 2 pages separately
     Call hFileOpen(sTestFile)
     Call sMakeReadOnlyDocumentEditable

    '/// FormatPage / tabpage Page , Set left margins to 10cm ,
    '/// + and set page layout to "Only right"
     fFormatPageWriter("TabSeite")
     Seitenlayout.Select iPageLayout
     Sleep 1
     TabSeite.OK

    '/// Set focus to first picture , Check if the picture is in first page
    Call wTypeKeys ( "<Shift F4>" )
    Call wTypeKeys "<Tab>"

	Kontext "Navigator"
	if Not Navigator.Exists then ViewNavigator
	Kontext "NavigatorWriter"
	Sleep 1
	if Seitennummer.GetText <> sPage1 then Warnlog "1st pic isn't in page 1 !"
	fCloseNavigator
	Wait 500

    '/// Set focus to second picture , Check if the picture is in third page
     Call wTypeKeys "<Tab>"

     Kontext "Navigator"
     if Not Navigator.Exists then ViewNavigator
     Kontext "NavigatorWriter"
     Sleep 1
     if Seitennummer.GetText <> sPage2 then Warnlog "#i40333# 2nd pic isn't in page 3 !"
     fCloseNavigator
     Wait 500

    Call hCloseDocument

endcase

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

testcase tFormatPage_14
    Dim sTestFile as String
    Dim sPage1 as String
    Dim sPage2 as String
    Dim iPageLayout as Integer

    sTestFile     = Convertpath (gTesttoolpath + "writer\optional\input\formatpage\pageLayout.sxw")
    sPage1        = "2"
    sPage2        = "4"
    iPageLayout   = 4

    PrintLog "- Test Page layout - Only left"
    '/// Test Page layout - Only left

     Call hNewDocument

    '/// Open a test file ,
    '/// + there are 2 pictures in 2 pages separately
     Call hFileOpen(sTestFile)
     Call sMakeReadOnlyDocumentEditable

    '/// FormatPage / tabpage Page , Set left margins to 10cm ,
    '/// + and set page layout to "Only left"
     fFormatPageWriter("TabSeite")
     Seitenlayout.Select iPageLayout
     Sleep 1
     TabSeite.OK

    '/// Set focus to first picture , Check if the picture is in first page
    Call wTypeKeys ( "<Shift F4>" )
    Call wTypeKeys "<Tab>"

     Kontext "Navigator"
     if Not Navigator.Exists then ViewNavigator
     Kontext "NavigatorWriter"
     Sleep 1
     if Seitennummer.GetText <> sPage1 then Warnlog "1st pic isn't in page 2 !"
     fCloseNavigator
     Wait 500

    '/// Set focus to second picture , Check if the picture is in third page
     Call wTypeKeys "<Tab>"

     Kontext "Navigator"
     if Not Navigator.Exists then ViewNavigator
     Kontext "NavigatorWriter"
     Sleep 1
     if Seitennummer.GetText <> sPage2 then Warnlog "#i40333# 2nd pic isn't in page 4 !"
     fCloseNavigator
     Wait 500

    printlog "  Close active document "
    Do Until GetDocumentCount = 0
        Call hCloseDocument
    Loop
endcase

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

testcase tFormatPage_15
    Dim sType as String
    Dim sFormat as String

    Select case iSprache
        case 01:    sType   = "Page"
                    sFormat = "As Page Style"
        case 03:    sType   = "Página"
                    sFormat = "Como estilo de página"
        case 31:    sType = "Pagina"
                    sFormat = "Zoals paginaopmaakprofiel"
        case 33   : sType   = "Page"
                    sFormat = "D'après le style de page"
        case 34   : sType   = "Página"
                    sFormat = "Como estilo de página"
        case 39   : sType   = "Pagina"
                    sFormat = "Come modello di pagina"
        case 46:    sType   = "Sida"
                    sFormat = "Som sidformatmall"
        case 49:    sType   = "Seite"
                    sFormat = "Wie Seitenvorlage"
        case 55   : sType   = "Estatísticas"
                    sFormat = "Como Estilo de Página"
        case 81   : sType   = "ページ"
                    sFormat = "ページスタイル�?�設定"
        case 82   : sType   = "통계"
                    sFormat = "페�?�지 스타�?� 설정"
        case 86   : sType   = "页"
                    sFormat = "和页�?�样�?相�?�"
        case 88   : sType   = "�?"
                    sFormat = "和�?�?�樣�?相�?�"
        case else : QAErrorLog "The test does not support the language " + iSprache
        Goto endsub
    end select
    
    PrintLog "- Insertfields / other / Document / Type/Page -> As page Style must be set."
    '/// Insertfield / other / Document / Type/Page -> As page Style must be set.
    
    Call hNewDocument
    
    '/// InsertFields / other , tabpage document , select page ,
    '/// + check if Page format is right
    Call fInsertFieldsOther("TabDokumentFeldbefehle")
    Feldtyp.Select sType
    Sleep 3
    if Formatliste.GetSelText <> sFormat then
        warnlog "the format setting should be " & sFormat & " but get " &Formatliste.GetSelText
    end if
    TabDokumentFeldbefehle.Close

    Call hCloseDocument
endcase