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