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
|
'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 : oliver.craemer@oracle.com
'*
'* short description : spreadsheet printrange test
'*
'*************************************************************************
'*
' #1 tDefinePrintRange
' #1 tAddPrintRange
' #1 tRemovePrintRangeByContext
' #1 tRemovePrintRangeByMenu
' #1 tNamedRangeToPrintRange
' #1 tEntireSheet
' #1 tPrintRangeMouseSelection
' #1 tEmptyRangeMessagebox
'*
'\************************************************************************
'TODO: three test cases to go
sub c_printrange
Printlog Chr(13) + "--------- printrange ---------"
call tDefinePrintRange
call tAddPrintRange
call tRemovePrintRangeByContext
call tRemovePrintRangeByMenu
call tNamedRangeToPrintRange
call tEntireSheet
call tPrintRangeMouseSelection
call tEmptyRangeMessagebox
End sub
'
'---------------------------------------------------------------------------
testcase tDefinePrintRange
dim sRangeFile as string
dim sLocalFile as string
sRangeFile = convertpath ( gTesttoolpath & "spreadsheet/optional/input/printrange.sxc" )
sLocalFile = convertpath ( gOfficepath & "user/work/defineprintrange." & sDefaultExtension )
printlog " Load testdocument and save locally with current filter"
call hFileOpen ( sRangeFile )
if not hFileSaveAsWithFilterKill( sLocalFile , sDefaultCalcFilter ) then
warnlog "Saving test document localy failed -> Aborting"
call hCloseDocument
goto endsub
end if
printlog " Select area B2:E5"
call fCalcSelectRange("B2:E5")
printlog " Define print range by menu Format-Print Ranges-Define"
FormatPrintRangesDefine
printlog " Activate Page Preview (File-Page Preview)"
FilePageView
sleep(2)
printlog " Check if there is only one page as output"
Kontext "Previewbar"
'now all navigation buttons should be deactivated
'if this is true there's only one page to print
'that's what we check now
printlog "Check if all navigation buttons do not work"
printlog "True -> Only one page to print (expected result)"
printlog "False -> BUG"
Kontext "Previewbar"
try
OL_SEITENANSICHT_NaechsteSeiteCalc
warnlog "+ There seems to be more than one page -> BUG!?"
catch
printlog " + OK, 'next page' button does not work"
endcatch
Kontext "Previewbar"
try
OL_SEITENANSICHT_VorherigeSeiteCalc
warnlog "+ There seems to be more than one page -> BUG!?"
catch
printlog " + OK, 'previous page' button does not work"
endcatch
Kontext "Previewbar"
try
OL_SEITENANSICHT_ErsteSeiteCalc
warnlog "+ There seems to be more than one page -> BUG!?"
catch
printlog " + OK, 'first page' button does not work"
endcatch
Kontext "Previewbar"
try
OL_SEITENANSICHT_LetzteSeiteCalc
warnlog "+ There seems to be more than one page -> BUG!?"
catch
printlog " + OK, 'last page' button does not work"
endcatch
printlog " Close page preview"
FilePageView
printlog " Enable View-Page Break Preview"
ViewPageBreakPreview
printlog " Select area A1:C10"
call fCalcSelectRange("A1:C10")
printlog " Call context Define Print Range"
Kontext "DocumentCalc"
DocumentCalc.MouseMove(5,5)
sleep(2)
DocumentCalc.OpenContextMenu
sleep(2)
'Because of the SunSearchToolbar, which is not available on OOo by default the count of
'entries in the context could vary, therefor the desired entry must be searched.
if hMenuFindSelect(26602, true, 3) = false then
Warnlog "Context-Menu-entry `Define Print Range` was not found. Therefore the test ends."
Call hCloseDocument
Goto Endsub
end if
printlog "+ 'Define Print Range' was selected in context menu"
printlog " Activate Page Preview (File-Page Preview)"
FilePageView
sleep(2)
'///+ Check if there is only one page as output</li>
Kontext "Previewbar"
'now all navigation buttons should be deactivated
'if this is true there's only one page to print
'that's what we check now
printlog "Check if all navigation buttons do not work"
printlog "True -> Only one page to print (expected result)"
printlog "False -> BUG"
Kontext "Previewbar"
try
OL_SEITENANSICHT_NaechsteSeiteCalc
warnlog "+ There seems to be more than one page -> BUG!?"
catch
printlog " + OK, 'next page' button does not work"
endcatch
Kontext "Previewbar"
try
OL_SEITENANSICHT_VorherigeSeiteCalc
warnlog "+ There seems to be more than one page -> BUG!?"
catch
printlog " + OK, 'previous page' button does not work"
endcatch
Kontext "Previewbar"
try
OL_SEITENANSICHT_ErsteSeiteCalc
warnlog "+ There seems to be more than one page -> BUG!?"
catch
printlog " + OK, 'first page' button does not work"
endcatch
Kontext "Previewbar"
try
OL_SEITENANSICHT_LetzteSeiteCalc
warnlog "+ There seems to be more than one page -> BUG!?"
catch
printlog " + OK, 'last page' button does not work"
endcatch
printlog " Close page preview"
FilePageView
printlog " At last check if the expected print range is selected"
FormatPrintRangesEdit
Kontext "DruckbereicheBearbeiten"
if DruckBereich.GetText = "$A$1:$C$10" then
printlog " Print range selection as expected"
else
warnlog "Expected print range is <$A$1:$C$10>, but we got: " & DruckBereich.GetText
end if
DruckbereicheBearbeiten.Cancel
sleep(2)
call hCloseDocument
endcase
'
'---------------------------------------------------------------------------
'
testcase tAddPrintRange
dim sRangeFile as string
dim sLocalFile as string
sRangeFile = convertpath ( gTesttoolpath & "spreadsheet/optional/input/printrange.sxc" )
sLocalFile = convertpath ( gOfficepath & "user/work/addprintrange" & sDefaultExtension )
printlog " Load testdocument printrange.sxc and save locally with current filter"
call hFileOpen ( sRangeFile )
if ( not hFileSaveAsWithFilterKill( sLocalFile , sDefaultCalcFilter ) ) then
warnlog "Saving test document localy failed -> Aborting"
call hCloseDocument
goto endsub
end if
printlog " Select area H11:J15"
ViewPageBreakPreview
call fCalcSelectRange("H11:J15")
printlog " Define print range by menu Format-Print Ranges-Define"
FormatPrintRangesDefine
printlog " Select area E41:H55"
call fCalcSelectRange("E41:H55")
printlog " Add print range by menu Format-Print Ranges-Add"
FormatPrintRangesAdd
printlog " Select area A1:F15"
call fCalcSelectRange("A1:F20")
printlog " Call context Add Print Range"
Kontext "DocumentCalc"
DocumentCalc.MouseMove(5,5)
sleep(2)
DocumentCalc.OpenContextMenu
sleep(2)
'Because of the SunSearchToolbar, which is not available on OOo by default the count of
'entries in the context could vary, therefor the desired entry must be searched.
if hMenuFindSelect(26651, true, 3) = false then
Warnlog "Context-Menu-entry `Add Print Range` was not found. Therefore the test ends."
Call hCloseDocument
Goto Endsub
end if
printlog "+ <Add Print Range> was selected in context menu"
sleep(2)
printlog " Save and Reload"
FileSave
sleep(5)
FileReload
sleep(10)
printlog " Check if the expected print range is selected"
FormatPrintRangesEdit
Kontext "DruckbereicheBearbeiten"
if DruckBereich.GetText = "$H$11:$J$15;$E$41:$H$55;$A$1:$F$20" then
printlog "Print range selection as expected"
else
warnlog "Expected print range is <$H$11:$J$15;$E$41:$H$55;$A$1:$F$20>, but we got: " & DruckBereich.GetText
end if
DruckbereicheBearbeiten.Cancel
sleep(1)
printlog " Check if the expected number of pages will be print"
FilePrint
kontext "Active"
if Active.exists( 2 ) then
Active.ok
end if
Kontext "Printing"
Kontext "TabPrintGeneral"
PrintPages.check
if PageRange.GetText = "1-3" then
printlog "+ Pages to print as expected"
else
warnlog "Expected pages to print are <1-3>, but we got: " & PageRange.GetText
end if
Kontext "Printing"
Printing.Cancel
sleep(2)
call hCloseDocument
endcase
'
'---------------------------------------------------------------------------
'
testcase tRemovePrintRangeByContext
dim sRangeFile as string
dim sLocalFile as string
sRangeFile = convertpath ( gTesttoolpath & "spreadsheet/optional/input/printranges_3defined.ods" )
sLocalFile = convertpath ( gOfficepath & "user/work/removeprintrange." & sDefaultExtension )
printlog " Open test document '.../spreadsheet/optional/input/printranges_3defined.ods'"
call hFileOpen ( sRangeFile )
printlog " Save file locally '.../user/work/removeprintrange.ods'"
if ( not hFileSaveAsWithFilterKill( sLocalFile , sDefaultCalcFilter ) ) then
warnlog "Saving test document localy failed -> Aborting"
call hCloseDocument
goto endsub
end if
printlog " Invoke Format::Print Ranges::Edit"
FormatPrintRangesEdit
Kontext "DruckbereicheBearbeiten"
printlog " Check if print range is '$H$11:$J$15;$E$41:$H$55;$A$1:$F$20'"
if DruckBereich.GetText = "$H$11:$J$15;$E$41:$H$55;$A$1:$F$20" then
printlog "+ Print range selection as expected"
else
warnlog "Expected print range is <$H$11:$J$15;$E$41:$H$55;$A$1:$F$20>, but we got: " & DruckBereich.GetText
end if
printlog " Cancel print range dialog"
DruckbereicheBearbeiten.Cancel
Kontext "DocumentCalc"
printlog " Click in right buttom corner"
call gMouseClick ( 95, 95 )
sleep(2)
printlog " Open context menu"
DocumentCalc.OpenContextMenu
sleep(2)
printlog " Select 'Undo Print Range' in context menu"
'Because of the SunSearchToolbar, which is not available on OOo by default the count of
'entries in the context could vary, therefor the desired entry must be searched.
if hMenuFindSelect(26603, true, 3) = false then
warnlog "Context-Menu-entry `Undo Print Range` was not found. Therefore the test ends."
call hCloseDocument
goto endsub
end if
printlog "+ <Undo Print Range> was selected in context menu"
printlog " Invoke Format::Print Ranges::Edit"
FormatPrintRangesEdit
Kontext "DruckbereicheBearbeiten"
printlog " Check if no print range is defined"
if DruckBereich.GetText = "" then
printlog "+ No print range selected as expected"
else
warnlog "Expected print range is <EMPTY>, but we got: " & DruckBereich.GetText
end if
DruckbereicheBearbeiten.Cancel
sleep(2)
printlog " Close document"
call hCloseDocument
endcase
'
'---------------------------------------------------------------------------
'
testcase tRemovePrintRangeByMenu
dim sRangeFile as string
dim sLocalFile as string
sRangeFile = convertpath ( gTesttoolpath & "spreadsheet/optional/input/printranges_3defined.ods" )
sLocalFile = convertpath ( gOfficepath & "user/work/removeprintrange." & sDefaultExtension )
printlog " Open test document '.../spreadsheet/optional/input/printranges_3defined.ods'"
call hFileOpen ( sRangeFile )
printlog " Save file locally '.../user/work/removeprintrange.ods'"
if ( not hFileSaveAsWithFilterKill( sLocalFile , sDefaultCalcFilter ) ) then
warnlog "Saving test document localy failed -> Aborting"
call hCloseDocument
goto endsub
end if
printlog "Invoke Format::Print Ranges::Edit"
FormatPrintRangesEdit
Kontext "DruckbereicheBearbeiten"
printlog " Check if print range is '$H$11:$J$15;$E$41:$H$55;$A$1:$F$20'"
if DruckBereich.GetText = "$H$11:$J$15;$E$41:$H$55;$A$1:$F$20" then
printlog "+ Print range selection as expected"
else
warnlog "Expected print range is <$H$11:$J$15;$E$41:$H$55;$A$1:$F$20>, but we got: " & DruckBereich.GetText
end if
printlog "Cancel print range dialog"
DruckbereicheBearbeiten.Cancel
Kontext "DocumentCalc"
printlog " Invoke Format::Print Ranges::Remove"
FormatPrintRangesRemove
printlog " Invoke Format::Print Ranges::Edit"
FormatPrintRangesEdit
printlog " Check if no print range is defined"
Kontext "DruckbereicheBearbeiten"
if DruckBereich.GetText = "" then
printlog "+ No print range selected as expected"
else
warnlog "Expected print range is <EMPTY>, but we got: " & DruckBereich.GetText
end if
printlog " Cancel print range dialog"
DruckbereicheBearbeiten.Cancel
printlog " Undo removal"
EditUndo
printlog " Invoke Format::Print Ranges::Edit"
FormatPrintRangesEdit
Kontext "DruckbereicheBearbeiten"
printlog " Check if print range is '$H$11:$J$15;$E$41:$H$55;$A$1:$F$20'"
if DruckBereich.GetText = "$H$11:$J$15;$E$41:$H$55;$A$1:$F$20" then
printlog "+ Print range selection as expected"
else
warnlog "Expected print range is <$H$11:$J$15;$E$41:$H$55;$A$1:$F$20>, but we got: " & DruckBereich.GetText
end if
printlog " Cancel print range dialog"
DruckbereicheBearbeiten.Cancel
printlog " Redo removal"
EditRedo
printlog " Invoke Format::Print Ranges::Edit"
FormatPrintRangesEdit
Kontext "DruckbereicheBearbeiten"
printlog " Check if no print range is defined"
if DruckBereich.GetText = "" then
printlog "+ No print range selected as expected"
else
warnlog "Expected print range is <EMPTY>, but we got: " & DruckBereich.GetText
end if
printlog " Cancel print range dialog"
DruckbereicheBearbeiten.Cancel
printlog " Undo removal"
EditUndo
printlog " File::Save"
FileSave
sleep(2)
printlog " Close document"
call hCloseDocument
printlog " Re-open document"
call hFileOpen ( sLocalFile )
printlog " Invoke Format::Print Ranges::Edit"
FormatPrintRangesEdit
Kontext "DruckbereicheBearbeiten"
printlog " Check if print range is '$H$11:$J$15;$E$41:$H$55;$A$1:$F$20'"
if DruckBereich.GetText = "$H$11:$J$15;$E$41:$H$55;$A$1:$F$20" then
printlog "+ Print range selection as expected"
else
warnlog "Expected print range is <$H$11:$J$15;$E$41:$H$55;$A$1:$F$20>, but we got: " & DruckBereich.GetText
end if
DruckbereicheBearbeiten.Cancel
printlog " Cancel print range dialog"
sleep(2)
printlog " Close document"
call hCloseDocument
endcase
'
'---------------------------------------------------------------------------
'
testcase tNamedRangeToPrintRange
dim sLocalFile as STRING
sLocalFile = convertpath ( gOfficepath & "user/work/namedRange." & sDefaultExtension )
dim sAnotherFile as STRING
sAnotherFile = convertpath ( gOfficepath & "user/work/namedRange1." & sDefaultExtension )
dim sLocalFileXLS as STRING
sLocalFileXLS = convertpath ( gOfficepath & "user/work/namedRange.xls" )
dim sFormatXLS as STRING
sFormatXLS = "MS Excel 97"
dim sRangeToSelect as STRING
sRangeToSelect = "$B$3:$D$5"
dim sRangeName as STRING
sRangeName = "NamedRange"
dim sNewRangeToSelect as STRING
sNewRangeToSelect = "$C$4:$E$6"
printlog "Use named range as print range"
printlog " Open new document"
call hNewDocument
printlog " Select range '$B$3:$D$5'"
fCalcSelectRange ( sRangeToSelect )
printlog " Name this range 'NamedRange'"
fCalcNameRange ( sRangeName )
printlog " Invoke Insert::Names::Define"
InsertNamesDefine
sleep 1
Kontext "NamenFestlegen"
printlog " Select previously defined range"
BereichsName.typekeys "N"
sleep 1
printlog " Click 'More' button"
Zusaetze.Click
printlog " Check 'Print range'"
Druckbereich.Check
printlog " Click OK"
NamenFestlegen.OK
printlog " Invoke Format::Print Ranges::Edit"
FormatPrintRangesEdit
Kontext "DruckbereicheBearbeiten"
printlog " Select 'NamedRange' as print range"
DruckbereichListe.select ( sRangeName )
printlog " Check if this is item no.5"
if NOT DruckbereichListe.getSelIndex = 5 then
warnlog "Unexpected selection for 'print range' listbox"
end if
printlog " Check if the according string is '$B$3:$D$5'"
if Druckbereich.getText <> sRangeToSelect then
warnlog "Unexpected string in 'print range' textbox"
end if
printlog " Click OK"
DruckbereicheBearbeiten.OK
printlog " Save file locally '.../user/work/namedRange.ods'"
if ( not hFileSaveAsWithFilterKill( sLocalFile , sDefaultCalcFilter ) ) then
warnlog "Saving test document localy failed -> Aborting"
call hCloseDocument
goto endsub
end if
printlog " Close document"
call hCloseDocument
printlog " Open document"
call hFileOpen ( sLocalFile )
printlog " Invoke Format::Print Ranges::Edit"
FormatPrintRangesEdit
Kontext "DruckbereicheBearbeiten"
printlog " Check if item no.5 is selected as print range"
if DruckbereichListe.getSelIndex <> 5 then
warnlog "Unexpected selection for 'print range' listbox"
end if
printlog " Check if 'NamedRange' is selected as print range"
if DruckbereichListe.getSelText <> sRangeName then
warnlog "Unexpected selection for 'print range' listbox"
end if
printlog " Check if the according string is '$B$3:$D$5'"
if Druckbereich.getText <> sRangeToSelect then
warnlog "Unexpected string in 'print range' textbox"
end if
printlog " Cancel print range dialog"
DruckbereicheBearbeiten.Cancel
printlog " Save filein Excel97/2000/XP format '.../user/work/namedRange.xls'"
if NOT hFileSaveAsWithFilterKill ( sLocalFileXLS , sFormatXLS ) then
warnlog "Saving test document localy failed -> Aborting"
call hCloseDocument
goto endsub
end if
printlog " Close document"
call hCloseDocument
printlog " Open document"
call hFileOpen ( sLocalFileXLS )
printlog " Invoke Format::Print Ranges::Edit"
FormatPrintRangesEdit
Kontext "DruckbereicheBearbeiten"
printlog " Check if item no.5 is selected as print range"
if DruckbereichListe.getSelIndex <> 5 then
warnlog "Unexpected selection for 'print range' listbox"
end if
printlog " Check if the according string is '$B$3:$D$5'"
if Druckbereich.getText <> sRangeToSelect then
warnlog "Unexpected string in 'print range' textbox"
end if
printlog " Cancel print range dialog"
DruckbereicheBearbeiten.Cancel
printlog " Invoke Insert::Names::Define"
InsertNamesDefine
sleep 1
Kontext "NamenFestlegen"
printlog " Select entry 'NamedRange'"
BereichsName.typekeys "N"
sleep 1
printlog " Assign new range, '$C$4:$E$6'"
ZugeordnetZu.SetText ( sNewRangeToSelect )
printlog " Click 'More'"
Zusaetze.Click
printlog " Check 'Print range'"
Druckbereich.Check
printlog " Click OK"
NamenFestlegen.OK
printlog " Invoke Format::Print Ranges::Edit"
FormatPrintRangesEdit
Kontext "DruckbereicheBearbeiten"
printlog " Select 'NamedRange' as print range"
DruckbereichListe.select ( sRangeName )
printlog " Check if this is item no.6"
if NOT DruckbereichListe.getSelIndex = 6 then
warnlog "Unexpected selection for 'print range' listbox"
end if
printlog " Check if the according string is '$C$4:$E$6'"
if Druckbereich.getText <> sNewRangeToSelect then
warnlog "Unexpected string in 'print range' textbox"
end if
printlog " Click OK"
DruckbereicheBearbeiten.OK
printlog " Save file locally '.../user/work/namedRange1.ods'"
if NOT hFileSaveAsWithFilterKill ( sAnotherFile , sDefaultCalcFilter ) then
warnlog "Saving test document localy failed -> Aborting"
call hCloseDocument
goto endsub
end if
printlog " Close document"
call hCloseDocument
printlog " Open document again"
call hFileOpen ( sAnotherFile )
printlog " Invoke Format::Print Ranges::Edit"
FormatPrintRangesEdit
Kontext "DruckbereicheBearbeiten"
printlog " Check if item no.6 is selected as print range"
if DruckbereichListe.getSelIndex <> 6 then
warnlog "Unexpected selection for 'print range' listbox"
end if
printlog " Check if 'NamedRange' is selected as print range"
if DruckbereichListe.getSelText <> sRangeName then
warnlog "Unexpected selection for 'print range' listbox"
end if
printlog " Check if the according string is '$C$4:$E$6'"
if Druckbereich.getText <> sNewRangeToSelect then
warnlog "Unexpected string in 'print range' textbox"
end if
printlog " Cancel print range dialog"
DruckbereicheBearbeiten.Cancel
printlog " Close document"
call hCloseDocument
endcase
'
'---------------------------------------------------------------------------
'
testcase tEntireSheet
dim sRangeFile as STRING
sRangeFile = convertpath ( gTesttoolpath & "spreadsheet/optional/input/printrange.xls" )
dim sLocalFile as STRING
sLocalFile = convertpath ( gOfficepath & "user/work/entireSheet." & sDefaultExtension )
dim sLocalFileXLS as STRING
sLocalFileXLS = convertpath ( gOfficepath & "user/work/entireSheet.xls" )
dim sFormatXLS as STRING
sFormatXLS = "MS Excel 97"
printlog " Open test document '.../spreadsheet/optional/input/printrange.xls'"
call hFileOpen ( sRangeFile )
printlog " Save file locally '.../user/work/entireSheet.ods'"
if NOT hFileSaveAsWithFilterKill ( sLocalFile , sDefaultCalcFilter ) then
warnlog "Saving test document localy failed -> Aborting"
call hCloseDocument
goto endsub
end if
printlog " Select second sheet"
if NOT fCalcSelectSheet ( 2 ) then
warnlog "Selecting sheet no. 2 failed -> Aborting"
call hCloseDocument
goto endsub
end if
printlog " Invoke Format::Print Ranges::Edit"
FormatPrintRangesEdit
Kontext "DruckbereicheBearbeiten"
printlog " Check if item no.2 (should be 'entire sheet') is selected in print range listbox"
if DruckbereichListe.getSelIndex = 2 then
printlog "+ OK, print range is '- entire sheet -'"
else
warnlog "Unexpected print range defined -> Check this out!"
end if
printlog " Cancel print range dialog"
DruckbereicheBearbeiten.Cancel
printlog " Close document"
call hCloseDocument
printlog " Open document"
call hFileOpen ( sLocalFile )
printlog " Select second sheet"
if NOT fCalcSelectSheet ( 2 ) then
warnlog "Selecting sheet no. 2 failed -> Aborting"
call hCloseDocument
goto endsub
end if
printlog " Invoke Format::Print Ranges::Edit"
FormatPrintRangesEdit
Kontext "DruckbereicheBearbeiten"
printlog " Check if item no.2 (should be 'entire sheet') is selected in print range listbox"
if DruckbereichListe.getSelIndex = 2 then
printlog "+ OK, print range is '- entire sheet -'"
else
warnlog "Unexpected print range defined -> Check this out!"
end if
printlog " Cancel print range dialog"
DruckbereicheBearbeiten.Cancel
printlog " Save filein Excel97/2000/XP format '.../user/work/entireSheet.xls'"
if NOT hFileSaveAsWithFilterKill ( sLocalFileXLS , sFormatXLS ) then
warnlog "Saving test document localy failed -> Aborting"
call hCloseDocument
goto endsub
end if
printlog " Close document"
call hCloseDocument
printlog " Open document again"
call hFileOpen ( sLocalFileXLS )
printlog " Select second sheet"
if NOT fCalcSelectSheet ( 2 ) then
warnlog "Selecting sheet no. 2 failed -> Aborting"
call hCloseDocument
goto endsub
end if
printlog " Invoke Format::Print Ranges::Edit"
FormatPrintRangesEdit
Kontext "DruckbereicheBearbeiten"
printlog " Check if item no.2 (should be 'entire sheet') is selected in print range listbox"
if DruckbereichListe.getSelIndex = 2 then
printlog "+ OK, print range is '- entire sheet -'"
else
warnlog "Unexpected print range defined -> Check this out!"
end if
printlog " Cancel print range dialog"
DruckbereicheBearbeiten.Cancel
printlog " Close document"
call hCloseDocument
endcase
'
'---------------------------------------------------------------------------
'
testcase tPrintRangeMouseSelection
dim sLocalFile as STRING
sLocalFile = convertpath ( gOfficepath & "user/work/mouseSelection." & sDefaultExtension )
dim sSelectedRange as STRING
dim sSelectedRows as STRING
dim sSelectedColumns as STRING
printlog " Open new document"
call hNewDocument
printlog " Invoke Format::Print Ranges::Edit"
FormatPrintRangesEdit
printlog " Check if all settings are in initial state"
Kontext "DruckbereicheBearbeiten"
if NOT DruckbereichListe.getSelIndex = 1 then
warnlog "Unexpected selection for 'print range' listbox"
end if
if NOT WiederholungszeileListe.getSelIndex = 1 then
warnlog "Unexpected selection for 'rows to repeat' listbox"
end if
if NOT WiederholungsspalteListe.getSelIndex = 1 then
warnlog "Unexpected selection for 'columns to repeat' listbox"
end if
if Druckbereich.getText <> "" then
warnlog "Unexpected string in 'print range' textbox"
end if
if Wiederholungszeile.getText <> "" then
warnlog "Unexpected string in 'rows to repeat' textbox"
end if
if Wiederholungsspalte.getText <> "" then
warnlog "Unexpected string in 'columns to repeat' textbox"
end if
sleep(1)
printlog " Click print range button to shrink dialog"
DruckbereichButton.typekeys "<RETURN>"
sleep(1)
Kontext "DocumentCalc"
printlog " Select print range using mouse"
DocumentCalc.MouseDown ( 20 , 20 )
DocumentCalc.MouseMove ( 60 , 60 )
DocumentCalc.MouseUp ( 60 , 60 )
sleep(1)
Kontext "DruckbereicheBearbeiten"
printlog " Click print range button to unshrink dialog again"
DruckbereichButton.typekeys "<RETURN>"
printlog " Rember to selection for later comparisson"
sleep(1)
sSelectedRange = Druckbereich.getText
printlog " Click 'rows to repeat' button to shrink dialog"
WiederholungszeileButton.typekeys "<RETURN>"
sleep(1)
Kontext "DocumentCalc"
printlog " Select 'rows to repeat' using mouse"
DocumentCalc.MouseDown ( 10 , 10 )
DocumentCalc.MouseMove ( 15 , 30 )
DocumentCalc.MouseUp ( 15 , 30 )
sleep(1)
Kontext "DruckbereicheBearbeiten"
printlog " Click 'rows to repeat' button to unshrink dialog again"
WiederholungszeileButton.typekeys "<RETURN>"
sleep(1)
printlog " Remember to selection for later comparisson"
sSelectedRows = Wiederholungszeile.getText
printlog " Click 'columns to repeat' button to shrink dialog"
WiederholungsspalteButton.typekeys "<RETURN>"
sleep(1)
Kontext "DocumentCalc"
printlog " Select 'columns to repeat' using mouse"
DocumentCalc.MouseDown ( 10 , 10 )
DocumentCalc.MouseMove ( 50 , 15 )
DocumentCalc.MouseUp ( 50 , 15 )
sleep(1)
Kontext "DruckbereicheBearbeiten"
printlog " Click 'columns to repeat' button to unshrink dialog again"
WiederholungsspalteButton.typekeys "<RETURN>"
sleep(1)
printlog " Rember to selection for later comparisson"
sSelectedColumns = Wiederholungsspalte.getText
sleep(1)
printlog " Click OK"
DruckbereicheBearbeiten.OK
sleep(1)
printlog " Save file locally '.../user/work/mouseSelection.ods'"
if not hFileSaveAsWithFilterKill( sLocalFile , sDefaultCalcFilter ) then
warnlog "Saving test document localy failed -> Aborting"
call hCloseDocument
goto endsub
end if
sleep(2)
printlog " Close document"
call hCloseDocument
printlog " Open document again"
call hFileOpen ( sLocalFile )
printlog " Invoke Format::Print Ranges::Edit"
FormatPrintRangesEdit
Kontext "DruckbereicheBearbeiten"
printlog " Check persistance of all settings"
if NOT DruckbereichListe.getSelIndex = 3 then
warnlog "Unexpected selection for 'print range' listbox: Item No. " & DruckbereichListe.getSelIndex
end if
if NOT WiederholungszeileListe.getSelIndex = 2 then
warnlog "Unexpected selection for 'rows to repeat' listbox: Item No. " & WiederholungszeileListe.getSelIndex
end if
if NOT WiederholungsspalteListe.getSelIndex = 2 then
warnlog "Unexpected selection for 'columns to repeat' listbox: Item No. " & WiederholungsspalteListe.getSelIndex
end if
if Druckbereich.getText <> sSelectedRange then
warnlog "Unexpected selection in 'print range' textbox"
qaErrorLog "Found: " & Druckbereich.getText
qaErrorLog "Should: " & sSelectedRange
end if
if Wiederholungszeile.getText <> sSelectedRows then
warnlog "Unexpected selection in 'rows to repeat' textbox"
qaErrorLog "Found: " & Wiederholungszeile.getText
qaErrorLog "Should: " & sSelectedRows
end if
if Wiederholungsspalte.getText <> sSelectedColumns then
warnlog "Unexpected selection in 'columns to repeat' textbox"
qaErrorLog "Found: " & Wiederholungsspalte.getText
qaErrorLog "Should: " & sSelectedColumns
end if
printlog " Cancel print range dialog"
DruckbereicheBearbeiten.Cancel
printlog " Close document"
call hCloseDocument
endcase
'
'---------------------------------------------------------------------------
'
testcase tEmptyRangeMessagebox
printlog "If the printrange or sheet is empty there should be a messagebox which says that there is nothing to print"
printlog " Open new document"
call hNewDocument
printlog " Print empty document by pressing standardbar button"
kontext "Standardbar"
Drucken.click
printlog " Check that there is a messagebox"
kontext
if Active.Exists(2) then
if Active.GetRT = 304 then
printlog "+ The messagebox " & Active.GetText & " has appeared"
Active.OK
else
warnlog "Unexpected objekt: " & Active.GetText & " found!"
try
Active.OK
catch
Active.Yes
endcatch
end if
else
warnlog "There is no messagebox (#i106423#)"
kontext "DocumentCalc"
call hCloseDocument
goto endsub
end if
Kontext "Printing"
if Printing.Exists( 2 ) then
Printing.Cancel
end if
sleep 2
printlog " Enter 1 in A1"
Kontext "DocumentCalc"
DocumentCalc.TypeKeys "1 <RETURN>"
printlog " Select cell A5"
if fGotoCell ( "A5" ) <> 0 then
warnlog "Could not select cell I2"
hCloseDocument
goto endsub
end if
printlog " Define print range by menu FORMAT / PRINT RANGES / DEFINE"
kontext "DocumentCalc"
FormatPrintRangesDefine
printlog " Print empty range by pressing standardbar button"
kontext "Standardbar"
Drucken.click
printlog " Check that there is a messagebox"
kontext
if Active.Exists(2) then
if Active.GetRT = 304 then
printlog "+ The messagebox " & Active.GetText & " has appeared"
Active.OK
else
warnlog "Unexpected objekt: " & Active.GetText & " found!"
try
Active.OK
catch
Active.Yes
endcatch
end if
else
warnlog "There is no messagebox"
kontext "DocumentCalc"
call hCloseDocument
goto endsub
end if
kontext "Printing"
if Printing.Exists( 2 ) then
Printing.Cancel
end if
printlog "Close document"
call hCloseDocument
endcase
|