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: printer_administration.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-16 12:19:03 $
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 : joerg.skottke@sun.com
36 '* short description : updatetest for the printer configuration
38 '\******************************************************************************
40 testcase t_updt_spadmin
42 '///<h1>Update test for the SpAdmin printer configuration tool</h1>
45 '///+<li>Do not test on eComStation</li>
46 if ( gtSysName = "eComStation" ) then
47 printlog( "No SpAdmin for eComStation" )
51 '///+<li>Do not test on MacOS X</li>
52 if ( lcase(gPlatform) = "osx") then
53 printlog( "No SPAdmin on MacOS X" )
57 '///+<li>Do not test on Windows</li>
58 if ( gPlatGroup = "w95" ) then
59 printlog( "No SPAdmin on Windows" )
63 const CPRINTER = "tt-testprinter"
67 '///+<li>Shut down the office completely</li>
70 '///+<li>Open SpAdmin</li>
74 '///+<li>wait for the spadmin to open, on failure we end the test</li>
75 brc = hWaitForSpAdmin()
77 warnlog( "SpAdmin is not open, the test cannot continue" )
81 '///+<li>If a printer queue was left over from prior run: Delete ist</li>
82 irc = hDelPrinter( CPRINTER )
84 case 0 : printlog( "Maybe printer was left over by prior run?" )
85 case 3 : printlog( "OK, printer does not exist" )
88 '///+<li>wait for the spadmin to open, on failure we end the test</li>
89 brc = hWaitForSpAdmin()
91 warnlog( "SpAdmin is not open, the test cannot continue" )
95 '///+<li>Create a new fax device</li>
96 call TestNewPrinter( CPRINTER )
98 ' wait for the spadmin to open, on failure we end the test
99 brc = hWaitForSpAdmin()
101 warnlog( "SpAdmin is not open, the test cannot continue" )
105 '///+<li>Walk through the properties of the new fax device</li>
106 call TestProperties( CPRINTER )
108 ' wait for the spadmin to open, on failure we end the test
109 brc = hWaitForSpAdmin()
111 warnlog( "SpAdmin is not open, the test cannot continue" )
115 '///+<li>Rename the fax device</li>
116 call TestRename( CPRINTER )
118 ' wait for the spadmin to open, on failure we end the test
119 brc = hWaitForSpAdmin()
121 warnlog( "SpAdmin is not open, the test cannot continue" )
125 '///+<li>Look at the font settings</li>
126 call TestFonts( CPRINTER )
128 ' wait for the spadmin to open, on failure we end the test
129 brc = hWaitForSpAdmin()
131 warnlog( "SpAdmin is not open, the test cannot continue" )
136 '///+<li>Delete the fax device</li>
137 irc = hDelPrinter( CPRINTER )
139 warnlog( "We created a Fax printer but it could not be deleted" )
147 '*******************************************************************************
149 sub TestNewPrinter( cPrinter as string )
151 '///<h3>Update test for creation of a new device in SpAdmin</h3>
152 '///<i>Starting point: SpAdmin</i><br>
155 '///+<li>Name of the device (string)</li>
159 '///+<li>Nothing</li>
161 '///<u>Description</u>:
167 '///+<li>Click to create a new printer</li>
168 printlog( " * New Printer" )
173 '///+<li>Check to create a fax device</li>
174 printlog( " * select 'Connect a Fax Device'" )
175 Kontext "TabPWDeviceSelector"
176 call dialogtest( TabPWDeviceSelector )
179 '///+<li>Click the "Next" button</li>
180 printlog( " * next ->" )
181 Kontext "SpPrinterWizard"
185 '///+<li>Keep the default settings on this page</li>
186 printlog( " * accept the default driver (first entry)" )
187 Kontext "TabPWFaxDriverSelector"
188 call dialogtest( TabPWFaxDriverSelector )
190 '///+<li>Click the "Next" button</li>
191 printlog( " * next ->" )
192 Kontext "SpPrinterWizard"
196 '///+<li>Enter "(PHONE)" as queue</li>
197 printlog( " * enter '(PHONE)' as queue" )
198 Kontext "TabPWQueueCommand"
199 call dialogtest( TabPWQueueCommand )
200 CBCommand.setText( """(PHONE)""" )
202 '///+<li>Click the "Next" button</li>
203 printlog( " * next ->" )
204 Kontext "SpPrinterWizard"
208 '///+<li>Enter a name for the fax printer</li>
209 printlog( " * enter a name for the fax-printer" )
210 Kontext "TabPWPrinterName"
211 call dialogtest( TabPWPrinterName )
212 EFFaxName.setText( cPrinter )
215 '///+<li>Click the "Finish" button</li>
216 printlog( " * Finish" )
219 Kontext "SpPrinterWizard"
221 iWait = 4 ' leave the loop
223 printlog( "Waiting for dialog" )
225 if ( iWait = 3 ) then
226 qaerrorlog( "Could not click 'finish' on printerwizard" )
236 '*******************************************************************************
238 sub TestProperties( cPrinter as string )
240 '///<h3>Update test for the device properties in SpAdmin</h3>
241 '///<i>Starting point: SpAdmin</i><br>
244 '///+<li>Name of the printer (string)</li>
248 '///+<li>Nothing</li>
250 '///<u>Description</u>:
254 dim iPrinterPos as integer
256 '///+<li>Find the printer in the list</li>
258 iPrinterPos = hGetPrinterPosition( CPRINTER , true )
260 '///+<li>Select it</li>
261 LBPrinters.select( iPrinterPos )
263 '///+<li>Click the properties-button</li>
266 printlog( " * Properties for the new fax device" )
269 '///+<li>Command-Page</li>
271 active.setpage TabSPACommand
273 kontext "TabSPACommand"
274 printlog( " * Tab: Command" )
275 call dialogtest( TabSPACommand )
277 '///+<li>Paper-Page</li>
279 active.setpage TabSPAPaper
281 kontext "TabSPAPaper"
282 printlog( " * Tab: Paper" )
283 call dialogtest( TabSPAPaper )
285 '///+<li>Device-Page</li>
287 active.setpage TabSPADevice
289 kontext "TabSPADevice"
290 printlog( " * Tab: Device" )
291 call dialogtest( TabSPADevice )
293 '///+<li>Fontreplacement-Page</li>
295 active.setpage TabSPAFontReplacement
297 kontext "TabSPAFontReplacement"
298 printlog( " * Tab: FontReplacement" )
299 call dialogtest( TabSPAFontReplacement )
301 '///+<li>Other-Page</li>
303 active.setpage TabSPAOther
305 kontext "TabSPAOther"
306 printlog( " * Tab: Other" )
307 call dialogtest( TabSPAOther )
310 '///+<li>Cancel dialog</li>
311 printlog( " * close Properties" )
319 '*******************************************************************************
321 sub TestRename( cPrinter as string )
323 '///<h3>Update test for the rename dialog in SpAdmin</h3>
324 '///<i>Starting point: SpAdmin</i><br>
327 '///+<li>Name of the printer queue to rename (string)</li>
329 '///+<li>The named queue must exist</li>
334 '///+<li>Nothing</li>
336 '///<u>Description</u>:
340 '///+<li>Find the requested printer queue</li>
342 LBPrinters.select( hGetPrinterPosition( CPRINTER , true ) )
345 '///+<li>Click to rename the queue</li>
346 printlog( " * Open 'Rename' dialog" )
350 '///+<li>Cancel the rename dialog</li>
351 Kontext "SPRenamePrinterDLG"
352 call dialogtest( SPRenamePrinterDLG )
353 printlog( " * Close 'Rename' dialog" )
354 SPRenamePrinterDLG.cancel()
361 '*******************************************************************************
363 sub TestFonts( cPrinter as string )
365 '///<h3>Update test for SpAdmin printer font replacement</h3>
366 '///<i>Starting point: SpAdmin</i><br>
369 '///+<li>Name of the printer queue (string)</li>
371 '///+<li>The queue must exist</li>
376 '///+<li>Nothing</li>
378 '///<u>Description</u>:
381 '///+<li>Press the Fonts-button - the fonts dialog opens</li>
382 printlog( " * Open 'Fonts...' dialog" )
385 if ( PBFonts.isEnabled() ) then
389 printlog( " * Test the font-dialog" )
390 Kontext "SPFontNameDLG"
391 call dialogtest( SPFontNameDLG )
393 '///+<li>Click to add fonts - import dialog opens</li>
394 printlog( " * Press 'Add ...'" )
398 '///+<li>Cancel the font-import dialog</li>
399 printlog( " * Test the import-dialog" )
400 kontext "SPFontImportDLG"
401 call dialogtest( SPFontImportDLG )
403 printlog( " * close import dialog" )
404 SPFontImportDLG.cancel()
406 '///+<li>Close the Font-dialog with ok</li>
407 Kontext "SPFontNameDLG"
408 printlog( " * close fonts-dialog" )
412 printlog( "Fonts... not available, skipping." )