summaryrefslogtreecommitdiff
path: root/testautomation/graphics/required/includes/impress/i_opt_1_.inc
blob: 148bbe9804249b7dcc538478e89e7785581517a7 (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
'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 :
'*
'\******************************************************************************

testcase tiAlwaysWithCurrentPage()
    dim i as integer

    Call hNewDocument()
    printlog "Open file 'impdraw\required\input\diashow.od?"
    hFileOpen  ConvertPath (gTesttoolPath + "graphics\required\input\diashow.odp")
    WaitSlot(10000) 'sleep 10

    printlog "Check if the document is writable"
    if fIsDocumentWritable = false then
        printlog "Make the document writable and check if it's succesfull"
        if fMakeDocumentWritable = false then
            warnlog "The document can't be make writeable. Test stopped."
            goto endsub
        endif
    endif

    printlog "Test with default option."
    printlog "Checking: 'Always with current page' - default"

    printlog "Setting Options to start with current page."
    setStartCurrentPage(true)
    printlog "Check if Navigator is open. Default: closed."
    Kontext "NavigatorDraw"
    if NavigatorDraw.exists (5) then
        warnlog "presupposition not met: navigator should be closed on loading the document!"
    else
        ViewNavigator
        WaitSlot (2000)
    end if

    printlog "Making sure after loading we are on slide one."
    i = fGetSlideNumber()
    if (i<>1) then
        warnlog "Presupposition not met. After loading the file not the first slide is up. It is number: " + i
    endif

    printlog "Press Key [Page Down] two times to get to slide number three. We are on slide one."
    hTypeKeys ("<home><PageDown><PageDown>")
    printlog "Start the slideshow with 'Slide Show->Slide Show."
    SlideShowSlideshow
    kontext "DocumentPresentation"
    printlog "Open the navigator View->Navigator."
    Kontext "NavigatorDraw"
    printlog "Opening navigator if none is there."
    if (not NavigatorDraw.exists(5)) then
        ViewNavigator
    endif
    printlog "The slideshow has to start on slide 3."
    printlog "running routine for slide 3 and 4."
    for i = 3 to 4
        Kontext "NavigatorDraw"
        printlog "Checking for navigator.."
        if (not NavigatorDraw.exists(5)) then
            ViewNavigator
        endif
        printlog "Getting number of current slide."
        printlog "Countervariable is " & i
        fGetSlideNumber(i)
        printlog "Current slide number is: " & i & "."
        printlog "Typing pagedown to get to next slide."
        DocumentPresentation.TypeKeys "<pagedown>"
        WaitSlot (5000) 'sleep (5)
    next i

    printlog "Trying to end presentation with mouseclick on black endscreen."
    try
        DocumentPresentation.mousedown (50,50,1)
        DocumentPresentation.mouseup (50,50,1)
    catch
        warnlog "TimeOut on pressing mouse button."
    endcatch

    printlog "Trying to recognize if slideshow did not end.."
    try
        gMouseClick 50,50  ' this one works to recognice the not ending !
        Printlog "- Slideshow ended at the right time"
    catch
        Warnlog "- Slideshow still running "
        kontext "DocumentPresentation"
        printlgo "Ending presentation with ESC."
        DocumentPresentation.TypeKeys "<ESCAPE>"
    endcatch
    WaitSlot (2000)    'sleep 2

    printlog "Test with changed option: start with first slide."
    setStartCurrentPage(false)
    printlog "UnChecked: Always with current page."
    printlog "press Key [Home] to get to the first slide."
    kontext "DocumentImpress"
    printlog "Deselect object."
    hTypeKeys "<ESCAPE>"
    hTypeKeys "<home>"
    printlog "Making sure navigator is open."
    Kontext "NavigatorDraw"
    if (not NavigatorDraw.exists(5)) then
        ViewNavigator
    endif
    printlog "Checking if we are on slide one."
    i = fGetSlideNumber()
    if (i<>1) then
        warnlog "Start-condition not met. Not the first slide is up. It is number: " & i & "."
    endif
    printlog "Press Key [Page Down] two times to get to slide number three."
    hTypeKeys "<PageDown> <PageDown>"
    printlog "Start the slideshow with 'Slide Show->Slide Show."
    SlideShowSlideshow
    kontext "DocumentPresentation"
    printlog "Open the navigator View->Navigator."
    Kontext "NavigatorDraw"
    printlog "Checking if navigator is open."
    if (not NavigatorDraw.exists(5)) then
        ViewNavigator
    endif
    printlog "The slideshow has to start on slide 1."
    printlog "Running routine for slide 1-4. i = 1 to 3 because we start already on slide 1."
    for i = 1 to 3
        Kontext "NavigatorDraw"
        if (not NavigatorDraw.exists(5)) then
            ViewNavigator
        endif
        printlog "Getting number of current slide."
        fGetSlideNumber(i)
        printlog "Current slide is: " & i & "."
        DocumentPresentation.TypeKeys "<pagedown>"
        WaitSlot (5000)
    next i
    fGetSlideNumber(i)
    printlog "Current slide is: " & i & "."
    DocumentPresentation.TypeKeys "<pagedown>"
    printlog "Trying to end presentation with mouseclick on black endscreen."
    try
        DocumentPresentation.mousedown (50,50,1)
        DocumentPresentation.mouseup (50,50,1)
        Printlog "- Slideshow ended at the right time"
    catch
        Warnlog "- Slideshow still running "
        kontext "DocumentPresentation"
        printlog "Ending running presentation with ESC."
        DocumentPresentation.TypeKeys "<ESCAPE>"
    endcatch

    Kontext "NavigatorDraw"
    printlog "Checking if navigator is open."
    if (not NavigatorDraw.exists(5)) then
        ViewNavigator
    endif
    printlog "Checking if we are on slide 3."
    i = fGetSlideNumber()
    if (i<>3) then
        warnlog "We are on the wrong slide! Should be 3 but it is: " & i
    endif

    printlog "Close the navigator View->Navigator."
    Kontext "NavigatorDraw"
    if NavigatorDraw.exists(5) then
        ViewNavigator
    endif

    printlog "Restore: check Always with current page."
    setStartCurrentPage(true)
    Call hCloseDocument
endcase