summaryrefslogtreecommitdiff
path: root/testautomation/framework/optional/includes/options_ooo_paths.inc
blob: 692f538d6507b87e9dac4f98a5977647d1b619fa (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
'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@sun.com
'*
'* short description : Options - StarOffice - path settings
'*
'\******************************************************************************


testcase tOOoPaths
    Dim lsPathOptions(50) as String
    Dim lsDialtype(50) as String
    Dim lsPaths(10,50) as String
    Dim lsEntry(50) as String
    Dim i, j, a as Integer
    Dim sTTInputPath as String
    dim iTypeOfDialog as integer
    dim sTyp as string
    dim iPaths as integer
    dim iTyp as integer
    dim iCountOfDialogs(3) as integer
    dim aPath() as string
    dim i68646 as boolean

    i68646 = FALSE
    sTTInputPath = ConvertPath ( gOfficePath + "user\work" )
    '                  Name;         which open dialog; Count of Paths
'    call GetPathList ( lsPathOptions (), lsDialtype (), lsEntry () )
    ' which open dialog: 1: File Open; Else (2): Paths dialog
    'call DumpPathList( lsPathOptions (), lsDialtype (), lsEntry () )

    ToolsOptions
    hToolsOptions("StarOffice", "Paths")

    'reset everything to default; changes made in master.inc are undone for this test.
    Typ.TypeKeys("<down><HOME>")
    iTyp = Typ.getItemCount
    if iTyp <> 8 then
        warnlog "Unexpected count of File Types: should: " + 8 + "; is: " + iTyp
    else
        printlog "Count of Path Types: " + iTyp
    endif
    for i = 1 to iTyp
        try
            standard.click
        catch
            qaerrorlog "Unexpected: No Standard"
        endcatch
        Typ.TypeKeys( "<DOWN>" )
    next i

    printlog("save settings")
    for i = 1 to iTyp
        if i <> 1 then
            Typ.TypeKeys "<Down>"
        else
            Typ.TypeKeys "<Down>"
            Typ.TypeKeys "<Home>"
        endif
        sleep 1
        sTyp = Typ.getText
        aPath() = split(Typ.getItemText(i,2),";")
        lsPathOptions(i) = sTyp

        Bearbeiten.Click
        kontext
        if active.exists(5) then
            qaerrorlog "Active: " + active.getText
            active.ok
        endif
            kontext "OeffnenDlg"
            if OeffnenDlg.Exists(5) then
                iTypeOfDialog = 1
                inc(iCountOfDialogs(1))
            else
                kontext "PfadeAuswaehlen"
                if PfadeAuswaehlen.Exists(5) then
                    iTypeOfDialog = 2
                    inc(iCountOfDialogs(2))
                else
                    ' EXIT CONDITION
                    warnlog "No kind of File Dialog is open - exiting test"
                    iTypeOfDialog = 0
                    goto endsub
                endif
            endif

            lsDialtype(i) = iTypeOfDialog
            select case iTypeOfDialog
                case 1:' printlog( " - Dialogtype: FileOpen" )
                    kontext "OeffnenDlg"
                    if OeffnenDlg.Exists(2) then
                        lsPaths(1,i) = Pfad.GetSelText
                        ' change Path
                        Pfad.SetText sTTInputPath
                        try
                            Auswaehlen.Click
                        catch
                            qaErrorlog "Catch -1-?"
                            OeffnenDlg.typekeys("<MOD+S>")
                        endcatch
                        printlog "" + i + "/1: " + right(lsPaths(1,i),10) + " : " + sTyp + " " + lsPaths(1,i)
                    else
                        warnlog "No Path dialog available"
                    end if
                case 2:' printlog( " - Dialogtype: PathDialog" )
                    kontext "PfadeAuswaehlen"
                    if PfadeAuswaehlen.Exists(2) then
                        try
                            iPaths = Pfade.GetItemCount
                        catch
                            qaErrorLog "#i68646# Path Multilistbox is invisible to TestTool application"
                            i68646 = TRUE
                            iPaths=0
                        endcatch
                        lsEntry(i) = iPaths
                        if NOT i68646 then
                        if (2 <> iPaths) then
                            warnlog "Unexpected count of paths; Should: " + 2 + "; Is: " + iPaths
                        endif
                        endif
                        for j=1 to iPaths
                            lsPaths(j,i) = Pfade.GetItemtext(j)
                        next j
                        Hinzufuegen.Click
                        kontext "OeffnenDlg"
                        if OeffnenDlg.exists(5) then
                            Pfad.SetText sTTInputPath
                            lsPaths(iPaths+1,i) = sTTInputPath
                            Sleep (1)
                            try
                                Auswaehlen.Click
                            catch
                                OeffnenDlg.typekeys( "<MOD+S>" )
                            endcatch
                            kontext
                            if active.exists(5) then
                                qaErrorLog "Active about already existsing path?: '" + active.getText + "' + '" + sTTInputPath + "'"
                                active.OK
                            endif
                        else
                            warnlog "No Path dialog available"
                        endif
                        kontext "PfadeAusWaehlen"
                        PfadeAuswaehlen.OK
                        printlog "" + i + "/"+iPaths+": " + right(lsPaths(1,i),10) + " : " + sTyp
                        printlog "" + i + "/-: " + right(lsPaths(2,i),10) + " : " + sTyp
                    else
                        warnlog "No Path dialog available"
                    endif
                case else: warnlog "Unexpected kind of Path dialog available"
            end select
            Sleep(1)
            ' double cross check of Paths in both dialogs
            if (uBound(aPath()) <> (iTypeOfDialog-1)) then
                qaErrorLog ("Sanity check failed.")
            endif
        kontext "tabpfade"
    next i
    printlog "Path changed to, or added: '" + sTTInputPath + "'"
    
    'Check if count of kinds of dialogs match
    if iCountOfDialogs(1) <> 4 then
        warnlog "Unexpected count of File Open Dialogs: should: " + 4 + "; is: " + iCountOfDialogs(1)
    else
        printlog "Count of File Open Dialogs: " + iCountOfDialogs(1)
    endif
    if iCountOfDialogs(2) <> 4 then
        warnlog "Unexpected count of File Open Dialogs: should: " + 4 + "; is: " + iCountOfDialogs(2)
    else
        printlog "Count of File Open Dialogs: " + iCountOfDialogs(2)
    endif
    
    kontext "ExtrasOptionenDlg"
    ExtrasOptionenDlg.OK
    Sleep (4)
    printlog("Exit/restart StarOffice")
    ExitRestartTheOffice
    printlog( "Check changes")
    ToolsOptions
    hToolsOptions ( "StarOffice", "Paths" )

    for i = 1 to iTyp
        ' It's a treelistbox with multiselection;
        ' .select would select an additional item :-(
        ' a lonely <home> wouldn't change the selction :-<
        if i <> 1 then
            Typ.typeKeys("<down>")
        else
            Typ.typeKeys("<down>")
            Typ.typeKeys("<Home>")
        endif
        sleep(1)

        try
            Bearbeiten.Click
        catch
            warnlog "Multiselection ?"
        endcatch
        kontext
        if active.exists(5) then
            warnlog "#i72017# '"+active.getText+"'"
            active.ok
        endif
        select case lsDialtype(i)
            case 1:
                kontext "OeffnenDlg"
                if OeffnenDlg.Exists(5) then
                    sTyp = Pfad.GetSelText
                    if (sTyp <> sTTInputPath) then
                        if (sTyp <> ( sTTInputPath + gPathSigne)) then
                            Warnlog "'" + lsPathOptions(i) + "' options is not saved! => must: '" + sTTInputPath + "' is: '" + sTyp +"'"
                        endif
                    end if
                   ' reset to default
                   ' compute path's that were changed in TestStartUp (work and temp)
                   if ((Right(lsPaths(1,i),5)="work"+gPathSigne) OR (Right(lsPaths(1,i),4)="work")) then
                       Pfad.SetText(lsPaths(1,i))
                       Auswaehlen.Click
                   else
                        OeffnenDlg.Cancel
                        kontext "tabpfade"
                        if Standard.IsEnabled then
                            Standard.Click
                        else
                            warnlog "Can't reset to standard"
                        endif
                   endif
                end if
            case 2:
                kontext "PfadeAuswaehlen"
                if PfadeAuswaehlen.exists (5) then
                    try
                        iPaths = Pfade.GetItemCount
                    catch
                        printlog "failed"
                        iPaths=0
                    endcatch
                    for j=1 to iPaths 
                        if (lsPaths(j,i) <> Pfade.GetItemtext(j)) then
                            Warnlog "'" + lsPathOptions(i) + "': " + j + ". options is not saved! Path found: '" + Pfade.GetItemtext(j) + "'; expected: '" + lsPaths(j,i) +"'"
                        endif
                    next j
                    PfadeAuswaehlen.Cancel
                end if
                ' reset to default
                kontext "tabpfade"
                if Standard.IsEnabled then
                    Standard.Click
                else
                    warnlog "Can't reset to standard"
                endif
            case else: warnlog "Unexpected kind of file open dialog"
        end select
        sleep 1
        kontext "tabpfade"
    next i
    
    printlog("Reset to default ( with default-button )")
    if gPlatgroup = "unx" then
        hToolsOptions ( "StarOffice", "General" )
    endif
    Sleep (4)
    kontext "ExtrasOptionenDlg"
    ExtrasOptionenDlg.OK()
    Sleep (4)
    printlog("Check the reset")
    ToolsOptions
    hToolsOptions ( "StarOffice", "Paths" )
    for i = 1 to iTyp
        if i <> 1 then
            Typ.TypeKeys "<Down>"
        else
            Typ.TypeKeys "<Down>"
            Typ.TypeKeys "<Home>"
        end if
        sleep(1)
        Bearbeiten.Click
        kontext
        if active.exists(5) then
        	qaerrorlog active.getText
        	active.ok
        endif
        select case lsDialtype(i)
            case 1:
                kontext "OeffnenDlg"
                if OeffnenDlg.Exists(5) then
                    sTyp = Pfad.GetSelText
                    if (sTyp <> lsPaths(1,i)) then
                        Warnlog "'" + lsPathOptions(i) + "' options is not saved! => must: '" + lsPaths(1,i) + "' is: '" + sTyp +"'"
                    endif
                    OeffnenDlg.Cancel
                end if
            case 2:
                kontext "PfadeAuswaehlen"
                if PfadeAuswaehlen.exists(5) then
                    try
                        iPaths = Pfade.GetItemCount
                    catch
                        printlog "failed"
                        iPaths = 0
                    endcatch
                    for j=1 to iPaths 
                        if (lsPaths(j,i) <> Pfade.GetItemtext(j)) then
                            Warnlog "'" + lsPathOptions(i) + "': " + j + ". options is not saved! Path found: '" + Pfade.GetItemtext(j) + "'; expected: '" + lsPaths(j,i) +"'"
                        endif
                    next j
                    PfadeAuswaehlen.Cancel
                end if
            case else: warnlog "Unexpected kind of file open dialog"
        end select
        sleep(1)
        kontext "tabpfade"
    next i
    if gPlatgroup = "unx" then
        hToolsOptions ( "StarOffice", "General" )
    endif
    Sleep (4)
    kontext "ExtrasOptionenDlg"
    ExtrasOptionenDlg.OK
    printlog("Exit/restart StarOffice")
    ExitRestartTheOffice
endcase