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
204 '///Dialog test for view options
207 active.SetPage TabEinzuegeUndAbstaende
208 Active.SetPage TabAusrichtungAbsatz
209 active.SetPage TabTextfluss
212 active.SetPage TabAsianTypography
216 active.SetPage TabNumerierungAbsatz
217 active.SetPage TabTabulator
218 active.SetPage TabInitialen
219 active.SetPage TabUmrandung
220 active.SetPage TabHintergrund
222 kontext "TabHintergrund"
226 Kontext "FindAndReplace"
231 '*******************************************************************************
233 sub DialogTextForViewOptions_move
235 Dim xPos, yPos, xSize, ySize
236 '///Dialog test for view options
238 Kontext "NavigatorWriter"
240 if Not NavigatorWriter.Exists then
245 xPos = Navigator.GetPosX
246 yPos = Navigator.GetPosY
247 xSize = Navigator.GetSizeX
248 ySize = Navigator.GetSizeY
249 Navigator.Move 10, 10
251 Navigator.Move 50, 50
253 Navigator.Size 200, 150
255 Navigator.Size 150, 80
257 Navigator.Size xSize, ySize
259 Navigator.Move xPos, yPos
265 '*******************************************************************************
267 sub MouseTestForViewOptions
269 '///mouse test for view options
271 Kontext "DocumentWriter"
272 DocumentWriter.MouseMove( 50, 50 )
273 DocumentWriter.OpenContextMenu()
276 Kontext "DocumentWriter"
277 DocumentWriter.MouseMove 50, 70
282 '*******************************************************************************
286 '///test with 3D-objects when 3D-options are changed ( view page )
287 gApplication = "IMPRESS"
292 Kontext "Documentimpress"
293 DocumentImpress.MouseDown 50, 50
294 DocumentImpress.MouseMove 30, 60
295 DocumentImpress.MouseUp 30, 60
297 call hCloseDocument()
298 gApplication = "WRITER"
302 '*******************************************************************************
305 ' this sub resets the autosave feature to 15 minutes with confirmation and
306 ' disables the feature entirely afterwards.
307 printlog( " * Resetting autosave feature to defaults" )
309 hToolsOptions( "LoadSave" , "General" )
310 AutomatischSpeichern.check
311 Minuten.setText( "15" )
312 AutomatischSpeichern.unCheck
314 Kontext "ExtrasOptionenDlg"
318 '*******************************************************************************
320 sub DeleteColor( cColorName as String )
321 'Deletes a color by name. The color is selected in the listbox
322 'and should - if it exists - be visible in the entryfield above the list.
323 'If this is not the case the color probably not exists and thus
325 'Remember i18n, only use this sub for colors you created yourself!
326 dim iItems as Integer 'Number of listed colors
327 dim i as Integer 'counter
328 dim bExists as Boolean 'TRUE if color has been successfully deleted
329 dim iPos as Integer 'Position of the deleted color
332 printlog "DeleteColor:: - Trying to delete color: '" + cColorName + "'"
335 iItems = Farbe.getItemCount
337 while ((i<iItems) AND (NOT bExists))
338 sColor = Farbe.getItemText(i+1)
339 if (sColor = cColorName) then
342 if Active.Exists then
343 printlog active.getText
346 qaErrorlog "No warning about deleting the color."
348 printlog " - successfully deleted color @ " + (i+1) + "/" + iItems
353 ' if FarbName.getText = cColorName then
358 'The userdefined colors usually are appended to the list. If they are
359 'somewhere else this might be a bug.
360 if iItems <> iPos then
361 warnlog " The color was not located at the end of the list."
362 printlog " The Order of the list might be corrupted"
365 'Inform that the color did not exist. This usually is perfectly ok.
366 printlog " (The color was not deleted, it was not found)"
370 '*******************************************************************************
372 sub modifyColorRGB_PGUP( iColor as Integer )
373 'The current color's values are set to maximum (255) for RGB
374 printlog( "modifyColorRGB_PGUP:: - change the color by pressing PAGE UP in RGB listboxes." )
378 R.TypeKeys("<PageUp>")
379 G.TypeKeys("<PageUp>")
380 B.TypeKeys("<PageUp>")
381 printlog("modifyColorRGB_PGUP:: Press 'modify'")
386 '*******************************************************************************
388 sub createNewColor( aColor() as String )
389 ' INPUT : array: (1): Name; (2): Red value; (3): Green value; (4): Blue value
391 'The desired color is selected by name and created.
392 'If it already exists, there is a problem
393 printlog( "createNewColor:: Adding a color to the list: '" + aColor(1) + "'"
395 FarbName.setText(aColor(1))
403 Kontext "DuplicateNameWarning"
404 if DuplicateNameWarning.Exists then
405 warnlog "createNewColor:: Color already exists."
406 DuplicateNameWarning.OK
408 if NameDlg.Exists then
409 printlog "createNewColor:: Naming dialog shown. Good, cancelling"
412 warnlog "createNewColor:: Naming dialog didn't came up."
415 printlog "createNewColor:: New color has been created"
419 '*******************************************************************************
421 sub getColorRGB( aColor() as String )
422 ' INPUT : array with index 1-4 that will get deleted
423 ' OUTPUT: array: (1): Name; (2): Red value; (3): Green value; (4): Blue value
424 'A RGB color always has four attributes:
425 'The name and the three RGB values (0...255)
426 printlog( "GetColorRGB:: Determining the current color" )
429 aColor(1) = FarbName.GetText()
430 aColor(2) = R.GetText()
431 aColor(3) = G.GetText()
432 aColor(4) = B.GetText()
434 printlog( "GetColorRGB:: N = " & aColor(1) )
435 printlog( "GetColorRGB:: R = " & aColor(2) )
436 printlog( "GetColorRGB:: G = " & aColor(3) )
437 printlog( "GetColorRGB:: B = " & aColor(4) )
440 '*******************************************************************************
442 sub compareTwoColorsRGB( aColor() as String )
443 ' INPUT : array: (1): Name; (2): Red value; (3): Green value; (4): Blue value
444 ' and a selected color
446 'Comparision of two colors. Tested values are:
447 'Name and three RGB values
448 'aColor is the expected value, bColor is the current color
450 dim bColor(4) as String
452 printlog( "compareTwoColorsRGB:: Compare saved default color with the current" )
453 call getColorRGB(bColor())
455 if aColor(i) <> bColor(i) then
456 warnlog( "compareTwoColorsRGB:: " & "(" & i & ") Expected: '" _
457 & aColor( i ) & "' found: '" & bColor(i) & "'" )
459 printlog( "compareTwoColorsRGB:: " & "(" & i & ") OK" )
464 '*******************************************************************************
466 sub ModifyColorRGB( aColor() as String )
467 'A RGB color always has four attributes:
468 'The name and the three RGB values (0...255)
471 FarbName.SetText( aColor( 1 ) )
472 FarbModell.Select( 1 )
473 R.SetText( aColor( 2 ) )
474 G.SetText( aColor( 3 ) )
475 B.SetText( aColor( 4 ) )