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: export_graphic.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-16 10:42:39 $
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 : Graphics Export A-tests. (More durable ones)
38 '*******************************************************************************
51 '\******************************************************************************
59 sFilter = "EPS - Encapsulated PostScript (.eps)"
62 printlog "open the document"
63 hFileOpen ConvertPath ( gTesttoolPath + "graphics\required\input\graphicexport."+ExtensionString)
65 if hCallExport (OutputGrafikTBO , sFilter ) = TRUE then
67 if EPSOptionen.Exists (2) then
68 printlog "check if all properties have the right count, and depend on each other"
69 ' they do not affect annything, i can check (TBO)
71 ' InterchangeEPSI.Check
73 if Farbe.IsEnabled then warnlog " :-("
74 if Graustufen.IsEnabled then warnlog " :-("
75 if LZWKodierung.IsEnabled then warnlog " :-("
76 if Keine.IsEnabled then warnlog " :-("
77 ' if (TextEinstellungen.IsEnabled <> TRUE) then warnlog " :-("
79 if (Farbe.IsEnabled <> TRUE) then warnlog " :-("
80 if (Graustufen.IsEnabled <> TRUE) then warnlog " :-("
81 if (LZWKodierung.IsEnabled <> TRUE) then warnlog " :-("
82 if (Keine.IsEnabled <> TRUE) then warnlog " :-("
83 ' if (TextEinstellungen.IsEnabled <> TRUE) then warnlog " :-("
84 printlog "'Color Resolution' listbox contains eight items"
85 ' x = TextEinstellungen.GetItemCount
86 ' if x <> 2 then warnlog "'TextEinstellungen' Count is wrong; should:2, is:" + x
88 ' TextEinstellungen.Select i
90 ' Printlog " - " + i + ": '" +TextEinstellungen.GetSelText + "'"
92 printlog "leave dialog with cancel -> there has to be no file created!"
95 if ( dir(OutputGrafikTBO+sExt) = "") then ' inspired by bug #99932 Graphic is exported though cancel is pressed
98 warnlog "Dialog was canceled, but file got saved, too :-( - i35177"
101 Warnlog "No '" + sFilter + "'-Option-Dialog!"
106 if Active.Exists(2) then
107 Warnlog "'" + sFilter + "' has a problem"
111 printlog " now save it realy and load the file afterwards"
112 if hCallExport (OutputGrafikTBO , sFilter ) = TRUE then
113 Kontext "EPSOptionen"
114 if EPSOptionen.Exists (2) then
115 printlog "TextEinstellungen.select 2"
119 if ( dir(OutputGrafikTBO+sExt) <> "") then
120 Printlog "Ok :-) Saved as: '" + OutputGrafikTBO+sExt + "'"
122 warnlog "File didn't get saved :-("
128 Call hGrafikEinfuegen ( OutputGrafikTBO+sExt )
134 '-------------------------------------------------------------------------
139 dim iWaitIndex as integer
140 dim sFilter as string
148 dim sDocument as string
150 sFilter = "PCT - Mac Pict (.pct;.pict)"
153 printlog "open the document"
154 sDocument = ConvertPath ( gTesttoolPath + "graphics\required\input\graphicexport."+ExtensionString)
157 if hCallExport (OutputGrafikTBO , sFilter ) = TRUE then
158 Kontext "PICTOptionen"
159 if PICTOptionen.Exists (2) then
160 printlog "check if all properties have the right count, and depend on each other"
162 if Breite.IsEnabled then warnlog " :-("
163 if Hoehe.IsEnabled then warnlog " :-("
167 printlog "leave dialog with cancel -> there has to be no file created!"
170 if ( dir(OutputGrafikTBO+sExt) = "") then
173 warnlog "Dialog was canceled, but file got saved, too :-( - i35177"
176 Warnlog "No '" + sFilter + "' -Dialog!"
181 if Active.Exists(2) then
182 Warnlog " '" + sFilter + "' has a problem"
186 printlog " now save it realy and load the file afterwards"
187 if hCallExport (OutputGrafikTBO , sFilter ) = TRUE then
188 Kontext "PICTOptionen"
189 if PICTOptionen.Exists (2) then
195 do while PICTOptionen.Exists AND iWaitIndex < 30
197 iWaitIndex = iWaitIndex + 1
201 while ((NOT fileExists(OutputGrafikTBO+sExt)) AND (i<36))
205 if ( dir(OutputGrafikTBO+sExt) <> "") then
206 Printlog "Ok :-) Saved as: '" + OutputGrafikTBO+sExt + "'"
208 warnlog "File didn't get saved :-("
214 Call hGrafikEinfuegen ( OutputGrafikTBO+sExt )
217 printlog " now save a SELECTION in ORIGINAL SIZE and load the file afterwards"
218 hFileOpen (sDocument)
221 printlog "check if the document is writable"
222 if fIsDocumentWritable = false then
223 printlog "make the document writable and check if it's succesfull"
224 if fMakeDocumentWritable = false then
225 warnlog "The document can't be make writeable. Test stopped."
230 hTypeKeys ("<escape><tab>")
231 fGetSizeXY sx1, sY, TRUE
232 if hCallExport (OutputGrafikTBO + "1" , sFilter, TRUE ) = TRUE then
233 Kontext "PICTOptionen"
234 if PICTOptionen.Exists (2) then
238 do while PICTOptionen.Exists AND iWaitIndex < 30
240 iWaitIndex = iWaitIndex + 1
244 while ((NOT fileExists(OutputGrafikTBO+ "1"+sExt)) AND (i<36))
248 if ( dir(OutputGrafikTBO + "1"+sExt) <> "") then
249 Printlog "Ok :-) Saved as: '" + OutputGrafikTBO + "1"+sExt + "'"
251 warnlog "File didn't get saved :-("
257 Call hGrafikEinfuegen ( OutputGrafikTBO + "1"+sExt )
259 fGetSizeXY sx1, sY, bTemp
260 if (bTemp = FALSE) then
261 warnlog "Selected original size NOT OK :-("
265 printlog " now CREATE a rectangle, select it, save it in SIZE and load the file afterwards"
267 hRechteckErstellen ( 10, 10, 30, 40 )
268 if hCallExport (OutputGrafikTBO + "2" , sFilter, TRUE ) = TRUE then
269 Kontext "PICTOptionen"
270 if PICTOptionen.Exists (2) then
275 printlog "Check 'Size' one more time to make the change go through"
280 do while PICTOptionen.Exists AND iWaitIndex < 30
282 iWaitIndex = iWaitIndex + 1
286 while ((NOT fileExists(OutputGrafikTBO+ "2"+sExt)) AND (i<36))
290 if ( dir(OutputGrafikTBO + "2"+sExt) <> "") then
291 Printlog "Ok :-) Saved as: '" + OutputGrafikTBO + "2"+sExt + "'"
293 warnlog "File didn't get saved :-("
297 hFileOpen (OutputGrafikTBO + "2"+sExt)
298 kontext "DocumentDraw"
299 DocumentDraw.TypeKeys ("<escape><tab>")
302 fGetSizeXY sx1, sY, bTemp
303 if (bTemp = FALSE) then
304 warnlog "Selected original size NOT OK :-("
307 if hCallExport (OutputGrafikTBO + "3" , sFilter, TRUE ) = TRUE then
308 Kontext "PICTOptionen"
309 if PICTOptionen.Exists (2) then
312 if (LiberalMeasurement(sx1, sX2)) <> TRUE then
313 if (val(str(StrToDouble(sx1)+5)) >= StrToDouble(sX2) ) AND (val(str(StrToDouble ( sx1 )-5)) <= StrToDouble ( sX2 )) then
314 Printlog "Width was ok. Expected: " + sx1 + "' was: '" + sX2 + "'"
316 warnLog "Width is different expected: '" + sx1 + "' is: '" + sX2 + "'"
320 if (LiberalMeasurement(sY, sY2)) <> TRUE then
321 if ( val(str(StrToDouble(sY)+5)) >= StrToDouble(sY2) ) AND (val(str(StrToDouble ( sY )-5)) <= StrToDouble ( sY2 )) then
322 Printlog "Height was ok. Expected: " + sY + "' was: '" + sY2 + "'"
324 warnLog "Height is different expected: '" + sY + "' is: '" + sY2 + "'"
335 '-------------------------------------------------------------------------------
340 dim sFilter as string
343 sFilter = "PBM - Portable Bitmap (.pbm)"
346 printlog "Open the document"
347 hFileOpen (ConvertPath ( gTesttoolPath + "graphics\required\input\graphicexport."+ExtensionString ))
350 if hCallExport (OutputGrafikTBO , sFilter ) = TRUE then
351 Kontext "PBMOptionen"
352 if PBMOptionen.Exists (2) then
357 if ( dir(OutputGrafikTBO+sExt) <> "") then
358 Printlog "Ok :-) Saved as: '" + OutputGrafikTBO+sExt + "'"
360 warnlog "File didn't get saved :-("
366 Call hGrafikEinfuegen ( OutputGrafikTBO+sExt )
372 '-------------------------------------------------------------------------------
377 dim sFilter as string
380 sFilter = "PGM - Portable Graymap (.pgm)"
383 printlog "Open the document"
384 hFileOpen (ConvertPath ( gTesttoolPath + "graphics\required\input\graphicexport."+ExtensionString ))
387 if hCallExport (OutputGrafikTBO , sFilter ) = TRUE then
388 Kontext "PGMOptionen"
389 if PGMOptionen.Exists (2) then
394 if ( dir(OutputGrafikTBO+sExt) <> "") then
395 Printlog "Ok :-) Saved as: '" + OutputGrafikTBO+sExt + "'"
397 warnlog "File didn't get saved :-("
403 Call hGrafikEinfuegen ( OutputGrafikTBO+sExt )
409 '-------------------------------------------------------------------------------
414 dim sFilter as string
417 sFilter = "PPM - Portable Pixelmap (.ppm)"
420 printlog "Open the document"
421 hFileOpen (ConvertPath ( gTesttoolPath + "graphics\required\input\graphicexport."+ExtensionString ))
424 if hCallExport (OutputGrafikTBO , sFilter ) = TRUE then
425 Kontext "PPMOptionen"
426 if PPMOptionen.Exists (2) then
431 if ( dir(OutputGrafikTBO+sExt) <> "") then
432 Printlog "Ok :-) Saved as: '" + OutputGrafikTBO+sExt + "'"
434 warnlog "File didn't get saved :-("
440 Call hGrafikEinfuegen ( OutputGrafikTBO+sExt )
446 '------------------------------------------------------------------------------
451 dim sFilter as string
454 sFilter = "RAS - Sun Raster Image (.ras)"
457 printlog "Open the document"
458 hFileOpen (ConvertPath ( gTesttoolPath + "graphics\required\input\graphicexport."+ExtensionString ))
461 if hCallExport (OutputGrafikTBO , sFilter ) = TRUE then
462 if ( dir(OutputGrafikTBO+sExt) <> "") then
463 Printlog "Ok :-) Saved as: '" + OutputGrafikTBO+sExt + "'"
468 Call hGrafikEinfuegen ( OutputGrafikTBO+sExt )
470 warnlog "File didn't get saved :-("
477 '------------------------------------------------------------------------------
482 dim sFilter as string
485 sFilter = "TIFF - Tagged Image File Format (.tif;.tiff)"
488 printlog "Open the document"
489 hFileOpen (ConvertPath ( gTesttoolPath + "graphics\required\input\graphicexport."+ExtensionString ))
492 if hCallExport (OutputGrafikTBO , sFilter ) = TRUE then
493 if ( dir(OutputGrafikTBO+sExt) <> "") then
494 Printlog "Ok :-) Saved as: '" + OutputGrafikTBO+sExt + "'"
499 Call hGrafikEinfuegen ( OutputGrafikTBO+sExt )
501 warnlog "File didn't get saved :-("
508 '------------------------------------------------------------------------------
513 dim sFilter as string
516 sFilter = "XPM - X PixMap (.xpm)"
519 printlog "Open the document"
520 hFileOpen (ConvertPath ( gTesttoolPath + "graphics\required\input\graphicexport."+ExtensionString ))
523 if hCallExport (OutputGrafikTBO , sFilter ) = TRUE then
524 if ( dir(OutputGrafikTBO+sExt) <> "") then
525 Printlog "Ok :-) Saved as: '" + OutputGrafikTBO+sExt + "'"
530 Call hGrafikEinfuegen ( OutputGrafikTBO+sExt )
532 warnlog "File didn't get saved :-("
539 '-------------------------------------------------------------------------------
544 dim sFilter as string
547 sFilter = "GIF - Graphics Interchange Format (.gif)"
550 printlog "open the document"
551 hFileOpen (ConvertPath ( gTesttoolPath + "graphics\required\input\graphicexport."+ExtensionString)
554 if hCallExport (OutputGrafikTBO , sFilter ) = TRUE then
555 Kontext "GIFOptionen"
556 if GIFOptionen.Exists (2) then
558 TransparentSpeichern.UnCheck
562 if ( dir(OutputGrafikTBO+sExt) <> "") then
563 Printlog "Ok :-) Saved as: '" + OutputGrafikTBO+sExt + "'"
565 warnlog "File didn't get saved :-("
571 Call hGrafikEinfuegen ( OutputGrafikTBO+sExt )
577 '-------------------------------------------------------------------------------
582 dim sFilter as string
585 sFilter = "JPEG - Joint Photographic Experts Group (.jpg;.jpeg;.jfif;.jif;.jpe)"
588 printlog "Open the document"
589 hFileOpen (ConvertPath ( gTesttoolPath + "graphics\required\input\graphicexport."+ExtensionString)
592 if hCallExport (OutputGrafikTBO , sFilter ) = TRUE then
593 Kontext "JpegOptionen"
594 if JpegOptionen.Exists (2) then
600 if ( dir(OutputGrafikTBO+sExt) <> "") then
601 Printlog "Ok :-) Saved as: '" + OutputGrafikTBO+sExt + "'"
603 warnlog "File didn't get saved :-("
609 Call hGrafikEinfuegen ( OutputGrafikTBO+sExt )
615 '-------------------------------------------------------------------------