summaryrefslogtreecommitdiff
path: root/testautomation/graphics/optional/includes/impress/i_pengine2.inc
blob: f10b77f30db387b8f231de9f7ad26f8373795b1e (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
'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@sun.com
'*
'* short description : Tests the Presentation-Engines effects
'*
'*******************************************************************
'*
' #1 tiPengineAnimationEffectsPreview
' #1 tiPengineAnimationEffectsOptions
' #1 tiPengineAllShapesAndEffects
' #1 tiPengine2ObjectsGetsEffects
'*
'\*******************************************************************

testcase tiPengineAnimationEffectsPreview
    dim bError as boolean

    '/// open application ///'
    Call hNewDocument
    '/// create textbox with text ///'
    Call hTextrahmenErstellen ("Test text to test text effects", 35, 35, 70, 70 )
    '/// Slide Show->Custom Animation... ///'
    SlideShowCustomAnimation
        Kontext "Tasks"
        '/// click button 'Add...' ///'
        EffectAdd.click
        '/// Dialog 'Custom Animation' comes up ///'
        kontext
        '/// Switch to TabPage: Entrance ///'
        active.setPage(TabEntrance)
        kontext "TabEntrance"
        if TabEntrance.exists(5) then
           DialogTest(TabEntrance)
           TestAnimations
           '/// Switch to TabPage: Emphasis ///'
           kontext
           active.setPage(TabEmphasis)
           kontext "TabEmphasis"
              if TabEmphasis.exists(5) then
                 DialogTest(TabEmphasis)
                 TestAnimations
              else
                 bError = true
                 warnlog "Impress:Tasks Pane:Custom Animation:TabEmphasis tabPage doesn't work."
              endif
           kontext

           '/// Switch to TabPage: Exit ///'
           active.setPage(TabExit)
           kontext "TabExit"
              if TabExit.exists(5) then
                 DialogTest(TabExit)
                 TestAnimations
              else
                 bError = true
                 warnlog "Impress:Tasks Pane:Custom Animation:TabExit tabPage doesn't work."
              endif
           kontext

           '/// Switch to TabPage: Motion Paths ///'
           active.setPage(TabMotionPaths)
           kontext "TabMotionPaths"
              if TabMotionPaths.exists(5) then
                 DialogTest(TabMotionPaths)
                 TestAnimations
              else
                 bError = true
                 warnlog "Impress:Tasks Pane:Custom Animation:TabMotionPaths tabPage doesn't work."
              endif
           kontext

           '/// Switch to TabPage: Entrance ///'
           active.setPage(TabEntrance)
           kontext "TabEntrance"
           if TabEntrance.exists(5) then
              Effects.Select 4
              '/// Close dialog 'Custom Animation' with 'OK' ///'
              TabEntrance.OK
           else
              warnlog "Error when switching Tab"
           endif
           bError = false
        else
           bError = true
           warnlog "Impress:Tasks Pane:Custom Animation:Add... button didn't work."
        endif
        Kontext "Tasks"
        if (NOT bError) then
            '/// click button 'Change...' ///'
            EffectChange.click
            '/// Dialog 'Custom Animation' comes up ///'
            kontext

            '/// Switch to TabPage: Entrance ///'
            active.setPage(TabEntrance)
            kontext "TabEntrance"
            if (NOT TabEntrance.exists(5)) then
                warnlog "Impress:Tasks Pane:Custom Animation:Change... button didn't work."
            endif
            TabEntrance.Cancel
            Kontext "Tasks"
            EffectStart.GetItemCount
            if EffectProperty.IsVisible then
                EffectProperty.GetItemCount
            endif
            '/// CLick on button '...' (Options) ///'
            EffectOptions.Click
            kontext "TabEffect"
            if TabEffect.Exists(5) then
                dialogTest(TabEffect)
                Sound.GetItemCount
                AfterAnimation.GetItemCount

                '/// switch to TabPage 'Timing' ///'
                Kontext
                Active.SetPage TabTiming
                kontext "TabTiming"
                if TabTiming.Exists(5) then
                    dialogTest(TabTiming)
                    TimingStart.GetItemCount
                    Delay.GetText
                    Speed.GetItemCount
                    Repeat.GetItemCount
                    Rewind.Ischecked
                    TriggerAnimate.IsChecked
                    TriggerStart.IsChecked
                    Shape.GetItemCount
                else
                    warnlog "Impress:Tasks Pane:Custom Animation:Effect Options: Timing TabPage didn't work."
                endif

                '/// switch to TabPage 'Timing' ///'
                Kontext
                active.setPage TabTextAnimation
                kontext "TabTextAnimation"
                if TabTextAnimation.Exists(5) then
                    dialogTest(TabTextAnimation)
                    GroupText.GetItemCount
                    AnimateAttachedShape.IsChecked
                    TabTextAnimation.Cancel
                else
                    warnlog "Impress:Tasks Pane:Custom Animation:Effect Options: TextAnimation TabPage didn't work."
                endif
            else
                warnlog "Impress:Tasks Pane:Custom Animation:... button didn't work."
            endif
            Kontext "Tasks"
            EffectSpeed.GetItemCount
            EffectList.GetItemCount
            EffectPlay.Click
            sleep (3)
            EffectSlideShow.Click
            sleep (1)
            kontext "DocumentPresentation"
            if DocumentPresentation.Exists (15) then
                printlog "Presentation started :-)"
                DocumentPresentation.TypeKeys "<SPACE>"
                if DocumentPresentation.Exists (15) then
                    DocumentPresentation.TypeKeys "<SPACE>"
                endif
                if DocumentPresentation.Exists (15) then
                    DocumentPresentation.TypeKeys "<ESCAPE>"
                endif
            else
                warnlog "Impress:Tasks Pane:Custom Animation:Slide Show button doesn't start slideshow!"
            endif
            sleep (2)
            kontext "Tasks"
            EffectAutomaticPreview.Check
            '/// click button 'Remove' ///'
            EffectRemove.Click
        endif
        sleep (2)
    '/// close application ///'
    Call hCloseDocument
endcase 'tiPengineAnimationEffectsPreview

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

testcase tiPengineAnimationEffectsOptions
    dim bError as boolean
    dim e as integer
    dim d as integer
    dim i as integer
    dim l as integer
    dim o as integer
    dim p as integer
    dim q as integer
    dim s as integer
    dim t as integer
    dim u as integer
    dim y as integer
    dim w as integer
    dim numberx as integer
    dim Effectname1 as string
    dim StartName1 as string
    dim PropertyName1 as string

'/// open application ///'
Call hNewDocument
'/// create textbox with text ///'
Call hTextrahmenErstellen ("Test text to test text effects", 35, 35, 70, 70 )
'/// Slide Show->Custom Animation... ///'
SlideShowCustomAnimation
   '/// Dialog 'Custom Animation' comes up ///'
   Kontext "Tasks"
   '/// Click button 'Add...' to add an effect to the text ///'
   EffectAdd.click
   kontext
   '/// Switch to TabPage: Entrance ///'
   active.setPage(TabEntrance)
   kontext "TabEntrance"
   if TabEntrance.exists(5) then
      AutomaticPreview.UnCheck
      Printlog "Testing effects in - TabEntrance"
      i = Effects.GetItemCount
      p = 7555
      Effects.TypeKeys "<HOME DOWN>"
      Randomize
      '/// Choose ten random effects, and test them. ///'
      For e = 1 to 10
          randomize
          for y = 1 to 1
              randomize
              numberx = Int((i*Rnd))
              if (numberx<1) OR (numberx>i) then      '  Just so we get it between 1 and the amount of items.
                 y = y - 1
              endif
          next y
          printlog numberx                                       ' Log what effect were about to select. Just for debugging.
          Effects.TypeKeys "<HOME>"
          Effects.TypeKeys "<DOWN>", numberx      ' Select the effect.
	  sleep 1
          Printlog "Effect Nr: " + (Effects.GetSelIndex -1) + ". Name: " + Effects.GetSelText     ' Log the number and effect-name.
          Effectname1 = Effects.GetSelText
          if AutomaticPreview.IsChecked = TRUE then sleep 1      '  Sleep one sec to at least let the preview start.
          d = Effects.GetSelIndex
          TabEntrance.Ok
          optionstest2                           ' Do the optionstest for this effect.
          Kontext "Tasks"
             if Tasks.Exists then
                EffectChange.Click
             else
                Warnlog "Something wrong when exiting Impress:Tasks Pane:Custom Animation: ... (options)"
             endif
             kontext "TabEntrance"
             '/// Select the next entry ///'
	     Effects.TypeKeys "<DOWN>", e
             p = Effects.GetSelIndex
             If p = d Then e = i
             sleep 2
             if Speed.isVisible then
                if Speed.isEnabled then
                   s = Speed.GetItemCount
                   For q = 1 to s
                       try
                          Speed.Select q
                       catch
                          warnlog "The speed nr: " + q + " had some kind of problem. Check it."
                       endcatch
                   Next q
                endif
             else
                Warnlog "Speed in Effect Options were not to be found."
             endif
      Next e
      kontext "TabEntrance"
      Printlog "Test of Entrance-list ended."
      AutomaticPreview.Check
      TabEntrance.Ok
   else
      bError = true
      warnlog "Impress:Tasks Pane:Custom Animation:Add... button didnt work."
   endif
   kontext "Tasks"
   EffectAutomaticPreview.Check
   '/// click button 'Remove' ///'
   EffectRemove.Click
   '/// close application ///'
   Call hCloseDocument
endcase 'tiPengineAnimationEffectsOptions

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

testcase tiPengineAllShapesAndEffects
   dim sFileName as string

'/// the Presentation-Engine consists of showing the presentation, with all it's effects. ///'

    '/// Create a new presentation. ///'
    Call hNewDocument
    Sleep (1)

    '/// Open the test-file. ///'
    Call hFileOpen (gTesttoolpath + "graphics\required\input\allshapes2.odp") 'effects.odp")
    
    '/// Start the slideshow. ///'
    Call hTypeKeys "<F5>"
    sleep (10)
    kontext "DocumentPresentation"
    while DocumentPresentation.exists()
        DocumentPresentation.TypeKeys "<SPACE>"
        sleep(10)
    wend
    
    Kontext "DocumentImpress"
    if (DocumentImpress.exists(1)) then
        'nothing
    else
        warnlog "presentation not ended."
    endif

    Call hCloseDocument

    sleep (1)
    '/// Open the test-file. ///'
    Call hFileOpen (gTesttoolpath + "graphics\required\input\effects.odp")
    Sleep (10)
    
    '/// Start the slideshow. ///'
    CALL hTypeKeys "<F5>"
    Sleep (10)
    '/// Press "Space" again, to continue with slide two. ///'
    kontext "DocumentPresentation"
     while DocumentPresentation.exists()
        DocumentPresentation.TypeKeys "<SPACE>"
        sleep(10)
    wend

    printlog "End of eleventh page."
    if DocumentPresentation.Exists then
        warnlog "DocumentPresentation shouldnt be visible right now."
        DocumentPresentation.TypeKeys "<SPACE>"
    else
        printlog "Presentation ended correctly."
        kontext "DocumentImpress"
    end if

'/// Close Application ///'
    Call hCloseDocument
    Printlog "Finished Optional-test for Presentation-Engine"
endcase 'tiPengineAllShapesAndEffects

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

testcase tiPengine2ObjectsGetsEffects
    dim i as integer
    dim t as integer
    dim q as integer
    dim e as integer
    dim sFileName as string

    printlog "the Presentation-Engine consists of showing the presentation, with all it's effects."

    printlog "Create a new presentation."
    Call hNewDocument
    Call sSelectEmptyLayout
    sleep (1)

    kontext "Toolbar"
    sleep (1)
    printlog "insert a Smiley."
    printlog "From the toolbar: Insert three objects:"
    printlog "insert a Smiley."
    kontext "Toolbar"
    if Toolbar.Exists then
        if Toolbar.IsVisible then
            sleep (1)
            try
                SymbolShapes.TearOff
            catch
                warnlog "Issue for GH; .tearoff doesnt tell success"
            endcatch
            sleep (1)
            kontext "SymbolShapes"
            SymbolShapesSmiley.Click
            sleep (1)

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

            sleep (1)
            kontext "SymbolShapes"
	    SymbolShapes.Close

            printlog "Unmark all objects"
            hTypeKeys "<ESCAPE>"

            printlog "Mark the Smiley"
            hTypeKeys "<TAB>"
        else
            warnlog "No toolbar visible, please notify the test-administrator"
        end if
    else        
        warnlog "toolbar not visible"
    end if

    printlog "Smiley inserted, time to add some effects."

    printlog "Effect no 1"

    printlog "Slide Show->Custom Animation..."
    SlideShowCustomAnimation
        Kontext "Tasks"
        printlog "Click button 'Add...'"
        EffectAdd.click
        printlog "Dialog 'Custom Animation' comes up"
        kontext
        printlog "Switch to TabPage: Entrance"
        active.setPage(TabEntrance)
        kontext "TabEntrance"
        if TabEntrance.exists(5) then
            DialogTest(TabEntrance)
            printlog "Find 'Dissolve-in'." 
            TabEntrance.TypeKeys "<DOWN>", 6
            Sleep (3)
            TabEntrance.Ok
            Printlog "Added effect 'Dissolve-in'"
        else
            warnlog "Tab Entrance does not exist?"
        end if
        Kontext "Tasks"

    printlog "Effect no 2"

    printlog "Add a second effect to the object"
    EffectAdd.click
    
    printlog "Dialog 'Custom Animation' comes up"
    printlog "Switch to TabPage: Emphasis"
    kontext
    active.setPage(TabEmphasis)
    kontext "TabEmphasis"
    if TabEmphasis.exists(5) then
        DialogTest(TabEmphasis)
        Effects.Select 5    'Transparency
        Sleep (3)
        printlog "Close dialog 'Custom Animation' with 'OK'"
        TabEmphasis.OK
        Printlog "Added effect 'Transparency'"
    else
        warnlog "Error when switching Tab"
    end if
    Kontext "Tasks"

    printlog "Effect no 3"

    printlog "Insert new slide"
    InsertSlide
    Printlog "Inserted new Slide" 

    kontext "Slides"
    printlog "Make sure the last slide is selcted"
    SlidesControl.TypeKeys "<TAB>"
    SlidesControl.TypeKeys "<PAGEDOWN>", 3
    Sleep (1)

    printlog "Insert new object"
    Call hTextrahmenErstellen ("Test text for the second slide to test the PresentationEngine", 35, 35, 70, 70)

    printlog "Add the Transformation-Effect 'put on the brakes'" 
    SlideShowCustomAnimation
        Kontext "Tasks"
        printlog "Click button 'Add...'"
        EffectAdd.click
            printlog "Dialog 'Custom Animation' comes up"
            kontext
            printlog "Switch to TabPage: Entrance"
            active.setPage(TabEntrance)
            kontext "TabEntrance"
            if TabEntrance.exists(5) then
                printlog "Add Transformation-Effect: 'Put on the Breaks'"
                TabEntrance.TypeKeys "<DOWN>", 30  
                Sleep (3)
                TabEntrance.Ok
                Printlog "Added effect 'Put on the Breaks'"
            else
                warnlog "Impress:Tasks Pane:Custom Animation:Add... button didn't work."
            end if
            Kontext "Tasks"

            printlog "Effect no 4"

            printlog "Click button 'Add...'"
            EffectAdd.click
            printlog "Dialog 'Custom Animation' comes up"
            kontext
            printlog "Switch to TabPage: Motion Paths"
            active.setPage(TabMotionPaths)
            kontext "TabMotionPaths"
            if TabMotionPaths.exists(5) then
                printlog "Add motion-path-effect:  'schwosch'"
                TabMotionPaths.TypeKeys "<DOWN>", 66 
                Sleep (3)                
                TabMotionPaths.Ok
                Printlog "Added effect 'Schwosch'"
                kontext "Tasks"
            else
                warnlog "Couldn't find the Tabpage: MotionPaths. Check why."
            end if

        printlog "Press 'PageUp' to get to the first slide"
        hTypeKeys "<PAGEUP>"

        printlog "Run the slideshow with F5."
        hTypeKeys "<F5>"
        Sleep (5)
        kontext "DocumentPresentation"
        if DocumentPresentation.Exists (15) then
            Printlog "Presentation started, calling 1st effect, 1st object."
            DocumentPresentation.TypeKeys "<SPACE>"
            sleep (5)
        else
            warnlog "Slideshow didn't start. Check why."
        end if
        printlog "calling 2nd effect, 1st object."
        DocumentPresentation.TypeKeys "<SPACE>"
        Sleep (5)
        printlog "calling 2nd slide."
        DocumentPresentation.TypeKeys "<SPACE>"
        Sleep (5)
        printlog "calling 1st effect, 2nd object"
        DocumentPresentation.TypeKeys "<SPACE>"
        Sleep (5)
        printlog "calling 2nd effect, 2nd object"
        DocumentPresentation.TypeKeys "<SPACE>"
        Sleep (5)
        printlog "ending presentation"
        DocumentPresentation.TypeKeys "<SPACE>"
        Sleep (5)
        Kontext "DocumentPresentation"
        printlog "getting back to edit view."
        DocumentPresentation.TypeKeys "<SPACE>"
        
        if DocumentPresentation.Exists(5) then 
            warnlog "Presentation should have ended. Check why it didn't."
        end if

        Kontext "DocumentImpress"

    printlog "Close the document"
    Call hCloseDocument
    Printlog "Finished Optional-test for Presentation-Engine"
endcase 'tiPengine2ObjectsGetsEffects

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

Function TestAnimations
   '/// select in the listbox 'Effects' the second entry///'
   Dim i as Integer
   Dim s as Integer
   Dim q as Integer
   Dim e as Integer
   Dim o as Integer
   Dim p as Integer
   i = Effects.GetItemCount
   s = Speed.GetItemCount
   AutomaticPreview.Check
   Effects.TypeKeys "<HOME>"
   For e = 1 to i
       If e <> p Then
           if AutomaticPreview.isChecked = TRUE then sleep 1
           Printlog "Effect has position Nr: " + Effects.GetSelIndex + ". Name of effect: " + Effects.GetSelText
           '/// Select the next entry ///'
           Effects.TypeKeys "<DOWN>"
           p = Effects.GetSelIndex
       Else
           Printlog "Test of effects ended."
           e = i
       Endif
   Next e
   if Speed.IsEnabled then
       For q = 1 to s
           Speed.Select q
           sleep 1
       Next q
   endif
   AutomaticPreview.Check
   sleep 1
   AutomaticPreview.Check
   Kontext
end Function