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 : tools for options tests
32 '\******************************************************************************
34 sub GetPathList ( ls1 () as String, ls2 () as String, ls3 () as String )
36 Dim lsInterim ( 50 ) as String
39 Dim bNewCreate as Boolean
40 '///routine to get the correct comparison list for path-options
41 '///+ if the list does not exist => CreatePathList
42 '///+ you can find the lists for all languages in separate files
43 '///+[TesttoolPath]\framework\options\input\paths_[LanguageCode].txt
44 ls1 (0) = 0 : ls2 (0) = 0 : ls3 (0) = 0
45 sList = gTesttoolPath + "framework\optional\input\options\paths_" + iSprache + ".txt"
46 sList = convertpath( sList )
48 if App.Dir ( sList ) = "" then
55 if bAsianLan = TRUE then
57 select case iSystemSprache
58 case 01, 33, 34, 39, 46, 49
59 ListRead ( lsInterim (), sList, "utf8" )
62 if bNewCreate = FALSE then
66 ListRead ( lsInterim (), sList, "utf8" )
70 ListRead ( lsInterim (), sList , "utf8" )
73 for i = 1 to ListCount ( lsInterim () )
74 ListAppend ( ls1 (), Left ( lsInterim (i), Instr ( lsInterim (i), ";" ) - 1 ) )
75 ListAppend ( ls2 (), Mid ( lsInterim (i), Len ( lsInterim (i) ) - 2, 1 ) )
76 ListAppend ( ls3 (), Right ( lsInterim (i), 1 ) )
81 '*******************************************************************************
85 Dim i as Integer, iNum as Integer
86 Dim sType as String, sVario as String, sList as String
87 Dim lsInterim ( 50 ) as String
88 '///create the comparison list for path-options
89 '///+[TesttoolPath]\framework\options\input\paths_[LanguageCode].txt
90 sList = ConvertPath ( gTesttoolPath + "framework\optional\input\options\paths_" + iSprache + ".txt" )
93 hToolsOptions ( "StarOffice", "Paths" )
95 for i=1 to Typ.GetItemCount
100 Typ.TypeKeys "<Down>"
101 Typ.TypeKeys "<Home>"
103 Typ.TypeKeys "<Down>"
106 sType = Typ.GetSelText
108 if Bearbeiten.IsEnabled then
113 if OeffnenDlg.Exists then
119 Kontext "PfadeAuswaehlen"
120 if PfadeAuswaehlen.Exists then
122 iNum = Pfade.GetItemCount
123 PfadeAuswaehlen.Cancel
131 ListAppend ( lsInterim(), sType + ";" + sVario + ";" + iNum )
134 if bAsianLan = FALSE then
135 Warnlog "The file for comparison does not exists. The file will be written!"
136 Warnlog "Please check : " + sList
137 ListWrite ( lsInterim(), sList )
139 Warnlog "The file for comparison does not exists. The file will be written!"
140 Warnlog "Please check : " + sList
141 ListWrite ( lsInterim(), sList, "utf8" )
146 '*******************************************************************************
150 '///test with 3D-objects when 3D-options are changed ( view page )
151 gApplication = "IMPRESS"
156 Kontext "Documentimpress"
157 DocumentImpress.MouseDown 50, 50
158 DocumentImpress.MouseMove 30, 60
159 DocumentImpress.MouseUp 30, 60
161 call hCloseDocument()
162 gApplication = "WRITER"
166 '*******************************************************************************
168 sub DeleteColor( cColorName as String )
169 'Deletes a color by name. The color is selected in the listbox
170 'and should - if it exists - be visible in the entryfield above the list.
171 'If this is not the case the color probably not exists and thus
173 'Remember i18n, only use this sub for colors you created yourself!
174 dim iItems as Integer 'Number of listed colors
175 dim i as Integer 'counter
176 dim bExists as Boolean 'TRUE if color has been successfully deleted
177 dim iPos as Integer 'Position of the deleted color
180 printlog "DeleteColor:: - Trying to delete color: '" + cColorName + "'"
183 iItems = Farbe.getItemCount
185 while ((i<iItems) AND (NOT bExists))
186 sColor = Farbe.getItemText(i+1)
187 if (sColor = cColorName) then
190 if Active.Exists then
191 printlog active.getText
194 qaErrorlog "No warning about deleting the color."
196 printlog " - successfully deleted color @ " + (i+1) + "/" + iItems
201 ' if FarbName.getText = cColorName then
206 'The userdefined colors usually are appended to the list. If they are
207 'somewhere else this might be a bug.
208 if iItems <> iPos then
209 warnlog " The color was not located at the end of the list."
210 printlog " The Order of the list might be corrupted"
213 'Inform that the color did not exist. This usually is perfectly ok.
214 printlog " (The color was not deleted, it was not found)"
218 '*******************************************************************************
220 sub modifyColorRGB_PGUP( iColor as Integer )
221 'The current color's values are set to maximum (255) for RGB
222 printlog( "modifyColorRGB_PGUP:: - change the color by pressing PAGE UP in RGB listboxes." )
226 R.TypeKeys("<PageUp>")
227 G.TypeKeys("<PageUp>")
228 B.TypeKeys("<PageUp>")
229 printlog("modifyColorRGB_PGUP:: Press 'modify'")
234 '*******************************************************************************
236 sub createNewColor( aColor() as String )
237 ' INPUT : array: (1): Name; (2): Red value; (3): Green value; (4): Blue value
239 'The desired color is selected by name and created.
240 'If it already exists, there is a problem
241 printlog( "createNewColor:: Adding a color to the list: '" + aColor(1) + "'"
243 FarbName.setText(aColor(1))
251 Kontext "DuplicateNameWarning"
252 if DuplicateNameWarning.Exists then
253 warnlog "createNewColor:: Color already exists."
254 DuplicateNameWarning.OK
256 if NameDlg.Exists then
257 printlog "createNewColor:: Naming dialog shown. Good, cancelling"
260 warnlog "createNewColor:: Naming dialog didn't came up."
263 printlog "createNewColor:: New color has been created"
267 '*******************************************************************************
269 sub getColorRGB( aColor() as String )
270 ' INPUT : array with index 1-4 that will get deleted
271 ' OUTPUT: array: (1): Name; (2): Red value; (3): Green value; (4): Blue value
272 'A RGB color always has four attributes:
273 'The name and the three RGB values (0...255)
274 printlog( "GetColorRGB:: Determining the current color" )
277 aColor(1) = FarbName.GetText()
278 aColor(2) = R.GetText()
279 aColor(3) = G.GetText()
280 aColor(4) = B.GetText()
282 printlog( "GetColorRGB:: N = " & aColor(1) )
283 printlog( "GetColorRGB:: R = " & aColor(2) )
284 printlog( "GetColorRGB:: G = " & aColor(3) )
285 printlog( "GetColorRGB:: B = " & aColor(4) )
288 '*******************************************************************************
290 sub compareTwoColorsRGB( aColor() as String )
291 ' INPUT : array: (1): Name; (2): Red value; (3): Green value; (4): Blue value
292 ' and a selected color
294 'Comparision of two colors. Tested values are:
295 'Name and three RGB values
296 'aColor is the expected value, bColor is the current color
298 dim bColor(4) as String
300 printlog( "compareTwoColorsRGB:: Compare saved default color with the current" )
301 call getColorRGB(bColor())
303 if aColor(i) <> bColor(i) then
304 warnlog( "compareTwoColorsRGB:: " & "(" & i & ") Expected: '" _
305 & aColor( i ) & "' found: '" & bColor(i) & "'" )
307 printlog( "compareTwoColorsRGB:: " & "(" & i & ") OK" )
312 '*******************************************************************************
314 sub ModifyColorRGB( aColor() as String )
315 'A RGB color always has four attributes:
316 'The name and the three RGB values (0...255)
319 FarbName.SetText( aColor( 1 ) )
320 FarbModell.Select( 1 )
321 R.SetText( aColor( 2 ) )
322 G.SetText( aColor( 3 ) )
323 B.SetText( aColor( 4 ) )