jl165 merging heads
[LibreOffice.git] / testautomation / framework / optional / includes / options_ooo_paths.inc
blob85c797665a1e50e8d7796bbdf567df5e32740627
1 'encoding UTF-8  Do not remove or change this line!
2 '**************************************************************************
3 ' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 ' Copyright 2000, 2010 Oracle and/or its affiliates.
7 ' OpenOffice.org - a multi-platform office productivity suite
9 ' This file is part of OpenOffice.org.
11 ' OpenOffice.org is free software: you can redistribute it and/or modify
12 ' it under the terms of the GNU Lesser General Public License version 3
13 ' only, as published by the Free Software Foundation.
15 ' OpenOffice.org is distributed in the hope that it will be useful,
16 ' but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 ' GNU Lesser General Public License version 3 for more details
19 ' (a copy is included in the LICENSE file that accompanied this code).
21 ' You should have received a copy of the GNU Lesser General Public License
22 ' version 3 along with OpenOffice.org.  If not, see
23 ' <http://www.openoffice.org/license.html>
24 ' for a copy of the LGPLv3 License.
26 '/************************************************************************
28 '* owner : thorsten.bosbach@oracle.com
30 '* short description : Options - StarOffice - path settings
32 '\******************************************************************************
35 testcase tOOoPaths
36     Dim lsPathOptions(50) as String
37     Dim lsDialtype(50) as String
38     Dim lsPaths(10,50) as String
39     Dim lsEntry(50) as String
40     Dim i, j, a as Integer
41     Dim sTTInputPath as String
42     dim iTypeOfDialog as integer
43     dim sTyp as string
44     dim iPaths as integer
45     dim iTyp as integer
46     dim iCountOfDialogs(3) as integer
47     dim aPath() as string
48     dim i68646 as boolean
50     i68646 = FALSE
51     sTTInputPath = ConvertPath ( gOfficePath + "user\work" )
52     '                  Name;         which open dialog; Count of Paths
53 '    call GetPathList ( lsPathOptions (), lsDialtype (), lsEntry () )
54     ' which open dialog: 1: File Open; Else (2): Paths dialog
55     'call DumpPathList( lsPathOptions (), lsDialtype (), lsEntry () )
57     ToolsOptions
58     hToolsOptions("StarOffice", "Paths")
60     'reset everything to default; changes made in master.inc are undone for this test.
61     Typ.TypeKeys("<down><HOME>")
62     iTyp = Typ.getItemCount
63     if iTyp <> 8 then
64         warnlog "Unexpected count of File Types: should: " + 8 + "; is: " + iTyp
65     else
66         printlog "Count of Path Types: " + iTyp
67     endif
68     for i = 1 to iTyp
69         try
70             standard.click
71         catch
72             qaerrorlog "Unexpected: No Standard"
73         endcatch
74         Typ.TypeKeys( "<DOWN>" )
75     next i
77     printlog("save settings")
78     for i = 1 to iTyp
79         if i <> 1 then
80             Typ.TypeKeys "<Down>"
81         else
82             Typ.TypeKeys "<Down>"
83             Typ.TypeKeys "<Home>"
84         endif
85         sleep 1
86         sTyp = Typ.getText
87         aPath() = split(Typ.getItemText(i,2),";")
88         lsPathOptions(i) = sTyp
90         Bearbeiten.Click
91         kontext
92         if active.exists(5) then
93             qaerrorlog "Active: " + active.getText
94             active.ok
95         endif
96             kontext "OeffnenDlg"
97             if OeffnenDlg.Exists(5) then
98                 iTypeOfDialog = 1
99                 inc(iCountOfDialogs(1))
100             else
101                 kontext "PfadeAuswaehlen"
102                 if PfadeAuswaehlen.Exists(5) then
103                     iTypeOfDialog = 2
104                     inc(iCountOfDialogs(2))
105                 else
106                     ' EXIT CONDITION
107                     warnlog "No kind of File Dialog is open - exiting test"
108                     iTypeOfDialog = 0
109                     goto endsub
110                 endif
111             endif
113             lsDialtype(i) = iTypeOfDialog
114             select case iTypeOfDialog
115                 case 1:' printlog( " - Dialogtype: FileOpen" )
116                     kontext "OeffnenDlg"
117                     if OeffnenDlg.Exists(2) then
118                         lsPaths(1,i) = Pfad.GetSelText
119                         ' change Path
120                         Pfad.SetText sTTInputPath
121                         try
122                             Auswaehlen.Click
123                         catch
124                             qaErrorlog "Catch -1-?"
125                             OeffnenDlg.typekeys("<MOD+S>")
126                         endcatch
127                         printlog "" + i + "/1: " + right(lsPaths(1,i),10) + " : " + sTyp + " " + lsPaths(1,i)
128                     else
129                         warnlog "No Path dialog available"
130                     end if
131                 case 2:' printlog( " - Dialogtype: PathDialog" )
132                     kontext "PfadeAuswaehlen"
133                     if PfadeAuswaehlen.Exists(2) then
134                         try
135                             iPaths = Pfade.GetItemCount
136                         catch
137                             qaErrorLog "#i68646# Path Multilistbox is invisible to TestTool application"
138                             i68646 = TRUE
139                             iPaths=0
140                         endcatch
141                         lsEntry(i) = iPaths
142                         if NOT i68646 then
143                         if (2 <> iPaths) then
144                             warnlog "Unexpected count of paths; Should: " + 2 + "; Is: " + iPaths
145                         endif
146                         endif
147                         for j=1 to iPaths
148                             lsPaths(j,i) = Pfade.GetItemtext(j)
149                         next j
150                         Hinzufuegen.Click
151                         kontext "OeffnenDlg"
152                         if OeffnenDlg.exists(5) then
153                             Pfad.SetText sTTInputPath
154                             lsPaths(iPaths+1,i) = sTTInputPath
155                             Sleep (1)
156                             try
157                                 Auswaehlen.Click
158                             catch
159                                 OeffnenDlg.typekeys( "<MOD+S>" )
160                             endcatch
161                             kontext
162                             if active.exists(5) then
163                                 qaErrorLog "Active about already existsing path?: '" + active.getText + "' + '" + sTTInputPath + "'"
164                                 active.OK
165                             endif
166                         else
167                             warnlog "No Path dialog available"
168                         endif
169                         kontext "PfadeAusWaehlen"
170                         PfadeAuswaehlen.OK
171                         printlog "" + i + "/"+iPaths+": " + right(lsPaths(1,i),10) + " : " + sTyp
172                         printlog "" + i + "/-: " + right(lsPaths(2,i),10) + " : " + sTyp
173                     else
174                         warnlog "No Path dialog available"
175                     endif
176                 case else: warnlog "Unexpected kind of Path dialog available"
177             end select
178             Sleep(1)
179             ' double cross check of Paths in both dialogs
180             if (uBound(aPath()) <> (iTypeOfDialog-1)) then
181                 qaErrorLog ("Sanity check failed.")
182             endif
183         kontext "tabpfade"
184     next i
185     printlog "Path changed to, or added: '" + sTTInputPath + "'"
186     
187     'Check if count of kinds of dialogs match
188     if iCountOfDialogs(1) <> 4 then
189         warnlog "Unexpected count of File Open Dialogs: should: " + 4 + "; is: " + iCountOfDialogs(1)
190     else
191         printlog "Count of File Open Dialogs: " + iCountOfDialogs(1)
192     endif
193     if iCountOfDialogs(2) <> 4 then
194         warnlog "Unexpected count of File Open Dialogs: should: " + 4 + "; is: " + iCountOfDialogs(2)
195     else
196         printlog "Count of File Open Dialogs: " + iCountOfDialogs(2)
197     endif
198     
199     kontext "ExtrasOptionenDlg"
200     ExtrasOptionenDlg.OK
201     Sleep (4)
202     printlog("Exit/restart StarOffice")
203     ExitRestartTheOffice
204     printlog( "Check changes")
205     ToolsOptions
206     hToolsOptions ( "StarOffice", "Paths" )
208     for i = 1 to iTyp
209         ' It's a treelistbox with multiselection;
210         ' .select would select an additional item :-(
211         ' a lonely <home> wouldn't change the selction :-<
212         if i <> 1 then
213             Typ.typeKeys("<down>")
214         else
215             Typ.typeKeys("<down>")
216             Typ.typeKeys("<Home>")
217         endif
218         sleep(1)
220         try
221             Bearbeiten.Click
222         catch
223             warnlog "Multiselection ?"
224         endcatch
225         kontext
226         if active.exists(5) then
227             warnlog "#i72017# '"+active.getText+"'"
228             active.ok
229         endif
230         select case lsDialtype(i)
231             case 1:
232                 kontext "OeffnenDlg"
233                 if OeffnenDlg.Exists(5) then
234                     sTyp = Pfad.GetSelText
235                     if (sTyp <> sTTInputPath) then
236                         if (sTyp <> ( sTTInputPath + gPathSigne)) then
237                             Warnlog "'" + lsPathOptions(i) + "' options is not saved! => must: '" + sTTInputPath + "' is: '" + sTyp +"'"
238                         endif
239                     end if
240                    ' reset to default
241                    ' compute path's that were changed in TestStartUp (work and temp)
242                    if ((Right(lsPaths(1,i),5)="work"+gPathSigne) OR (Right(lsPaths(1,i),4)="work")) then
243                        Pfad.SetText(lsPaths(1,i))
244                        Auswaehlen.Click
245                    else
246                         OeffnenDlg.Cancel
247                         kontext "tabpfade"
248                         if Standard.IsEnabled then
249                             Standard.Click
250                         else
251                             warnlog "Can't reset to standard"
252                         endif
253                    endif
254                 end if
255             case 2:
256                 kontext "PfadeAuswaehlen"
257                 if PfadeAuswaehlen.exists (5) then
258                     try
259                         iPaths = Pfade.GetItemCount
260                     catch
261                         printlog "failed"
262                         iPaths=0
263                     endcatch
264                     for j=1 to iPaths 
265                         if (lsPaths(j,i) <> Pfade.GetItemtext(j)) then
266                             Warnlog "'" + lsPathOptions(i) + "': " + j + ". options is not saved! Path found: '" + Pfade.GetItemtext(j) + "'; expected: '" + lsPaths(j,i) +"'"
267                         endif
268                     next j
269                     PfadeAuswaehlen.Cancel
270                 end if
271                 ' reset to default
272                 kontext "tabpfade"
273                 if Standard.IsEnabled then
274                     Standard.Click
275                 else
276                     warnlog "Can't reset to standard"
277                 endif
278             case else: warnlog "Unexpected kind of file open dialog"
279         end select
280         sleep 1
281         kontext "tabpfade"
282     next i
283     
284     printlog("Reset to default ( with default-button )")
285     if gPlatgroup = "unx" then
286         hToolsOptions ( "StarOffice", "General" )
287     endif
288     Sleep (4)
289     kontext "ExtrasOptionenDlg"
290     ExtrasOptionenDlg.OK()
291     Sleep (4)
292     printlog("Check the reset")
293     ToolsOptions
294     hToolsOptions ( "StarOffice", "Paths" )
295     for i = 1 to iTyp
296         if i <> 1 then
297             Typ.TypeKeys "<Down>"
298         else
299             Typ.TypeKeys "<Down>"
300             Typ.TypeKeys "<Home>"
301         end if
302         sleep(1)
303         Bearbeiten.Click
304         kontext
305         if active.exists(5) then
306                 qaerrorlog active.getText
307                 active.ok
308         endif
309         select case lsDialtype(i)
310             case 1:
311                 kontext "OeffnenDlg"
312                 if OeffnenDlg.Exists(5) then
313                     sTyp = Pfad.GetSelText
314                     if (sTyp <> lsPaths(1,i)) then
315                         Warnlog "'" + lsPathOptions(i) + "' options is not saved! => must: '" + lsPaths(1,i) + "' is: '" + sTyp +"'"
316                     endif
317                     OeffnenDlg.Cancel
318                 end if
319             case 2:
320                 kontext "PfadeAuswaehlen"
321                 if PfadeAuswaehlen.exists(5) then
322                     try
323                         iPaths = Pfade.GetItemCount
324                     catch
325                         printlog "failed"
326                         iPaths = 0
327                     endcatch
328                     for j=1 to iPaths 
329                         if (lsPaths(j,i) <> Pfade.GetItemtext(j)) then
330                             Warnlog "'" + lsPathOptions(i) + "': " + j + ". options is not saved! Path found: '" + Pfade.GetItemtext(j) + "'; expected: '" + lsPaths(j,i) +"'"
331                         endif
332                     next j
333                     PfadeAuswaehlen.Cancel
334                 end if
335             case else: warnlog "Unexpected kind of file open dialog"
336         end select
337         sleep(1)
338         kontext "tabpfade"
339     next i
340     if gPlatgroup = "unx" then
341         hToolsOptions ( "StarOffice", "General" )
342     endif
343     Sleep (4)
344     kontext "ExtrasOptionenDlg"
345     ExtrasOptionenDlg.OK
346     printlog("Exit/restart StarOffice")
347     ExitRestartTheOffice
348 endcase