summaryrefslogtreecommitdiff
path: root/testautomation/graphics/optional/includes/impress/i_slidelayer.inc
blob: 441e0a323099fe9dcd1a4dbe9cd2962ed42fe187 (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
'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 :
'*
'*********************************************************************
' #1 tiInsertExpandSlide
' #1 tiInsertSummarySlide
' #1 tiFormatSeitenlayout
' #1 t114174
' #1 t111862
'\********************************************************************

'  Dateiname.SetText ConvertPath (gTesttoolPath + "global\input\graf_inp\enter.bmp")
'  Inhalt.SetText ConvertPath (gTesttoolPath + "graphics\required\input\leer.sxd")    '/// auto.sdd choosen ///'

'-------------------------------------------------------------------------------
testcase tiInsertExpandSlide
    
   dim i,x as integer
   dim sTemp as string
   dim b116350 as boolean

   '/// open application ///'
   Call hNewDocument
   Call sSelectEmptyLayout
   '/// create presupposition ///
   '///+ View->Master View->Outline View ///'
   ViewWorkspaceOutlineView
      Sleep 1
      Kontext "DocumentImpressOutlineView"
      '///+ create a slide with some levels...and some more slides with just one level...  ///'
      '///+ it should look like this: ///'
      '///+-------------------------------------------------- ///'
      '///+ Slide 1///'
      '///+ - A ///'
      '///+ - - B///'
      '///+ - - - C///'
      '///+ - - - - D///'
      '///+ - - - - - - F///'
      '///+ - B///'
      '///+ - C///'
      '///+ - D///'
      '///+ Slide 2 ///'
      '///+ Slide 3 ///'
      '///+ Slide 4 ///'
      '///+ Slide 5 ///'
      '///+-------------------------------------------------- ///'
      DocumentImpressOutlineView.TypeKeys "Slide 1"
      for i = 1 to 6
         DocumentImpressOutlineView.TypeKeys "<return><tab>"
         DocumentImpressOutlineView.TypeKeys chr(64+i)
      next i
      DocumentImpressOutlineView.TypeKeys "<return>"
      DocumentImpressOutlineView.TypeKeys ("<shift tab>",5)
      for i = 1 to 3
         DocumentImpressOutlineView.TypeKeys chr(65+i)
         DocumentImpressOutlineView.TypeKeys "<return>"
      next i
      DocumentImpressOutlineView.TypeKeys ("<shift tab>")
      for i = 2 to 5
         DocumentImpressOutlineView.TypeKeys "Slide " + i
         DocumentImpressOutlineView.TypeKeys "<return>"
      next i
      DocumentImpressOutlineView.TypeKeys "<backspace>"
   '///+ View->Master View->Drawing View ///'
   ViewWorkspaceDrawingView
      Sleep 1
      '///+ there have to be 5 slides now ///'
      fGetSlideCount (5)

      '/// goto the first slide ///'
      hTypeKeys "<home>"
   '///<b> Insert->Expand Slide </b>///'
   InsertExpandSlide
      ' usually the content of the new pages is the same as the curren, there is a slide created for every part in the first outline level (gliederungsebene)
      Sleep 1
      if (8 = fGetSlideCount (8)) then
         printlog "Insert Expand Slide accomplished correctly"
      else
         warnLog "Bug with Insert Expand Slide"
      endif
      '///+ check slide content ///'
      hTypeKeys ("<TAB><F2>"
      EditSelectAll
      EditCopy
      sTemp = GetClipboard()
      if (sTemp <> "A") then
         Warnlog "wrong slide content, expected: '" + "Slide 1" + "'; but got: '" + sTemp + "'"
      else
         Printlog "OK :-)"
      endif
      for i = 2 to 4
         hTypeKeys "<pagedown>"
         hTypeKeys ("<TAB><F2>")
         EditSelectAll
         EditCopy
         sTemp = GetClipboard()
         if (sTemp <> chr(64+i)) then
            Warnlog "Wrong slide content, expected: '" + chr(64+i) + "'; but got: '" + sTemp + "'"
         else
            Printlog "OK :-)"
         endif
      next i
      for i = 2 to 5
         hTypeKeys "<pagedown>"   'If the first slide existed, this is where it would have been.
         hTypeKeys ("<TAB><F2>")
         EditSelectAll
         EditCopy
         sTemp = GetClipboard()
         if (sTemp <> ("Slide "+i)) then
            Warnlog "Wrong slide content, expected: '" + "Slide "+i + "'; but got: '" + sTemp + "'"
         else
            Printlog "OK :-)"
         endif
      next i

      hTypeKeys "<escape><home>"
   '///<b> Insert->Expand Slide </b>///'
   InsertExpandSlide
      '/// And since the Second slide now should be named "B", we check that first ///'
      hTypeKeys ("<TAB><F2>")
      EditSelectAll
      try
         EditCopy
      catch
         printlog "Something wrong when trying to select Slide-name."
      endcatch
      sTemp = GetClipboard()
      if (sTemp <> "B") then
         Warnlog "Wrong slide content, expected: 'B'; but got: '" + sTemp + "'"
      else
         Printlog "OK :-)"
      endif
      hTypeKeys "<pagedown>"
      hTypeKeys ("<TAB><F2>")
      EditSelectAll
      for i = 2 to 4
         try
            EditCopy
         catch
            printlog "Something wrong when trying to select Slide-name."
         endcatch
         sTemp = GetClipboard()
         if (sTemp <> chr(64+i)) then
            Warnlog "Wrong slide content, expected: '" + chr(64+i) + "'; but got: '" + sTemp + "'"
         else
            Printlog "OK :-)"
         endif
         hTypeKeys "<pagedown>"
         hTypeKeys ("<TAB><F2>")
         EditSelectAll
	 next i
      for i = 2 to 5
         EditCopy
         sTemp = GetClipboard()
         if (sTemp <> ("Slide "+i)) then
            Warnlog "Wrong slide content, expected: '" + "Slide "+i + "'; but got: '" + sTemp + "'"
         else
            Printlog "OK :-)"
         endif
         hTypeKeys "<pagedown>"   'If the first slide existed, this is where it would have been.
         hTypeKeys ("<TAB><F2>")
         EditSelectAll
	 next i

   '/// close application ///'
   Call  hCloseDocument
endcase 'tiInsertExpandSlide

'-------------------------------------------------------------------------------
testcase tiInsertSummarySlide

    dim i as integer
    dim sTemp as string
    dim saText (10) as string

    for i = 1 to 7
        saText (i) = chr(64+i)
    next i
    saText (5) = ""
    saText (7) = ""

    printlog "Open application."
    Call hNewDocument

    printlog "Presupposition : on the slide has to be something from the outline view AND i have to be on such a slide!"
    printlog "View->Master View->Outline View."
    ViewWorkspaceOutlineView
    Sleep 1
    Kontext "DocumentImpressOutlineView"
    DocumentImpressOutlineView.TypeKeys "<home>"
    printlog "+ create 7 slides like this:"
    printlog "+--------------------------------------------------"
    printlog "+ A "
    printlog "+ B"
    printlog "+ C"
    printlog "+ D"
    printlog "+  "
    printlog "+ F"
    printlog "+  "
    printlog "+--------------------------------------------------"
    for i = 1 to 7
        DocumentImpressOutlineView.TypeKeys (saText(i) + "<return>")
    next i

    printlog "View->Master View->Drawing View ."
    ViewWorkspaceDrawingView
    Sleep 1
    printlog "Goto first slide by typing [home]"
    hTypeKeys "<Home>"
    printlog "test menue entries"
    printlog "Insert->Summery Slide."
    try
        InsertSummerySlide
    catch
        warnlog "InsertSummerySlide didnt work. Check why."
    endcatch
    Sleep 1
    printlog "slide is appended after the last slide"
    printlog "the content of the slide depends on from which slide the function was called!"
    printlog "it is only from the actual slide to the end of the presentation"
    printlog "it is aloowed to have a slide without the outline stuff inbetween"
    printlog "check slide content"
    hTypeKeys "<Tab>"
    wait 50
    htypekeys "<Tab>"
    wait 50
    htypekeys "<F2>"
    wait 50
    htypekeys "<mod1 Home>"
    wait 50
    for i = 1 to 7
        hTypeKeys "<Shift End>"
        EditCopy
        sTemp = GetClipboardText
        if (saText(i) <> sTemp) then
            if ((i=5) OR (i=7)) then
                if (saText(6) <> sTemp) then
                    Warnlog "WRONG: is: '" + sTemp + "'; should: '" + saText(6) + "'"
                else
                    Printlog "is: '" + sTemp + "'; should: '" + saText(i) + "'"
                endif
             else
                Warnlog "WRONG: is: '" + sTemp + "'; should: '" + saText(i) + "'"
            endif
        else
            Printlog "is: '" + sTemp + "'; should: '" + saText(i) + "'"
        endif
        hTypeKeys "<down><home>"
    next i
    printlog "close application"
    Call  hCloseDocument
endcase 'tiInsertSummarySlide

'------------------------------------------------------------------------------
testcase tiFormatSeitenlayout

    qaerrorlog "outcommented due to bug"
    goto endsub
    
        Printlog "Format/Page Layout"
     Call hNewDocument               '/// new impress document ///'
    
     FormatPage                '/// format page ///'
     Kontext "Tasks"
     sleep 5
     SetClipboard LayoutsPreview.GetText       '/// get page name ///'
     SeitenName.SetText "Test"          '/// change page name ///'
     sleep 1
     if Hintergrund.IsChecked=False Then         '/// check background ///'
       Hintergrund.Check
     else
       Hintergrund.UnCheck
            if Hintergrund.IsChecked=False Then PrintLog " Background is deactivated"
     end if
    
     if ObjekteAufDemHintergrund.IsChecked = True Then       '/// change status of objects on background ///'
       PrintLog " Object on background is activated"
       ObjekteAufDemHintergrund.UnCheck
       if ObjekteAufDemHintergrund.IsChecked = False Then PrintLog " Objects on background are deactivated"
     else
       ObjekteAufDemHintegrund.Check
       PrintLog " Object on background is activated"
     end if
     Seitenlayout.OK              '/// close dialog ///'
     sleep 1
     FormatPage                '/// reopen dialog ///'
     Kontext "LayoutsPreview"
     sleep 2
     if GetClipboardText <> SeitenName.GetText Then
       PrintLog " Page name is correct"
     else
       WarnLog " Page name is not correct"
     end if
     sleep 2
     LayoutsPreview.TypeKeys "<TAB>"            '/// assign different page layout ///'
     LayoutsPreview.TypeKeys "<DOWN>" ,2
     LayoutsPreview.TypeKeys "<Return>"
     sleep 2
     Kontext
     if Active.Exists (5) then
        printlog "active (1): "+active.gettext
        Active.OK
     else
        kontext "Pagelayout_UndoDeleteWarning"
        Pagelayout_UndoDeleteWarning.OK
        printlog "Can't redo this action! Apply template? -> OK (1) "
        'DontShowAgain.check ' since it's a level2 test i COULD do this .-) TBO
     endif
     Kontext "DocumentImpress"
     sleep 3
     DocumentImpress.MouseDoubleClick 25,60
     sleep 3
     Kontext "GrafikEinfuegenDlg"          '/// check in document if layout has changed ///'
     sleep 2
     if GrafikEinfuegenDlg.exists (5) then
        try
          DateiName.SetText ConvertPath (gTesttoolPath + "global\input\graf_inp\baer.tif")
          sleep 3
          Preview.Check
          sleep 3
          Oeffnen.Click
          sleep 3
          Kontext "Active"
           if Active.Exists Then
              Warnlog Active.GetText
              Active.OK
           end if
        catch
          WarnLog " LayoutsPreview did not work"
        endcatch
     else
        warnlog "Clicked beside :-( I tried to click into the dokument, to insert a graphic, but missed the right point :-("
     endif
      sleep 3
     Kontext "DocumentImpress"
     Call hCloseDocument             '/// close document ///'
    endcase 'tiFormatSeitenlayout
    
'------------------------------------------------------------------------------
testcase t114174

    '/// resulting from regression in #111862#  ///'
    dim sReference(2) as string
    dim sText(2) as string
    dim i as integer
    dim sFile as string
    
    if gApplication = "IMPRESS" then 
        ExtensionString = "odp"
    else
        ExtensionString = "odg"
    end if
    printlog "Used extension string is: " & ExtensionString
    sFile = convertPath(gOfficePath + "user/work/" + getTestcaseName & "." & ExtensionString)
    printlog "Filepath is: " & sFile
   if Dir (sFile) <> "" then kill (sFile)

    sReference(1) = "Koelle"
    sReference(2) = "Alaaf!"
    '/// open application ///'
    Call hNewDocument

    '/// Format->Modify Layout ///'
    FormatPage
    Kontext "Tasks"
        LayoutsPreview.TypeKeys "<TAB>"
        LayoutsPreview.TypeKeys "<Home><Right>"

      kontext "Pagelayout_UndoDeleteWarning"
      if Pagelayout_UndoDeleteWarning.exists then
         Pagelayout_UndoDeleteWarning.ok
      endif
    Kontext "Tasks"
    LayoutsPreview.TypeKeys "<Return>"
    printlog "(a) setting title and body text"
    for i = 1 to 2
        hTypeKeys("<Tab><F2>")
        hTypeKeys(sReference(i))
        EditSelectAll
        EditCopy
        sText(i) = getClipboardText()
        printlog sText(i)
        hTypeKeys("<Escape>")
        if (sText(i) <> sReference(i)) then
            warnlog "(1) selected text '" + sText(i) + "' is different from inserted text '" + sReference(i) + "'"
        endif
    next i

    '/// deselect all by typing key 'ESCAPE' again ///'
    hTypeKeys("<Escape>")

    hFileSaveAsKill(sFile)
    sleep 5

    printlog "(b) checking title and body text"
    for i = 1 to 2
        hTypeKeys("<Tab><F2>")
        EditSelectAll
        try
            EditCopy
            sText(i) = getClipboardText()
        catch
            sText(i) = ""
        endcatch
        if (sText(i) <> sReference(i)) then
            warnlog "   (2) selected text '" + sText(i) + "' is different from inserted text '" + sReference(i) + "'"
        endif
        hTypeKeys("<Escape>")
    next i

    hCloseDocument()

    printlog "   (c) checking title and body text of saved document"
    hFileOpen(sFile)
    sleep 5
    for i = 1 to 2
        hTypeKeys("<Tab><F2>")
        EditSelectAll
        try
            EditCopy
            sText(i) = getClipboardText()
        catch
            sText(i) = ""
        endcatch
        hTypeKeys("<Escape>")
        if (sText(i) <> sReference(i)) then
            warnlog "   (3) selected text '" + sText(i) + "' is different from inserted text '" + sReference(i) + "'"
        endif
    next i

    hCloseDocument()
endcase 't114174

'------------------------------------------------------------------------------
testcase t111862

    qaerrorlog "outcommented due to bug"
    goto endsub
    dim sReference(2) as string
    dim sText(2) as string
    dim i as integer
    dim sFile as string

    sFile = convertPath(gOfficePath + "/user/work/" + getTestcaseName + ".sxi")

    if FileExists(sFile) then
        kill sFile
    endif

    sReference(1) = "Koelle"
    sReference(2) = "Alaaf!"
    '/// open application ///'
    Call hNewDocument

    '/// Format->Modify Layout ///'
    Formatpage
    Kontext "Tasks"
        LayoutsPreview.TypeKeys "<TAB>"
        LayoutsPreview.TypeKeys "<Home>"
        LayoutsPreview.TypeKeys "<Return>"
        Kontext "Pagelayout_UndoDeleteWarning"
           if Pagelayout_UndoDeleteWarning.exists(5) then
              Pagelayout_UndoDeleteWarning.OK
           endif
        Kontext "Tasks"
           LayoutsPreview.TypeKeys "<Right>"
           LayoutsPreview.TypeKeys "<Return>"
        Kontext "Pagelayout_UndoDeleteWarning"
           if Pagelayout_UndoDeleteWarning.exists(5) then
              Pagelayout_UndoDeleteWarning.OK
           endif
        Kontext "Tasks"
           LayoutsPreview.TypeKeys "<Right>"
           LayoutsPreview.TypeKeys "<Return>"
        Kontext "Pagelayout_UndoDeleteWarning"
           if Pagelayout_UndoDeleteWarning.exists(5) then
              Pagelayout_UndoDeleteWarning.OK
           endif

    EditSelectAll
    i=0
    gMouseMove2(30,1)
    while ((getMouseStyle <> 6) AND (i<100))
        inc (i)
        gMouseMove2(30,i)
        'printlog getMouseStyle
    wend

    gMouseMove(30, i, 70, i+20)

    hCloseDocument()
    
endcase 't111862
'------------------------------------------------------------------------------