summaryrefslogtreecommitdiff
path: root/testautomation/global/required/includes/g_customize.inc
blob: 07c2dde3927d2506519d7a877c7473dacfbf12dd (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
'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 : thorsten.bosbach@oracle.com
'*
'* short description : update and resouce test for tools/customize
'*
'************************************************************************
'*
' #1  tToolsCustomize
'*
'\***********************************************************************

testcase tToolsCustomize

    Dim iCountMsgBox as integer
    '/// open application ///'
    Call hNewDocument
    sleep 2
    '/// Tools->Customize... ///'
    ToolsCustomize
    sleep 3
    Kontext
    '/// switch to tabpage 'Menus' ///'
    try
        Active.SetPage TabCustomizeMenu             ' 1 ------------------
    catch
        warnlog "couldn't switch to tabpage 'Menus'"
    endcatch
    Kontext "TabCustomizeMenu"
    if TabCustomizeMenu.exists(5) then
        Call DialogTest ( TabCustomizeMenu )
        '/// Go in 'Menu' list-box one item down
        Menu.typeKeys("<down>")
        '/// Go in 'Entries' list-box one item down 
        Entries.typeKeys("<down>")
        sleep(2)
        '/// click button 'new' ///'
        BtnNew.Click
        sleep(1)
        '/// 'New Menu' dialog comes up ///'
        Kontext "MenuOrganiser"
        Call DialogTest ( MenuOrganiser )
        '/// Cancel dialog 'New Menu' ///'
        MenuOrganiser.cancel
        sleep(2)

        Kontext "TabCustomizeMenu"
        '/// In 'Menu' list-box select one item up
        Menu.Select(1)
        sleep(1)
        '/// Click on button 'Menu' ///'        
        MenuBtn.openMenu
        printlog "opened first one"
        sleep(1)
        '/// Select the first entry 'Move' ///'
        hMenuSelectNr(1)
        '/// Dialog 'Move Menu' comes up ///'
        Kontext "MenuOrganiser"
        Call DialogTest ( MenuOrganiser )
        '/// Click on the 'Up'-button ///'
        ButtonUp.click
        '/// Click on the 'Down'-button ///'
        ButtonDown.click
        '/// Cancel Dialog 'Move Menu' ///'
        MenuOrganiser.cancel
        
        Kontext "TabCustomizeMenu"
        '/// Click Button 'Add Commands' ///'
        AddCommands.click
        '/// Dialog 'Add Commands' comes up ///'
        Kontext "ScriptSelector"
        call DialogTest(ScriptSelector)
        LibraryTreeList.typeKeys ("<down>")
        ScriptList.typeKeys ("<down>")
        '/// Close Dialog 'Add Commands' ///'
        ScriptSelector.cancel
        
        Kontext "TabCustomizeMenu"
        '/// Click button 'Command' ///'
        sleep(1)
        Command.click
        printlog "opened second one"
        WaitSlot()
        '/// Select the first entry 'Add Submenu' ///'
        hMenuSelectNr(1)
        '/// Dialog 'Name' comes up ///'
        Kontext "CustomizeMenuName"
        call DialogTest (CustomizeMenuName)
        Eingabefeld.typeKeys ("A")
        '/// Cancel Dialog 'Name' ///'
        CustomizeMenuName.cancel

        WaitSlot()
        Kontext "TabCustomizeMenu"
        '/// Click button 'Command' ///'
		sleep(1)
        Command.click
        printlog "opened third one"
        WaitSlot()
        '/// Select the third entry 'Rename' ///'
        hMenuSelectNr(3)
        '/// Dialog 'Name' comes up ///'
        Kontext "CustomizeMenuReName"
        call DialogTest (CustomizeMenuReName)
        Eingabefeld.typeKeys ("A")
        '/// Cancel Dialog 'Name' ///'
        CustomizeMenuReName.cancel

        Kontext "TabCustomizeMenu"
        '/// click button 'downwards' ///'
        BtnDown.Click
        '/// click button 'upwards' ///'
        BtnUp.Click
        '/// click button 'Reset' ///'
        ResetBtn.Click
        kontext
        printlog "survived all menu comands"
        if Messagebox.exists (5) then
            if Messagebox.GetRT = 304 then
                printlog "Messagebox: Menu configuration will be reset...: '"+Messagebox.getText+"'"
                call DialogTest(Messagebox, 50)
                Messagebox.yes
            endif
        endif
    endif
    
        Kontext
        '/// switch to tabpage 'Toolbars' ///'
    try
        Messagebox.SetPage TabCustomizeToolbars    ' 4 ------------------
    catch
        warnlog "couldn't switch to tabpage 'Toolbars'"
    endcatch
    Kontext "TabCustomizeToolbars"
    if TabCustomizeToolbars.exists(5) then
        Call DialogTest ( TabCustomizeToolbars )
        Menu.typeKeys("<down>")
        ToolbarContents.typeKeys("<down>")
        SaveIn.typeKeys("<down>")
        '/// click button 'new' ///'
        BtnNew.Click
        waitslot
        '/// Dialog 'Name' comes up ///'
        Kontext "NewToolbar"
        Call DialogTest ( NewToolbar )
        ToolbarName.typeKeys("<down>")
        SaveIn.typeKeys("<down>")
        '/// Cancel dialog 'Name' ///'
        NewToolbar.cancel
        waitslot

        Kontext "TabCustomizeToolbars"
        '/// Click Button 'Add Commands...' ///'
        SaveIn.typeKeys("<up>")
        AddCommands.click
        '/// Dialog 'Add Commands' comes up ///'
        Kontext "ScriptSelector"
        call DialogTest (ScriptSelector)
        LibraryTreeList.typeKeys("<down>")
        ScriptList.typeKeys("<down>")
        '/// Close Dialog 'Add Commands' ///'
        ScriptSelector.cancel
        
        waitslot
        Kontext "TabCustomizeToolbars"
        sleep(1)
        '/// Click button 'Command' ///'
        Command.click
        waitslot
        '/// Select the firste entry 'Rename' ///'
        hMenuSelectNr(1)
        '/// Dialog 'Name' comes up ///'
        Kontext "CustomizeToolbarsReName"
        if NOT CustomizeToolbarsReName.exists(2) then
        Kontext "TabCustomizeToolbars"
        ToolbarContents.typeKeys("<down>")
        else
        CustomizeToolbarsReName.cancel()
        endif        

        Kontext "TabCustomizeToolbars"
        sleep(1)
        Command.click
        waitslot
        hMenuSelectNr(1)
        Kontext "CustomizeToolbarsReName"
        call DialogTest (CustomizeToolbarsReName)
        Eingabefeld.typeKeys ("A")
        '/// Cancel Dialog 'Name' ///'
        CustomizeToolbarsReName.close
        
        waitslot
        Kontext "TabCustomizeToolbars"
        '/// Click button 'Command' ///'
        sleep(1)
        Command.click
        waitslot
        '/// Select the fifth entry 'Change Icon' ///'
        hMenuSelectNr(5)
        '/// Dialog 'Change Icon' comes up ///'
        Kontext "ChangeIcon"
        call DialogTest (ChangeIcon)
        '/// Click button 'Import...' on dialog Change 'Icon' ///'
        Import.click
        '/// Dialog 'Open' comes up ///'
        Kontext "GeneralFileDialog"
        '/// Cancel dialog 'Open' ///'
        GeneralFileDialog.cancel
        '/// Cancel Dialog 'Change Icon' ///'
        Kontext "ChangeIcon"
        ChangeIcon.cancel
        
        Kontext "TabCustomizeToolbars"
        '/// click button 'downwards' ///'
        BtnDown.Click
        '/// click button 'upwards' ///'
        BtnUp.Click
        '/// click button 'Reset' ///'
        ResetBtn.Click
        kontext
        if Messagebox.exists (5) then
            if Messagebox.GetRT = 304 then
                printlog "Messagebox: Menu configuration will be reset...: '"+Messagebox.getText+"'"
                call DialogTest(Messagebox, 50)
                Messagebox.no
            endif
        endif

        WaitSlot()
        Kontext "TabCustomizeToolbars"
        '/// On Tab Page 'Customize Menus' click on Button 'Toolbar' ///'
        sleep(1)
        MenuBtn.openMenu
        WaitSlot()
        hMenuSelectNr(1)
        kontext
        sleep 3
        if Messagebox.exists (5) then
            if Messagebox.GetRT = 304 then
                printlog "Messagebox: Toolbar configuration will be reset...: '"+Messagebox.getText+"'"
                call DialogTest(Messagebox, 50)
                Messagebox.no
            endif
        endif
    endif    
        Kontext
        '/// switch to tabpage 'Events' ///'
    try
        Messagebox.SetPage TabCustomizeEvents      ' 5 ------------------
    catch
        warnlog "couldn't switch to tabpage 'Events'"
    endcatch
    Kontext "TabCustomizeEvents"
    if TabCustomizeEvents.exists(5) then
        Call DialogTest ( TabCustomizeEvents )
        SaveIn.typeKeys("<down>")
        EventListbox.typeKeys("<down>")
        WaitSlot()
        '/// click button 'Assign Macro' ///'
        AssignMacro.Click
        WaitSlot()
        ' If Java is not [correctly] installed a messagebox will be shown
        Kontext "Messagebox"
        if Messagebox.Exists(2) then            
            for iCountMsgBox = 1 to 20
                Kontext "Messagebox"
                if MessageBox.Exists(2) then
                    if MessageBox.GetRT = 304 then
                        if iCountMsgBox = 1 then
                            warnlog "Java runtime is defective. Detection failed!"
                        endif
                        '.getRT is need because otherwise the operation will be done
                        'on the opened tab control behind the message box
                        QAErrorLog "Dialog (" & iCountMsgBox & "): " & Messagebox.GetText
                        if iCountMsgBox > 15 then
                            warnlog "Now the message box occours " & iCountMsgBox & " instead of 15 times!"
                        endif
                        Messagebox.OK
                    endif
                else
                    exit for
                endif
            next iCountMsgBox
        endif        
        '/// Dialog 'MacroSelector' comes up ///'
        Kontext "ScriptSelector"
        call DialogTest (ScriptSelector)
        LibraryTreeList.typeKeys("<down>")
        ScriptList.typeKeys("<down>")
        '/// Cancel Dialog 'MacroSelector' ///'
        ScriptSelector.cancel
        '/// click button 'Remove Macro' ///'
        Kontext "TabCustomizeEvents"
        RemoveMacro.Click
        WaitSlot()
        '/// Press Button 'Reset' ///'
        ResetBtn.click
        '/// cancel dialog 'Customize' ///'
        Kontext "TabCustomizeEvents"
        TabCustomizeEvents.cancel
    endif
    
    '/// close application ///'
    Call hCloseDocument
endcase