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 2008 by Sun Microsystems, Inc.
7 '* OpenOffice.org - a multi-platform office productivity suite
9 '* $RCSfile: options_tools.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-16 12:19:06 $
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 : tools for options tests
38 '\******************************************************************************
40 sub GetPathList ( ls1 () as String, ls2 () as String, ls3 () as String )
42 Dim lsInterim ( 50 ) as String
45 Dim bNewCreate as Boolean
46 '///routine to get the correct comparison list for path-options
47 '///+ if the list does not exist => CreatePathList
48 '///+ you can find the lists for all languages in separate files
49 '///+[TesttoolPath]\framework\options\input\paths_[LanguageCode].txt
50 ls1 (0) = 0 : ls2 (0) = 0 : ls3 (0) = 0
51 sList = gTesttoolPath + "framework\optional\input\options\paths_" + iSprache + ".txt"
52 sList = convertpath( sList )
54 if App.Dir ( sList ) = "" then
61 if bAsianLan = TRUE then
63 select case iSystemSprache
64 case 01, 33, 34, 39, 46, 49
65 ListRead ( lsInterim (), sList, "utf8" )
68 if bNewCreate = FALSE then
72 ListRead ( lsInterim (), sList, "utf8" )
76 ListRead ( lsInterim (), sList , "utf8" )
79 for i = 1 to ListCount ( lsInterim () )
80 ListAppend ( ls1 (), Left ( lsInterim (i), Instr ( lsInterim (i), ";" ) - 1 ) )
81 ListAppend ( ls2 (), Mid ( lsInterim (i), Len ( lsInterim (i) ) - 2, 1 ) )
82 ListAppend ( ls3 (), Right ( lsInterim (i), 1 ) )
87 '*******************************************************************************
91 Dim i as Integer, iNum as Integer
92 Dim sType as String, sVario as String, sList as String
93 Dim lsInterim ( 50 ) as String
94 '///create the comparison list for path-options
95 '///+[TesttoolPath]\framework\options\input\paths_[LanguageCode].txt
96 sList = ConvertPath ( gTesttoolPath + "framework\optional\input\options\paths_" + iSprache + ".txt" )
99 hToolsOptions ( "StarOffice", "Paths" )
101 for i=1 to Typ.GetItemCount
106 Typ.TypeKeys "<Down>"
107 Typ.TypeKeys "<Home>"
109 Typ.TypeKeys "<Down>"
112 sType = Typ.GetSelText
114 if Bearbeiten.IsEnabled then
119 if OeffnenDlg.Exists then
125 Kontext "PfadeAuswaehlen"
126 if PfadeAuswaehlen.Exists then
128 iNum = Pfade.GetItemCount
129 PfadeAuswaehlen.Cancel
137 ListAppend ( lsInterim(), sType + ";" + sVario + ";" + iNum )
140 if bAsianLan = FALSE then
141 Warnlog "The file for comparison does not exists. The file will be written!"
142 Warnlog "Please check : " + sList
143 ListWrite ( lsInterim(), sList )
145 Warnlog "The file for comparison does not exists. The file will be written!"
146 Warnlog "Please check : " + sList
147 ListWrite ( lsInterim(), sList, "utf8" )
152 '*******************************************************************************
154 function URLGraphicCheck ( bRelativ as Boolean, sFile as String )
156 Dim sGraphicPath, sTestString, sDummy as String
157 Dim lsFile ( 200 ) as String
159 '///check if the pathname of a linked file is relative or not ( only for func_LoadSaveGeneral_2 )
160 sGraphicPath = ( "/share/gallery/photos/desert1.jpg" )
161 ListRead ( lsFile(), sFile )
163 for i=1 to ListCount ( lsFile() )
165 if Instr( lsFile(i), "IMG SRC" ) <> 0 then
166 sTestString = lsFile(i)
172 if bRelativ = TRUE then
174 if Instr( sTestString, "../.." ) = 0 then
175 Warnlog "Bug => The path is not relativ!"
178 if Instr( sTestString, "file:///" ) <> 0 then
179 Warnlog "Bug => The relativ path contains 'file:///'"
183 if Instr( sTestString, "file:///" ) = 0 then
184 Warnlog "Bug => The path is relativ!"
187 if Instr( sTestString, "../.." ) <> 0 then
188 Warnlog "Bug => The nonrelativ path ( file:/// ) is not correct. It contains '../..'!"
193 if Instr( sTestString, sGraphicPath ) = 0 then
194 Warnlog "Wrong path to file, the graphic-part in filename is not correct!"
199 '*******************************************************************************
201 sub DialogTestForViewOptions
206 active.SetPage TabEinzuegeUndAbstaende
207 Active.SetPage TabAusrichtungAbsatz
208 active.SetPage TabTextfluss
211 active.SetPage TabAsianTypography
215 active.SetPage TabNumerierungAbsatz
216 active.SetPage TabTabulator
217 active.SetPage TabInitialen
218 active.SetPage TabUmrandung
219 active.SetPage TabHintergrund
221 kontext "TabHintergrund"
225 Kontext "FindAndReplace"
230 '*******************************************************************************
234 '///test with 3D-objects when 3D-options are changed ( view page )
235 gApplication = "IMPRESS"
240 Kontext "Documentimpress"
241 DocumentImpress.MouseDown 50, 50
242 DocumentImpress.MouseMove 30, 60
243 DocumentImpress.MouseUp 30, 60
245 call hCloseDocument()
246 gApplication = "WRITER"
250 '*******************************************************************************
252 sub DeleteColor( cColorName as String )
253 'Deletes a color by name. The color is selected in the listbox
254 'and should - if it exists - be visible in the entryfield above the list.
255 'If this is not the case the color probably not exists and thus
257 'Remember i18n, only use this sub for colors you created yourself!
258 dim iItems as Integer 'Number of listed colors
259 dim i as Integer 'counter
260 dim bExists as Boolean 'TRUE if color has been successfully deleted
261 dim iPos as Integer 'Position of the deleted color
264 printlog "DeleteColor:: - Trying to delete color: '" + cColorName + "'"
267 iItems = Farbe.getItemCount
269 while ((i<iItems) AND (NOT bExists))
270 sColor = Farbe.getItemText(i+1)
271 if (sColor = cColorName) then
274 if Active.Exists then
275 printlog active.getText
278 qaErrorlog "No warning about deleting the color."
280 printlog " - successfully deleted color @ " + (i+1) + "/" + iItems
285 ' if FarbName.getText = cColorName then
290 'The userdefined colors usually are appended to the list. If they are
291 'somewhere else this might be a bug.
292 if iItems <> iPos then
293 warnlog " The color was not located at the end of the list."
294 printlog " The Order of the list might be corrupted"
297 'Inform that the color did not exist. This usually is perfectly ok.
298 printlog " (The color was not deleted, it was not found)"
302 '*******************************************************************************
304 sub modifyColorRGB_PGUP( iColor as Integer )
305 'The current color's values are set to maximum (255) for RGB
306 printlog( "modifyColorRGB_PGUP:: - change the color by pressing PAGE UP in RGB listboxes." )
310 R.TypeKeys("<PageUp>")
311 G.TypeKeys("<PageUp>")
312 B.TypeKeys("<PageUp>")
313 printlog("modifyColorRGB_PGUP:: Press 'modify'")
318 '*******************************************************************************
320 sub createNewColor( aColor() as String )
321 ' INPUT : array: (1): Name; (2): Red value; (3): Green value; (4): Blue value
323 'The desired color is selected by name and created.
324 'If it already exists, there is a problem
325 printlog( "createNewColor:: Adding a color to the list: '" + aColor(1) + "'"
327 FarbName.setText(aColor(1))
335 Kontext "DuplicateNameWarning"
336 if DuplicateNameWarning.Exists then
337 warnlog "createNewColor:: Color already exists."
338 DuplicateNameWarning.OK
340 if NameDlg.Exists then
341 printlog "createNewColor:: Naming dialog shown. Good, cancelling"
344 warnlog "createNewColor:: Naming dialog didn't came up."
347 printlog "createNewColor:: New color has been created"
351 '*******************************************************************************
353 sub getColorRGB( aColor() as String )
354 ' INPUT : array with index 1-4 that will get deleted
355 ' OUTPUT: array: (1): Name; (2): Red value; (3): Green value; (4): Blue value
356 'A RGB color always has four attributes:
357 'The name and the three RGB values (0...255)
358 printlog( "GetColorRGB:: Determining the current color" )
361 aColor(1) = FarbName.GetText()
362 aColor(2) = R.GetText()
363 aColor(3) = G.GetText()
364 aColor(4) = B.GetText()
366 printlog( "GetColorRGB:: N = " & aColor(1) )
367 printlog( "GetColorRGB:: R = " & aColor(2) )
368 printlog( "GetColorRGB:: G = " & aColor(3) )
369 printlog( "GetColorRGB:: B = " & aColor(4) )
372 '*******************************************************************************
374 sub compareTwoColorsRGB( aColor() as String )
375 ' INPUT : array: (1): Name; (2): Red value; (3): Green value; (4): Blue value
376 ' and a selected color
378 'Comparision of two colors. Tested values are:
379 'Name and three RGB values
380 'aColor is the expected value, bColor is the current color
382 dim bColor(4) as String
384 printlog( "compareTwoColorsRGB:: Compare saved default color with the current" )
385 call getColorRGB(bColor())
387 if aColor(i) <> bColor(i) then
388 warnlog( "compareTwoColorsRGB:: " & "(" & i & ") Expected: '" _
389 & aColor( i ) & "' found: '" & bColor(i) & "'" )
391 printlog( "compareTwoColorsRGB:: " & "(" & i & ") OK" )
396 '*******************************************************************************
398 sub ModifyColorRGB( aColor() as String )
399 'A RGB color always has four attributes:
400 'The name and the three RGB values (0...255)
403 FarbName.SetText( aColor( 1 ) )
404 FarbModell.Select( 1 )
405 R.SetText( aColor( 2 ) )
406 G.SetText( aColor( 3 ) )
407 B.SetText( aColor( 4 ) )