summaryrefslogtreecommitdiff
path: root/testautomation/graphics/optional/includes/impress/i_slidecopy.inc
blob: 92283b35a36997c386e344a7263d3e884e2dc53f (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
'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 : wolfram.garten@oracle.com
'*
'* short description: includefile for Slidecopy-testing
'*
'\******************************************************************************

testcase tiSlideCopyNewPresentation

    const MENUITEM_RENAME = 27027

    Dim value1 as string
    Dim value2 as string
    Dim value12 as string
    Dim value13 as string

    printlog "This test copies one slide from one presentation to another."
    printlog "Make new presentation"
    Call  hNewDocument
    Call sSelectEmptyLayout
     printlog "Insert three objects: Connector, Door-plate, and Smiley."
     
     printlog "First we Insert a Connector."
     kontext "Toolbar"
     sleep 1
     try
        Verbinder.TearOff
    catch
        warnlog "bug for GH from FHA; .tearoff doesnt tell success"
    endcatch
    kontext "Connectorsbar"
    sleep 2
    Verbinder.click
    sleep 5
    gMouseDown (10,10)
    gMouseMove (10,10,30,30)
    gMouseUp (30,30)
    kontext "Connectorsbar"
    Connectorsbar.Close
    hTypeKeys "<ESCAPE>"
    hTypeKeys "<TAB>", 1
    printlog "We rename the object via the contextmenu."
    sleep (1)
    DocumentImpress.TypeKeys "<SHIFT F10>"
    sleep (2)
    printlog "then Choose rename."
    if hMenuFindSelect( MENUITEM_RENAME, true, 14) = false then
        Warnlog "Context-Menu-entry `Rename` was not found. Therefore the test ends."
        Call hCloseDocument
        Goto Endsub
    endif
    
    kontext "NameDlgObject"
    if ( NameDlgObject.exists( 2 ) ) then
        NameField.SetText "First"
        NameDlgObject.OK
    else
        warnlog( "<NameDlgObject> failed to open" )
    endif

    kontext "DocumentImpress"
    hMouseClick DocumentImpress, 90, 90
    '----------------------------------------------------------------------------1
    printlog "Then we insert the second object: a Door-plate."

    kontext "Toolbar"
    sleep 2
    try
        StarShapes.TearOff
    catch
        warnlog( "<StarShapes.TearOff> failed" )
        goto endsub
    endcatch

    kontext "StarShapes"
    if ( StarShapes.exists( 2 ) ) then
        StarShapesDoorplate.click
    else
        warnlog( "<StarShapesDoorplate> could not be clicked" )
    endif

    sleep (3)
    gMouseDown (40,40)
    gMouseMove (40,40,60,60)
    gMouseUp (60,60)

    kontext "StarShapes"
    hCloseDialog( StarShapes, "close" )

    hTypeKeys "<ESCAPE>"
    hTypeKeys "<TAB>", 2
    printlog "And then we rename the object."
    sleep (1)
    DocumentImpress.TypeKeys "<SHIFT F10>"
    sleep 2
    if hMenuFindSelect( MENUITEM_RENAME, true, 15) = false then
        Warnlog "Context-Menu-entry `Rename` was not found. Therefore the test ends."
        Call hCloseDocument
        Goto Endsub
    endif
    kontext "NameDlgObject"
    if ( NameDlgObject.exists( 2 ) ) then
        NameField.SetText "Second"
        NameDlgObject.OK
    else
        warnlog( "<NameDlgObject> could not be accessed" )
    endif

    kontext "DocumentImpress"
    hMouseClick DocumentImpress, 90, 90
    '----------------------------------------------------------------------------2
    printlog "Then we insert the thrid object: a Smiley."
    kontext "Toolbar"
    sleep 1
    try
        SymbolShapes.TearOff
    catch
        warnlog "bug for GH from FHA; .tearoff doesnt tell success"
    endcatch
    kontext "SymbolShapes"
    sleep 1
    SymbolShapesSmiley.Click
    sleep 2
    gMouseDown (70,70)
    gMouseMove  (70,70,89,89)
    gMouseUp (89,89)
    kontext "SymbolShapes"
    SymbolShapes.Close
    hTypeKeys "<ESCAPE>"
    hTypeKeys "<TAB>", 3
    printlog "We rename the object via the Context-menu."
    DocumentImpress.TypeKeys "<SHIFT F10>"
    sleep (2)
    'Choose rename.
    if hMenuFindSelect( MENUITEM_RENAME, true, 15) = false then
        Warnlog "Context-Menu-entry `Rename` was not found. Therefore the test ends."
        Call hCloseDocument
        Goto Endsub
    endif
    kontext "NameDlgObject"
    NameField.SetText "Third"
    NameDlgObject.OK
    kontext "DocumentImpress"
    hMouseClick DocumentImpress, 90, 90
    '---------------------------------------------------------------------------3
    '/// Copy the slide to the clipboard ///'
    kontext "Slides"
    SlidesControl.TypeKeys "<PAGEUP>"
    sleep (1)
    SlidesControl.TypeKeys "<SHIFT F10>"
    sleep 2
    printlog "We copy the object via the Context-menu."

    if hMenuFindSelect(5711, true, 10) = false then
        Warnlog "Context-Menu-entry `Copy` was not found. Therefore the test ends."
        Call hCloseDocument
        Goto Endsub
    endif
    '/// Close the presentation-window ///'
    Call hCloseDocument
    '/// Open a new presentation ///'
    Call  hNewDocument
    '/// Paste the slide from the clipboard ///'
    kontext "Slides"
    hUseAsyncSlot( "EditPaste" )
    '/// Delete the first slide ///'
    hUseAsyncSlot( "EditDeleteSlide" )
    '/// Check if all three objects exists, and has the right values ///'
    kontext "DocumentImpress"
    hTypeKeys "<ESCAPE>"
    hTypeKeys "<TAB>", 1 'Select the first object.
    'Bring up the kontext-menu for the object
    sleep (1)
    DocumentImpress.TypeKeys "<SHIFT F10>"
    sleep 2
    printlog "We rename the object via the Context-menu."
    if hMenuFindSelect( MENUITEM_RENAME, true, 14) = false then
        Warnlog "Context-Menu-entry `Rename` was not found. Therefore the test ends."
        Call hCloseDocument
        Goto Endsub
    endif
    printlog "Read out what the name is, and checks if it's correct."
    kontext "NameDlgObject"
    value1 = NameField.GetText
    NameDlgObject.OK
    if value1 = "First" then
        printlog "First object was found correctly"
    else
        Warnlog "Wrong object or object-name! The name found was: " + value1
    endif
    kontext "DocumentImpress"
    hMouseClick DocumentImpress, 90, 90
    DocumentImpress.TypeKeys "<TAB TAB>" 'Select the second object.
    'Bring up the kontext-menu for the object
    sleep (1)
    DocumentImpress.TypeKeys "<SHIFT F10>"
    sleep 2
    printlog "We rename the object via the Context-menu."
    if hMenuFindSelect( MENUITEM_RENAME, true, 15) = false then
        Warnlog "Context-Menu-entry `Rename` was not found. Therefore the test ends."
        Call hCloseDocument
        Goto Endsub
    endif
    printlog "Read out what the name is, and check if it's correct."
    sleep 1
    kontext "NameDlgObject"
    value12 = NameField.GetText
    NameDlgObject.OK

    if value12 = "Second" then
        printlog "Second object was found correctly"
    else
        Warnlog "Wrong object or object-name! The name found was: " + value12
    endif

    kontext "DocumentImpress"
    hMouseClick DocumentImpress, 90, 90
    DocumentImpress.TypeKeys "<TAB TAB TAB>" 'Select the third object.
    'Bring up the kontext-menu for the object
    sleep (2)
    DocumentImpress.TypeKeys "<SHIFT F10>"
    sleep 2
    printlog "We rename the object via the Context-menu."
    if hMenuFindSelect( MENUITEM_RENAME, true, 15) = false then
        Warnlog "Context-Menu-entry `Rename` was not found. Therefore the test ends."
        Call hCloseDocument
        Goto Endsub
    endif
    printlog "Read out what the name is, and check if it's correct."
    kontext "NameDlgObject"
    value13 = NameField.GetText
    NameDlgObject.OK

    if value13 = "Third" then
        printlog "Third object was found correctly"
    else
        Warnlog "Wrong object or object-name! The name found was: " + value13
    endif

    '/// Close the bars we opened before. ///'
    kontext "Connectorsbar"
    if Connectorsbar.Exists then Connectorsbar.Close
    kontext "SymbolShapes"
    if SymbolShapes.Exists then SymbolShapes.Close
    kontext "StarShapes"
    if StarShapes.Exists then StarShapes.Close

    '/// Close Presentation. End testcase ///'
    Call hCloseDocument
endcase 'tiSlideCopyNewPresentation

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

testcase tiSlideCopyDuplicate
    Dim value1 as string
    Dim value2 as string
    Dim value12 as string
    Dim value13 as string
    dim i as integer
    printlog "Make new presentation"
     Call  hNewDocument
     Call sSelectEmptyLayout
     printlog "Insert Connector."
     kontext "Toolbar"
     sleep 1
     try
        Verbinder.TearOff  ' insert connector
    catch
        warnlog "bug for GH from FHA; .tearoff doesnt tell success"
    endcatch
    kontext "Connectorsbar"
    sleep 1
    Verbinder.click
    sleep 1
    kontext "DocumentImpress"
    gMouseDown (10,10)
    gMouseMove (10,10,30,30)
    gMouseUp (30,30)

     hTypeKeys "<ESCAPE>"
     hTypeKeys "<TAB>", 1
     sleep (1)
     
     printlog "rename object"
     DocumentImpress.TypeKeys "<SHIFT F10>"
     sleep 1
     
     printlog "Choose rename"
     if hMenuFindSelect(27027, true, 14) = false then
        Warnlog "Context-Menu-entry `Rename` was not found. Therefore the test ends."
        Call hCloseDocument
        Goto Endsub
    endif
    kontext "NameDlgObject"
    NameField.SetText "First"
    NameDlgObject.OK
    sleep 1

    kontext "DocumentImpress"
    hMouseClick DocumentImpress, 90, 90

     printlog "2 Insert Door-plate"
     kontext "Toolbar"
     sleep 1
     try
        StarShapes.TearOff
     catch
        warnlog "bug for GH from FHA; .tearoff doesnt tell success"
    endcatch
    kontext "StarShapes"
    sleep 1
    StarShapesDoorplate.click
    sleep 1
    kontext "DocumentImpress"
    gMouseDown (40,40)
    gMouseMove (40,40,60,60)
    gMouseUp (60,60)

    hTypeKeys "<ESCAPE>"
    hTypeKeys "<TAB>", 2
    sleep (1)

     printlog "Rename object"
     kontext "DocumentImpress"
     DocumentImpress.TypeKeys "<SHIFT F10>"
     sleep (1)
     printlog "Choose rename."
     if hMenuFindSelect(27027, true, 15) = false then
        Warnlog "Context-Menu-entry `Rename` was not found. Therefore the test ends."
        Call hCloseDocument
        Goto Endsub
    endif
    kontext "NameDlgObject"
    NameField.SetText "Second"
    NameDlgObject.OK
    sleep 1

    kontext "DocumentImpress"
    hMouseClick DocumentImpress, 90, 90

     printlog "Insert Smiley."
     kontext "Toolbar"
     sleep 1
     try
        SymbolShapes.TearOff  
     catch
        warnlog "bug for GH from FHA; .tearoff doesnt tell success"
    endcatch
    kontext "SymbolShapes"
    sleep 1
    SymbolShapesSmiley.Click
    sleep 1
    gMouseDown (70,70)
    gMouseMove  (70,70,89,89)
    gMouseUp (89,89)

    hTypeKeys "<ESCAPE>"
    hTypeKeys "<TAB>", 3
    sleep (1)

     printlog "rename object"
     DocumentImpress.TypeKeys "<SHIFT F10>"
     sleep (1)
     printlog "Choose rename"
     if hMenuFindSelect(27027, true, 15) = false then
        Warnlog "Context-Menu-entry `Rename` was not found. Therefore the test ends."
        Call hCloseDocument
        Goto Endsub
    endif
    kontext "NameDlgObject"
    NameField.SetText "Third"
    NameDlgObject.OK
    sleep 1

    kontext "DocumentImpress"
    hMouseClick DocumentImpress, 90, 90

     printlog "Close the bars we opened before."
     kontext "Connectorsbar"
     if Connectorsbar.Exists then Connectorsbar.Close
     kontext "SymbolShapes"
     if SymbolShapes.Exists then SymbolShapes.Close
     kontext "StarShapes"
     if StarShapes.Exists then StarShapes.Close

     printlog "Copy the slide to the clipboard"
     kontext "Slides"
     SlidesControl.TypeKeys "<PAGEUP>"
     sleep (1)
     SlidesControl.TypeKeys "<SHIFT F10>"
     sleep (1)
     printlog "Choose `Copy`"
     if hMenuFindSelect(5711, true, 10) = false then
        Warnlog "Context-Menu-entry `Copy` was not found.Therefore the test ends."
        Call hCloseDocument
        Goto Endsub
    endif

     printlog "Paste the content from the Clipboard"
     kontext "Slides"
     printlog "open context-menu choose 'paste'"

    EditPaste

    kontext "InsertPaste"
    if InsertPaste.Exists(1) then
        After.Check
        InsertPaste.OK
     endif
     sleep (2)
     printlog "Check if we have two slides, and that the objects exists, and has the right values "

    kontext "Slides"
    SlidesControl.TypeKeys "<PAGEUP>"

     for i = 1 to 2   
        Printlog "Checking objects the " + i + " + time."
        kontext "DocumentImpress"
        hMouseClick DocumentImpress, 90, 90
        DocumentImpress.TypeKeys "<TAB>" 
        sleep (1)
        
        DocumentImpress.TypeKeys "<SHIFT F10>"
        sleep 1
        printlog "Choose rename"
	if hMenuFindSelect(27027, true, 14) = false then
           Warnlog "Context-Menu-entry `Rename` was not found. Therefore the test ends."
           Call hCloseDocument
           Goto Endsub
        endif

        printlog "Read out what the name is, and check if its correct."
        kontext "NameDlgObject"  
        value1 = NameField.GetText
        NameDlgObject.OK 

        if value1 = "First" then
            printlog "First object was found correctly"
        else
            Warnlog "Wrong object or object-name! The name found was: " + value1
        endif

        hTypeKeys "<ESCAPE>"
        DocumentImpress.TypeKeys "<TAB>", 2
        sleep (1)
        DocumentImpress.TypeKeys "<SHIFT F10>"

        printlog "Choose rename"
        if hMenuFindSelect(27027, true, 15) = false then
            Warnlog "Context-Menu-entry `Rename` was not found. Therefore the test ends."
            Call hCloseDocument
            Goto Endsub
        endif

        printlog "Read out what the name is, and check if its correct."
        kontext "NameDlgObject"
        value12 = NameField.GetText
        NameDlgObject.OK

        if value12 = "Second" then
            printlog "Second object was found correctly"
        else
            Warnlog "Wrong object or object-name! The name found was: " + value12
        endif

        hTypeKeys "<ESCAPE>"
        printlog "Select the third object."
        hTypeKeys "<TAB>", 3 
        sleep (1)

        printlog "Bring up the kontext-menu for the object"
        DocumentImpress.TypeKeys "<SHIFT F10>"
        sleep 1
        printlog "Choose rename"
        if hMenuFindSelect(27027, true, 15) = false then
            Warnlog "Context-Menu-entry `Rename` was not found. Therefore the test ends."
            Call hCloseDocument
            Goto Endsub
        endif

        printlog "Read out what the name is, and check if its correct."
        kontext "NameDlgObject"
        value13 = NameField.GetText
        NameDlgObject.OK

        if value13 = "Third" then
            printlog "Third object was found correctly"
        else
            Warnlog "Wrong object or object-name! The name found was: " + value13
        endif
        kontext "Slides"
        SlidesControl.TypeKeys "<DOWN>"
    next i

     printlog " Close Presentation. End testcase "
     Call hCloseDocument
endcase 'tiSlidecopyDuplicate

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

testcase tiSlideCopyPasteSpecial
    qaerrorlog "#i93377#: Paste special dialog does not come up with kontext on slide pane"
    goto endsub

    Dim value1 as string
    Dim value2 as string
    Dim value3 as string
    '/// Copies slide, and pastes it with "Paste Special", ///'
    '/// just to see if the office can handle it ///'
    '/// Make new presentation ///'
    Call  hNewDocument
    '/// Insert three objects: Connector, Door-plate, and Smiley ///'

    '1 Insert Connector.
    kontext "Toolbar"
    sleep 1
    try
        Verbinder.TearOff  ' insert connector
    catch
        warnlog "bug for GH from FHA; .tearoff doesnt tell success"
    endcatch
    kontext "Connectorsbar"
    sleep 1
    Verbinder.click
    sleep 1
    gMouseDown (10,10)
    gMouseMove (10,10,30,30)
    gMouseUp (30,30)

    kontext "DocumentImpress"
    hMouseClick DocumentImpress, 90, 90

    '2 Insert Door-plate.
    kontext "Toolbar"
    sleep 1
    try
        StarShapes.TearOff  ' insert connector
    catch
        warnlog "bug for GH from FHA; .tearoff doesnt tell success"
    endcatch
    kontext "StarShapes"
    sleep 1
    StarShapesDoorplate.click
    sleep 1
    gMouseDown (40,40)
    gMouseMove (40,40,60,60)
    gMouseUp (60,60)

    kontext "DocumentImpress"
    hMouseClick DocumentImpress, 90, 90

    '3 Insert Smiley.
    kontext "Toolbar"
    sleep 1
    try
        SymbolShapes.TearOff  ' insert connector
    catch
        warnlog "bug for GH from FHA; .tearoff doesnt tell success"
    endcatch
    kontext "SymbolShapes"
    sleep 1
    SymbolShapesSmiley.Click
    sleep 1
    gMouseDown (70,70)
    gMouseMove  (70,70,89,89)
    gMouseUp (89,89)

    '/// Copy the slide to the clipboard ///'
    kontext "Slides"
    SlidesControl.TypeKeys "<PAGEUP>"
    SlidesControl.TypeKeys "<SHIFT F10>"
    sleep 1
    'Choose `Copy`
    if hMenuFindSelect(5711, true, 10) = false then
        Warnlog "Context-Menu-entry `Copy` was not found. Therefore the test ends."
        Call hCloseDocument
        Goto Endsub
    endif

    '/// Try to paste special. And check that the office still stays alive ///'
    EditPasteSpecial
    kontext "InhaltEinfuegen"
    InhaltEinfuegen.OK

    '/// Close the bars we opened before. ///'
    kontext "Connectorsbar"
    if Connectorsbar.Exists then Connectorsbar.Close
    kontext "SymbolShapes"
    if SymbolShapes.Exists then SymbolShapes.Close
    kontext "StarShapes"
    if StarShapes.Exists then StarShapes.Close

    sleep 1
    kontext "DocumentImpress"
    '/// Close Presentation. End testcase ///'

    Call hCloseDocument
endcase 'tiSlideCopyPasteSpecial

'-----------------------------------------------------------------------
testcase tiSlideCopyInSlideSorter
    qaerrorlog "#i58418#: Pasting in slide sorter sets slide to wrong position"
    goto endsub

    Dim value1 as string
    Dim value2 as string
    Dim value3 as string
    '/// Copies slides within the slidesorter, and makes sure they are pasted on the correct position ///'
    '/// Make new presentation ///'
    Call  hNewDocument
    '/// Insert an object: Connector, on the first slide ///'
    kontext "Toolbar"
    sleep 1
    try
        Verbinder.TearOff
    catch
        warnlog "bug for GH from FHA; .tearoff doesnt tell success"
    endcatch
    kontext "Connectorsbar"
    sleep 1
    Verbinder.click
    Verbinder.click
    Verbinder.click
    sleep 1
    kontext "DocumentImpress"
    gMouseDown (10,10)
    gMouseMove (10,10,30,30)
    gMouseUp (30,30)
    Printlog "   Inserted a Connector-object."
    'Rename object
    hTypeKeys "<ESCAPE>"
    hTypeKeys "<TAB>", 1
    DocumentImpress.TypeKeys "<SHIFT F10>"

    'Rename
    if hMenuFindSelect(27027, true, 14) = false then
        Warnlog "Context-Menu-entry `Rename` was not found. Therefore the test ends."
        Call hCloseDocument
        Goto Endsub
    endif
    kontext "NameDlgObject"
    NameField.SetText "First"
    NameDlgObject.OK
    sleep 1
    Printlog "   Renamed a the object to 'First'"

    sleep 3
    '/// Rename slide to "1" ///'
    kontext "Slides"
    SlidesControl.TypeKeys "<PAGEUP>"
    SlidesControl.TypeKeys "<SHIFT F10>"
    sleep 3
    'Rename
    if hMenuFindSelect(27268, true, 2) = false then
        Warnlog "Context-Menu-entry `Rename` was not found. Therefore the test ends."
        Call hCloseDocument
        Goto Endsub
    endif

    kontext "NameDlgPage"
    NameField.SetText "1"
    NameDlgPage.OK
    sleep 1
    Printlog "   Renamed the Slide to '1'"

    kontext "DocumentImpress"
    hMouseClick DocumentImpress, 90, 90
    sleep 3

    '/// Insert a new slide ///'
    kontext "Slides"
    SlidesControl.TypeKeys "<TAB><PAGEDOWN>"
    SlidesControl.OpenContextMenu
    sleep 3
    'Insert slide
    if hMenuFindSelect(27014, true, 1) = false then
        Warnlog "Context-Menu-entry `Insert slide` was not found. Therefore the test ends."
        Call hCloseDocument
        Goto Endsub
    endif
    Printlog "   Inserted a new slide."
    '/// Insert an object: Door-plate, on the second slide ///'
    kontext "Toolbar"
    sleep 1
    try
        StarShapes.TearOff
    catch
        warnlog "bug for GH from FHA; .tearoff doesnt tell success"
    endcatch
    kontext "StarShapes"
    sleep 1
    StarShapesDoorplate.click
    sleep 1
    kontext "DocumentImpress"
    gMouseDown (40,40)
    gMouseMove (40,40,60,60)
    gMouseUp (60,60)
    Printlog "   Inserted a Door-Plate-object."

    hTypeKeys "<ESCAPE>"
    hTypeKeys "<TAB>", 2
    hTypeKeys "<SHIFT F10>"

    ' Rename
    if hMenuFindSelect(27027, true, 15) = false then
        Warnlog "Context-Menu-entry `Rename` was not found. Therefore the test ends."
        Call hCloseDocument
        Goto Endsub
    endif

    kontext "NameDlgObject"
    NameField.SetText "Second"
    NameDlgObject.OK
    sleep 1
    Printlog "   Renamed a the object to 'Second'"

    kontext "DocumentImpress"
    hMouseClick DocumentImpress, 90, 90
    sleep 2
    '/// Rename slide to "2" ///'
    kontext "Slides"
    SlidesControl.OpenContextMenu
    sleep 3
    ' Rename
    if hMenuFindSelect(27268, true, 3) = false then
        Warnlog "Context-Menu-entry `Rename` was not found. Therefore the test ends."
        Call hCloseDocument
        Goto Endsub
    endif
    kontext "NameDlgPage"
    NameField.SetText "2"
    NameDlgPage.OK
    sleep 1
    Printlog "   Renamed the slide '2'"

    '/// Insert a new slide ///'
    kontext "Slides"
    Slidescontrol.TypeKeys "<PAGEDOWN>", 2
    Slidescontrol.TypeKeys "<SHIFT F10>"
    sleep 3
    'Insert slide
    if hMenuFindSelect(27014, true, 1) = false then
        Warnlog "Context-Menu-entry `Insert slide` was not found. Therefore the test ends."
        Call hCloseDocument
        Goto Endsub
    endif
    Printlog "   Inserted a new slide."

    '/// Insert an object: Smiley, on the second slide ///'
    kontext "Toolbar"
    sleep 1
    try
        SymbolShapes.TearOff
    catch
        warnlog "bug for GH from FHA; .tearoff doesnt tell success"
    endcatch
    kontext "SymbolShapes"
    sleep 1
    SymbolShapesSmiley.Click
    sleep 1
    gMouseDown (70,70)
    gMouseMove  (70,70,89,89)
    gMouseUp (89,89)
    Printlog "   Inserted a Smiley-object."

    'Rename object
    hTypeKeys "<ESCAPE>"
    hTypeKeys "<TAB>", 2
    hTypeKeys "<SHIFT F10>"

    'Choose rename.
    if hMenuFindSelect(27027, true, 15) = false then
        Warnlog "Context-Menu-entry `Rename` was not found. Therefore the test ends."
        Call hCloseDocument
        Goto Endsub
    endif
    kontext "NameDlgObject"
    NameField.SetText "Third"
    NameDlgObject.OK
    Printlog "   Renamed a the object to 'Third'"

    '/// Rename slide to "3" ///'
    kontext "Slides"
    Slidescontrol.TypeKeys "<PAGEDOWN>", 2
    SlidesControl.OpenContextMenu
    sleep 3
    ' Rename
    if hMenuFindSelect(27268, true, 3) = false then
        Warnlog "Context-Menu-entry `Rename` was not found. Therefore the test ends."
        Call hCloseDocument
        Goto Endsub
    endif

    kontext "NameDlgPage"
    NameField.SetText "3"
    NameDlgPage.OK
    sleep 1
    Printlog "   Renamed the slide '3'"

    '/// Close the bars we opened before. ///'
    kontext "Connectorsbar"
    if Connectorsbar.Exists then Connectorsbar.Close
    kontext "SymbolShapes"
    if SymbolShapes.Exists then SymbolShapes.Close
    kontext "StarShapes"
    if StarShapes.Exists then StarShapes.Close

    '/// Change to Slidesorter ///'
    kontext "DocumentImpress"
    ViewSlideSorter

    '/// Now we have changed view to the slidesorter ///'

    kontext "Slides"
    Printlog "   Changed view to 'SlideSorter'"
    '/// Make sure the last slide is selcted ///'
    SlidesControl.TypeKeys "<TAB>"
    SlidesControl.TypeKeys "<PAGEDOWN>", 3

    '/// Cut the last slide ///'
    SlidesControl.TypeKeys "<MOD1 X>"

    '/// Make sure the first slide is selected ///'
    SlidesControl.TypeKeys "<TAB>"
    SlidesControl.TypeKeys "<PAGEUP>", 2
    sleep 1

    '/// Paste the Slide ///'
    kontext "Slides"
    SlidesControl.TypeKeys "<MOD1 V>"

    '/// choose "Before" as specification for where
    Kontext "InsertPaste"
    if InsertPaste.Exists(3) then
        Before.Check
        InsertPaste.OK
        Printlog "   Pasted slide 'Before'"
    else
        warnlog "   Problem when copying/pasting slide."
    endif

    '/// Check where the slide ended up ///'
    kontext "Slides"
    SlidesControl.TypeKeys "<TAB>"
    SlidesControl.TypeKeys "<PAGEUP>", 3 'to get to the first slide
    SlidesControl.TypeKeys "<SHIFT F10>"
    sleep 3
    ' Rename
    if hMenuFindSelect(27268, true, 3) = false then
        Warnlog "Context-Menu-entry `Rename` was not found. Therefore the test ends."
        Call hCloseDocument
        Goto Endsub
    endif

    kontext "NameDlgPage"
    if NameField.GetText <> "3" then
        Warnlog "Wrong slide found! Expected nr 3, but found " + NameField.GetText + "."
    else
        Printlog "   Slide nr 3 was found correctly."
    endif
    NameDlgPage.OK
    sleep 1

    kontext "Slides"
    '/// Choose the slide in the middle (named "1") ///'
    SlidesControl.TypeKeys "<TAB>"
    SlidesControl.TypeKeys "<PAGEDOWN>", 3 'to get to the last slide
    SlidesControl.TypeKeys "<PAGEUP>" 'to go back one step
    SlidesControl.OpenContextMenu (true)
    ' Check the name of that slide (via Rename)
    if hMenuFindSelect(27268, true, 3) = false then
        Warnlog "Context-Menu-entry `Rename` was not found. Therefore the test ends."
        Call hCloseDocument
        Goto Endsub
    endif

    kontext "NameDlgPage"
    if NameField.GetText <> "1" then
        Warnlog "Wrong slide found! Expected nr 1, but found " + NameField.GetText + "."
    else
        Printlog "   Slide nr 1 was found correctly in the middle position."
    endif
    NameDlgPage.OK
    sleep 1
    kontext "Slides"

    '/// Cut the slide ///'
    SlidesControl.TypeKeys "<SHIFT F10>"
    sleep 3
    if hMenuFindSelect(5710, true, 10) = false then
        Warnlog "Context-Menu-entry `Cut` was not found. Therefore the test ends."
        Call hCloseDocument
        Goto Endsub
    endif

    '/// Make sure we have selected the last slide ///'
    SlidesControl.TypeKeys "<TAB>"
    SlidesControl.TypeKeys "<PAGEDOWN>", 2

    '/// Place the mousepointer to the left of the first slide ///'
    sleep 1
    kontext "Slides"
    SlidesControl.MouseMove 2, 3
    SlidesControl.OpenContextMenu true
    sleep 3

    '/// Paste the Slide ///'
    if hMenuFindSelect(5712, true, 12) = false then
        Warnlog "Context-Menu-entry `Paste` were not found. Therefore the test ends."
        Call hCloseDocument
        Goto Endsub
    endif
    sleep 1

    '/// Choose "After" as specification for where ///'
    Kontext "InsertPaste"
    if InsertPaste.Exists(3) then
        After.Check
        InsertPaste.OK
        Printlog "   Pasted slide 'After'"
    else
        warnlog "   Problem when copying/pasting slide."
    endif

    '/// Check where the slide ended up. Should have showed up at the last position ///'
    kontext "Slides"
    SlidesControl.TypeKeys "<TAB>"
    SlidesControl.TypeKeys "<PAGEDOWN>", 3 'to get to the last slide
    SlidesControl.TypeKeys "<SHIFT F10>" '= open context menu
    sleep 3
    ' Rename
    if hMenuFindSelect(27268, true, 3) = false then
        Warnlog "Context-Menu-entry `Rename` was not found. Therefore the test ends."
        Call hCloseDocument
        Goto Endsub
    endif

    kontext "NameDlgPage"
    if NameField.GetText <> "1" then
        Warnlog "Wrong slide found! Expected nr 1, but found " + NameField.GetText + "."
    else
        Printlog "   Slide nr 1 was found correctly."
    endif
    NameDlgPage.OK
    sleep 1

    '/// Close Presentation. End testcase ///'
    Call hCloseDocument
endcase 'tiSlideCopyInSlideSorter

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

'TODO FHA - Check the objects after pasting them.