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: g_shaddow.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-16 10:42:40 $
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 : wolfram.garten@sun.com
36 '* short description : Tests the shaddow-function on a picture
38 '*******************************************************************
42 '\*******************************************************************
52 dim sFileName as string
53 dim ImageWidth as string
54 dim ImageHeight as string
55 dim shadowdistancevalue as string
56 dim shadowcolorvalue as string
57 dim shadowtransparencyvalue as string
58 dim linetype as string
59 dim linecolour as string
60 dim linewidth as string
61 dim cornerstyletype as string
63 '/// Set the file-extension we'll be using when opening the saved file ///'
64 if (gApplication = "IMPRESS") then
65 ExtensionString = "odp"
67 ExtensionString = "odg"
70 '/// Open application ///'
74 '/// Import picture ///'
75 InsertGraphicsFromFile
82 Kontext "GrafikEinfuegenDlg"
84 Dateiname.SetText (ConvertPath(gOfficeBasisPath + "share\gallery\bigapple.gif"))
87 printlog "Inserted file"
92 '/// Check values and save them ///'
95 active.SetPage TabPositionAndSize
96 kontext "TabPositionAndSize"
97 ImageWidth = Width.GetText
98 ImageHeight = Height.GetText
99 printlog "Got values from position and size"
100 '/// Check the "Protect Size"-button. And close dialogue. ///'
102 TabPositionAndSize.Ok
104 '/// Add Shaddow via Toolbar-Button ///'
105 Kontext "GraphicObjectbar"
106 if GraphicObjectbar.Exists = FALSE then
109 if schatten.GetState(2) <> 0 then '0 = not pressed. 1 = pressed.
110 warnlog "Shaddow-button shouldnt have been checked"
114 '/// click button 'Shadow' ///'
116 ' '/// Check and save Shaddow-values via context-menu ///'
120 if hMenuFindSelect(10142, true, 4) = false then
121 Warnlog "Context-Menu-entry `Area` was not found. Therefore the test ends."
125 '/// Select Contextmenu entry "Area" ///'
128 '/// Switch to Shaddow-tabpage, do some changes, save them, close dialogue
130 active.SetPage TabSchatten
131 kontext "TabSchatten"
132 if Anzeigen.isVisible(5) AND Anzeigen.Exists(5) then
133 if Anzeigen.GetState <> 1 then Warnlog "Anzeigen.GetState should be 1, but is: " + Anzeigen.GetState
136 Warnlog "'Use Shadow' doesn't exist or isn't visible."
139 '/// Change Distance and Transparency-values ///'
142 shadowdistancevalue = Entfernung.GetText
143 shadowcolorvalue = Farbe.GetSelText
144 shadowtransparencyvalue = Transparenz.GetText
145 printlog "Got values from TabArea"
148 '/// Check if it's the same when going over FormatArea ///'
152 '/// Switch to Shaddow-tabpage, do some changes, save them, close dialogue ///'
154 active.SetPage TabSchatten
155 kontext "TabSchatten"
156 if Anzeigen.isVisible(5) AND Anzeigen.Exists(5) then
157 if Anzeigen.GetState <> 1 then Warnlog "should be active"
160 Warnlog "'Use Shadow' doesn't exist or isn't visible."
162 if shadowdistancevalue <> Entfernung.GetText then
163 warnlog "Distance value changed. Should be: " + shadowdistancevalue + ". But is: " + Entfernung.gettext
165 if shadowcolorvalue <> Farbe.GetSelText then
166 warnlog "Color value changed. Should be: " + shadowcolorvalue + ". But is: " + Farbe.getSeltext
168 if shadowtransparencyvalue <> Transparenz.GetText then
169 warnlog "Transparency value changed. Should be: " + shadowtransparencyvalue + ". But is: " + Transparenz.gettext
173 '/// Add Cornerstyle via FormatLine ///'
176 Messagebox.SetPage TabLinie
178 Stil.Select 2 ' Select Continuously.
179 linetype = Stil.GetItemText
180 Farbe.Select 2 ' Select Blue
181 linecolour = Farbe.GetItemText
182 Breite.More 3 ' Set Width to 3
183 linewidth = Breite.Gettext
184 CornerStyle.Select 4 ' Select number four: Beveled
185 cornerstyletype = CornerStyle.GetSelText
186 printlog "Cornerstyle is: " + CornerStyle.GetSelText '+ cornerstyletype
189 '/// Check values via PositionAndSize via the Contextmenu ///'
192 if hMenuFindSelect(10087, true, 1) = false then
193 Warnlog "Context-Menu-entry `Position and Size` was not found. Therefore the test ends."
197 'Select "Position and Size"
200 Active.SetPage TabPositionAndSize
201 Kontext "TabPositionAndSize"
202 if ImageWidth <> Width.GetText then warnlog "Position X differs. Should be: " + ImageWidth + " But is: " + Width.GetText
203 if ImageHeight <> Height.GetText then warnlog "Position Y differs. Should be: " + ImageHeight + " But is: " + Height.GetText
204 TabPositionAndSize.OK
206 '/// Check Cornerstyle via FormatLine ///'
209 Messagebox.SetPage TabLinie
211 if linetype <> Stil.GetItemText then warnlog "Linetype should be: " + linetype + " But is: " + Stil.GetItemText
212 if linecolour <> Farbe.GetItemText then warnlog "Linecolour should be: " + linetype + " But is: " + Farbe.GetItemText
213 if linewidth <> Breite.GetText then warnlog "Linewidth should be: " + linewidth + " But is: " + Breite.GetText
214 if cornerstyletype <> CornerStyle.GetSelText then warnlog "CornerStyle should be: " + cornerstyletype + " But is: " + CornerStyle.GetSelText 'ItemText
217 '/// Check if the Shaddow-button is activated ///'
218 Kontext "GraphicObjectbar"
219 if Schatten.GetState(2) <> 1 then
220 warnlog "Shaddow-button shouldnt have been checked"
223 '/// Save the file. Then close the office and reload the file ///'
224 sFileName = ( ConvertPath(gOfficePath + "user\work\shaddow-test"))
225 '/// File-Save As with filter as: "user\temp\shaddow-test" ///'
228 Kontext "SpeichernDlg"
229 Dateiname.SetText sFileName
230 printlog "Saving with filter: " + Dateityp.GetSelText
233 if Messagebox.Exists(2) then Messagebox.Yes
234 Kontext "AlienWarning"
235 if AlienWarning.Exists(2) then AlienWarning.OK
236 printlog "Saved as: " + sFileName
238 warnlog "Error when saving file."
241 '/// Close the office-session ///'
244 if Messagebox.Exists(2) then Messagebox.Yes
246 '/// Open the saved file ///'
248 hFileOpen sFileName + "." + ExtensionString
250 printlog "opened file successfully"
252 warnlog "Error when opening file."
259 '/// Check if the Shaddow-button still is activated ///'
260 kontext "GraphicObjectbar"
261 if schatten.Getstate(2) <> 1 then
262 warnlog "The Shadow-button should be activated"
264 Printlog "Shaddowbutton activated, good."
267 '/// Check the attributes for the picture ///'
270 if hMenuFindSelect(10087, true, 1) = false then
271 Warnlog "Context-Menu-entry `Position and Size` was not found. Therefore the test ends."
275 'Select "Position and Size"
278 Active.SetPage TabPositionAndSize
279 Kontext "TabPositionAndSize"
280 if ImageWidth <> Width.GetText then warnlog "Position X differs. Should be: " + ImageWidth + " But is: " + Width.GetText
281 if ImageHeight <> Height.GetText then warnlog "Position X differs. Should be: " + ImageHeight + " But is: " + Height.GetText
282 TabPositionAndSize.OK
287 '/// Switch to Shaddow-tabpage, do some changes, save them, close dialogue ///'
289 active.SetPage TabSchatten
290 kontext "TabSchatten"
291 if Anzeigen.isVisible(5) AND Anzeigen.Exists(5) then
292 if Anzeigen.GetState <> 1 then Warnlog "Shaddow-checkbox should be active"
295 Warnlog "'Use Shadow' doesn't exist or isn't visible."
297 if shadowdistancevalue <> Entfernung.GetText then warnlog "Distance value changed. Should be: " + shadowdistancevalue + ". But is: " + Entfernung.gettext
298 if shadowcolorvalue <> Farbe.GetSelText then warnlog "Color value changed. Should be: " + shadowcolorvalue + ". But is: " + Farbe.gettext
299 if shadowtransparencyvalue <> Transparenz.GetText then warnlog "Transparency value changed. Should be: " + shadowtransparencyvalue + ". But is: " + Transparenz.gettext
301 '/// Check Transparency ///'
303 Active.SetPage TabTransparenz
304 kontext "TabTransparenz"
305 LineareTransparenz.Check
306 shadowtransparencyvalue = MFLinTransparenz.GetText
310 active.SetPage TabSchatten
311 kontext "TabSchatten"
314 '/// Check Cornerstyle via FormatLine ///'
317 Messagebox.SetPage TabLinie
319 if linetype <> Stil.GetItemText then warnlog "Linetype should be: " + linetype + " But is: " + Stil.GetItemText
320 if linecolour <> Farbe.GetItemText then warnlog "Linecolour should be: " + linetype + " But is: " + Farbe.GetItemText
321 if linewidth <> Breite.GetText then warnlog "Linewidth should be: " + linewidth + " But is: " + Breite.GetText
322 if cornerstyletype <> CornerStyle.GetSelText then warnlog "CornerStyle should be: " + cornerstyletype + " But is: " + CornerStyle.GetSelText 'ItemText
325 '/// If Impress: Save as Powerpoint-file. If Draw: Save as usual Draw-file. ///'
326 if (gApplication = "IMPRESS") then
327 ExtensionString = "ppt"
329 ExtensionString = "odg"
332 sFileName = ( ConvertPath(gOfficePath + "user\work\shaddow-test"))
335 Kontext "SpeichernDlg"
336 Dateiname.SetText sFileName
337 if (gApplication = "IMPRESS") then
338 Dateityp.Select 5 ' Powerpoint
339 printlog "Trying to save with filter: " + Dateityp.GetSelText + sFilter(5)
342 printlog "Trying to save with filter: " + Dateityp.GetSelText + sFilter(1)
346 if Messagebox.Exists(2) then Messagebox.Yes
347 Kontext "AlienWarning"
348 if AlienWarning.Exists(2) then AlienWarning.OK
349 printlog "Saved as: " + sFileName
352 '/// Close the office and reload the file ///'
355 if Messagebox.Exists(2) then Messagebox.Yes
357 '/// Open the saved file ///'
358 hFileOpen (sFileName + "." + ExtensionString)
359 printlog "File opened: " + sFileName + "." + ExtensionString
364 '/// Check the attributes for the picture ///'
367 if hMenuFindSelect(10087, true, 1) = false then
368 Warnlog "Context-Menu-entry `Position and Size` was not found. Therefore the test ends."
372 'Select "Position and Size"
375 Active.SetPage TabPositionAndSize
376 Kontext "TabPositionAndSize"
377 if ImageWidth <> Width.GetText then warnlog "Position X differs. Should be: " + ImageWidth + " But is: " + Width.GetText
378 if ImageHeight <> Height.GetText then warnlog "Position X differs. Should be: " + ImageHeight + " But is: " + Height.GetText
379 TabPositionAndSize.OK
381 '/// Check if transparency has disappeared and if the cornerstyle has changed ///'
384 Messagebox.SetPage TabTransparenz
385 kontext "TabTransparenz"
386 if (gApplication = "DRAW") then
387 if LineareTransparenz.Ischecked = FALSE then
388 warnlog "Transparency should have been checked!"
389 if MFLinTransparenz.GetText <> shadowtransparencyvalue then warnlog "Transparency-value should NOT have changed"
390 KeineTransparenz.Check
393 if (gApplication = "DRAW") then
394 if LineareTransparenz.Ischecked = FALSE then
395 warnlog "Transparency should have been checked!"
396 if MFLinTransparenz.GetText <> shadowtransparencyvalue then warnlog "Transparency-value should NOT have changed"
397 KeineTransparenz.Check
400 if (gApplication = "IMPRESS") then
401 if LineareTransparenz.Ischecked =TRUE then
402 printlog "Transparency contained in newer ppt files, ok.!"
403 if MFLinTransparenz.GetText <> shadowtransparencyvalue then warnlog "Transparency-value should NOT have changed"
404 KeineTransparenz.Check
408 TabTransparenz.Cancel
410 '/// Check Cornerstyle via FormatLine ///'
413 Messagebox.SetPage TabLinie
415 if linetype <> Stil.GetItemText then warnlog "Linetype should be: " + linetype + " But is: " + Stil.GetItemText
416 if linecolour <> Farbe.GetItemText then warnlog "Linecolour should be: " + linetype + " But is: " + Farbe.GetItemText
417 if linewidth <> Breite.GetText then warnlog "Linewidth should be: " + linewidth + " But is: " + Breite.GetText
418 if cornerstyletype <> CornerStyle.GetSelText then warnlog "CornerStyle should be: " + cornerstyletype + " But is: " + CornerStyle.GetSelText 'ItemText
421 '/// Remove the Shaddow, Transparency and Cornerstyle ///'
424 Messagebox.SetPage TabTransparenz
425 kontext "TabTransparenz"
426 KeineTransparenz.Check
429 '/// Switch to Shaddow-tabpage, do some changes, save them, close dialogue ///'
431 active.SetPage TabSchatten
432 kontext "TabSchatten"
436 '/// If Impress: Save as Powerpoint-file. If Draw: Save as usual Draw-file. ///'
437 if (gApplication = "IMPRESS") then
438 ExtensionString = "ppt"
440 ExtensionString = "odg"
442 sFileName = ( ConvertPath(gOfficePath + "user\work\shaddow-test"))
445 Kontext "SpeichernDlg"
446 Dateiname.SetText sFileName
447 if (gApplication = "IMPRESS") then
448 Dateityp.Select 5 ' Powerpoint
449 printlog "Trying to save with filter: " + Dateityp.GetSelText + sFilter(5)
452 printlog "Trying to save with filter: " + Dateityp.GetSelText + sFilter(1)
456 if Messagebox.Exists(2) then Messagebox.Yes
457 Kontext "AlienWarning"
458 if AlienWarning.Exists(2) then AlienWarning.OK
459 printlog "Saved as: " + sFileName
462 '/// Close the office-session ///'
465 if Messagebox.Exists(2) then Messagebox.Yes
467 '/// Open the saved file ///'
468 hFileOpen (sFileName + "." + ExtensionString)
469 printlog "File opened: " + sFileName + "." + ExtensionString
474 '/// Check the attributes for the picture ///'
477 if hMenuFindSelect(10087, true, 1) = false then
478 Warnlog "Context-Menu-entry `Position and Size` was not found. Therefore the test ends."
482 'Select "Position and Size"
485 Active.SetPage TabPositionAndSize
486 Kontext "TabPositionAndSize"
487 if ImageWidth <> Width.GetText then warnlog "Position X differs. Should be: " + ImageWidth + " But is: " + Width.GetText
488 if ImageHeight <> Height.GetText then warnlog "Position X differs. Should be: " + ImageHeight + " But is: " + Height.GetText
489 TabPositionAndSize.OK
491 '/// Check if transparency has disappeared ///'
494 Messagebox.SetPage TabTransparenz
495 kontext "TabTransparenz"
496 if LineareTransparenz.Ischecked <> FALSE then
497 warnlog "Transparency should NOT have been checked!"
498 if MFLinTransparenz.GetText <> shadowtransparencyvalue then warnlog "Transparency-value should NOT have changed"
499 LineareTransparenz.UnCheck
501 TabTransparenz.Cancel
503 '/// Check if the cornerstyle has changed via FormatLine ///'
506 Messagebox.SetPage TabLinie
508 if linetype <> Stil.GetItemText then warnlog "Linetype should be: " + linetype + " But is: " + Stil.GetItemText
509 if linecolour <> Farbe.GetItemText then warnlog "Linecolour should be: " + linetype + " But is: " + Farbe.GetItemText
510 if linewidth <> Breite.GetText then warnlog "Linewidth should be: " + linewidth + " But is: " + Breite.GetText
511 if cornerstyletype <> CornerStyle.GetSelText then warnlog "CornerStyle should be: " + cornerstyletype + " But is: " + CornerStyle.GetSelText 'ItemText
514 '/// Close application ///'
516 Printlog "Finished Shaddow-test for " + gApplication