update dev300-m58
[ooovba.git] / testautomation / writer / optional / includes / insertgraphic / w_insertgraphic5.inc
blobfe6704392a0abe448cdc807348d1c730ffa32bff
1 'encoding UTF-8  Do not remove or change this line!
2 '**************************************************************************
3 '* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 '* 
5 '* Copyright 2008 by Sun Microsystems, Inc.
6 '*
7 '* OpenOffice.org - a multi-platform office productivity suite
8 '*
9 '* $RCSfile: w_insertgraphic5.inc,v $
11 '* $Revision: 1.1 $
13 '* last change: $Author: fredrikh $ $Date: 2008-06-18 15:03:54 $
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 : helge.delfs@sun.com
36 '* short description : Test of the insert graphic function - 4
38 '************************************************************************
40 ' #1 tInsertGraphic_41         'Test checkbox 'Keep image size'
41 ' #1 tInsertGraphic_42         'Test checkbox 'Keep scale'
42 ' #1 tInsertGraphic_43         'Test spacing in tabpage 'wrap'
43 ' #1 tInsertGraphic_44         'Set the possible Options for the different Wrap types
44 ' #1 tInsertGraphic_45         'Test Scale in Corp tabpage
45 ' #1 tInsertGraphic_46         'Test Image size in Corp tabpage
46 ' #1 tInsertGraphic_47         'Test Restore via "Original Size" button
47 ' #1 tInsertGraphic_48         'Test link area via a embeded file
48 ' #1 tInsertGraphic_49         'Test link area via a linked file
50 '\***********************************************************************
52 testcase tInsertGraphic_41
54   Dim sLeft as String
55   Dim sRight as String
56   Dim sUp as String
57   Dim sBottom as String
58   Dim sScaleWidth as String
59   Dim sScaleHeight as String
60   Dim sImageWidth as String
61   Dim sImageHeight as String
62   Dim dDummy1 as double
63   Dim dDummy2 as double
65   sLeft    = "1"+ gSeperator + "00" + gMeasurementUnit
66   sRight   = "1"+ gSeperator + "00" + gMeasurementUnit
67   sUp      = "1"+ gSeperator + "00" + gMeasurementUnit
68   sBottom  = "1"+ gSeperator + "00" + gMeasurementUnit
70   PrintLog "- Test checkbox 'Keep image size'"
71  '/// Test checkbox 'Keep image size'
73    Call hNewDocument
75   '/// Insert a graphics
76    fInsertGraphics("game.bmp")
78   '/// Format / Graphic / Crop , check 'Keep image size' ,
79   '/// - increase the value , check if "keep image size" is efficient
80    fFormatGraphic("TabZuschneiden")
81     wait 500
82     GroesseBeibehalten.Check
83     wait 500
85     sScaleWidth  = MassstabBreite.GetText
86     sScaleHeight = MassstabHoehe.GetText
87     sImageWidth  = GroesseBreite.GetText
88     sImageHeight = GroesseHoehe.GetText
90    PrintLog "- increase Left "
91     Links.SetText sLeft
92     Sleep 2
94     if StrToDouble(MassstabBreite.GetText) <= StrToDouble(sScaleWidth)  then warnlog "Scale Width  isn't right !"
95     if StrToDouble(MassstabHoehe.GetText)  <> StrToDouble(sScaleHeight) then warnlog "Scale Height isn't right !"
96     if StrToDouble(GroesseBreite.GetText)  <> StrToDouble(sImageWidth)  then warnlog "Image Width  isn't right !"
97     if StrToDouble(GroesseHoehe.GetText)   <> StrToDouble(sImageHeight) then warnlog "Image Height isn't right !"
99     sScaleWidth  = MassstabBreite.GetText
101    PrintLog "- increase Right"
102     Rechts.SetText sRight
103     Sleep 2
105     if StrToDouble(MassstabBreite.GetText) <= StrToDouble(sScaleWidth)  then warnlog "Scale Width  isn't right !"
106     if StrToDouble(MassstabHoehe.GetText)  <> StrToDouble(sScaleHeight) then warnlog "Scale Height isn't right !"
107     if StrToDouble(GroesseBreite.GetText)  <> StrToDouble(sImageWidth)  then warnlog "Image Width  isn't right !"
108     if StrToDouble(GroesseHoehe.GetText)   <> StrToDouble(sImageHeight) then warnlog "Image Height isn't right !"
110     sScaleWidth  = MassstabBreite.GetText
112    PrintLog "- increase Top "
113     Oben.SetText sUp
114     Sleep 2
116     if StrToDouble(MassstabBreite.GetText) <> StrToDouble(sScaleWidth)  then warnlog "Scale Width  isn't right !"
117     if StrToDouble(MassstabHoehe.GetText)  <= StrToDouble(sScaleHeight) then warnlog "Scale Height isn't right !"
118     if StrToDouble(GroesseBreite.GetText)  <> StrToDouble(sImageWidth)  then warnlog "Image Width  isn't right !"
119     if StrToDouble(GroesseHoehe.GetText)   <> StrToDouble(sImageHeight) then warnlog "Image Height isn't right !"
121     sScaleHeight  = MassstabHoehe.GetText
123    PrintLog "- increase Bottom "
124     Unten.SetText sBottom
125     Sleep 2
127     if StrToDouble(MassstabBreite.GetText) <> StrToDouble(sScaleWidth)  then warnlog "Scale Width  isn't right !"
128     if StrToDouble(MassstabHoehe.GetText)  <= StrToDouble(sScaleHeight) then warnlog "Scale Height isn't right !"
129     if StrToDouble(GroesseBreite.GetText)  <> StrToDouble(sImageWidth)  then warnlog "Image Width  isn't right !"
130     if StrToDouble(GroesseHoehe.GetText)   <> StrToDouble(sImageHeight) then warnlog "Image Height isn't right !"
132    TabZuschneiden.Cancel
134    '/// - decrease value , check if "keep image size" is efficient
135    fFormatGraphic("TabZuschneiden")
136     wait 500
137     GroesseBeibehalten.Check
138     wait 500
140     sScaleWidth  = MassstabBreite.GetText
141     sScaleHeight = MassstabHoehe.GetText
142     sImageWidth  = GroesseBreite.GetText
143     sImageHeight = GroesseHoehe.GetText
145    PrintLog "- decrease Left "
146     Links.SetText "-" + sLeft
147     Sleep 2
149     if StrToDouble(MassstabBreite.GetText) >= StrToDouble(sScaleWidth)  then warnlog "Scale Width  isn't right !"
150     if StrToDouble(MassstabHoehe.GetText)  <> StrToDouble(sScaleHeight) then warnlog "Scale Height isn't right !"
151     if StrToDouble(GroesseBreite.GetText)  <> StrToDouble(sImageWidth)  then warnlog "Image Width  isn't right !"
152     if StrToDouble(GroesseHoehe.GetText)   <> StrToDouble(sImageHeight) then warnlog "Image Height isn't right !"
154     sScaleWidth  = MassstabBreite.GetText
156    PrintLog "- decrease Right"
157     Rechts.SetText "-" + sRight
158     Sleep 2
160     if StrToDouble(MassstabBreite.GetText) >= StrToDouble(sScaleWidth)  then warnlog "Scale Width  isn't right !"
161     if StrToDouble(MassstabHoehe.GetText)  <> StrToDouble(sScaleHeight) then warnlog "Scale Height isn't right !"
162     if StrToDouble(GroesseBreite.GetText)  <> StrToDouble(sImageWidth)  then warnlog "Image Width  isn't right !"
163     if StrToDouble(GroesseHoehe.GetText)   <> StrToDouble(sImageHeight) then warnlog "Image Height isn't right !"
165     sScaleWidth  = MassstabBreite.GetText
167    PrintLog "- decrease Top "
168     Oben.SetText "-" + sUp
169     Sleep 2
171     if StrToDouble(MassstabBreite.GetText) <> StrToDouble(sScaleWidth)  then warnlog "Scale Width  isn't right !"
172     if StrToDouble(MassstabHoehe.GetText)  >= StrToDouble(sScaleHeight) then warnlog "Scale Height isn't right !"
173     if StrToDouble(GroesseBreite.GetText)  <> StrToDouble(sImageWidth)  then warnlog "Image Width  isn't right !"
174     if StrToDouble(GroesseHoehe.GetText)   <> StrToDouble(sImageHeight) then warnlog "Image Height isn't right !"
176     sScaleHeight  = MassstabHoehe.GetText
178    PrintLog "- decrease Bottom "
179     Unten.SetText "-" + sBottom
180     Sleep 2
182     if StrToDouble(MassstabBreite.GetText) <> StrToDouble(sScaleWidth)  then warnlog "Scale Width  isn't right !"
183     if StrToDouble(MassstabHoehe.GetText)  >= StrToDouble(sScaleHeight) then warnlog "Scale Height isn't right !"
184     if StrToDouble(GroesseBreite.GetText)  <> StrToDouble(sImageWidth)  then warnlog "Image Width  isn't right !"
185     if StrToDouble(GroesseHoehe.GetText)   <> StrToDouble(sImageHeight) then warnlog "Image Height isn't right !"
187    TabZuschneiden.Cancel
189    Call hCloseDocument
191 endcase
193 '-------------------------------------------------------------------------------------------
195 testcase tInsertGraphic_42
197   Dim sLeft as String
198   Dim sRight as String
199   Dim sUp as String
200   Dim sBottom as String
201   Dim sScaleWidth as String
202   Dim sScaleHeight as String
203   Dim sImageWidth as String
204   Dim sImageHeight as String
205   Dim dDummy1 as double
206   Dim dDummy2 as double
208   sLeft    = "1"+ gSeperator + "00" + gMeasurementUnit
209   sRight   = "1"+ gSeperator + "00" + gMeasurementUnit
210   sUp      = "1"+ gSeperator + "00" + gMeasurementUnit
211   sBottom  = "1"+ gSeperator + "00" + gMeasurementUnit
213   PrintLog "- Test checkbox 'Keep scale'"
214  '/// Test checkbox 'Keep scale'
216    Call hNewDocument
218   '/// Insert a graphics
219    fInsertGraphics("game.bmp")
221   '/// Format / Graphic / Crop , check Keep scale
222   '/// - increase the value
223    fFormatGraphic("TabZuschneiden")
224     wait 500
225     MassstabBeibehalten.Check
226     wait 500
228     sScaleWidth  = MassstabBreite.GetText
229     sScaleHeight = MassstabHoehe.GetText
230     sImageWidth  = GroesseBreite.GetText
231     sImageHeight = GroesseHoehe.GetText
233    PrintLog "- increase Left "
234     Links.SetText sLeft
235     Sleep 2
237     if StrToDouble(MassstabBreite.GetText) <> StrToDouble(sScaleWidth)  then warnlog "Scale Width  isn't right !"
238     if StrToDouble(MassstabHoehe.GetText)  <> StrToDouble(sScaleHeight) then warnlog "Scale Height isn't right !"
239     if StrToDouble(GroesseBreite.GetText)  >= StrToDouble(sImageWidth)  then warnlog "Image Width  isn't right !"
240     if StrToDouble(GroesseHoehe.GetText)   <> StrToDouble(sImageHeight) then warnlog "Image Height isn't right !"
242     sImageWidth  = GroesseBreite.GetText
244    PrintLog "- increase Right"
245     Rechts.SetText sRight
246     Sleep 2
248     if StrToDouble(MassstabBreite.GetText) <> StrToDouble(sScaleWidth)  then warnlog "Scale Width  isn't right !"
249     if StrToDouble(MassstabHoehe.GetText)  <> StrToDouble(sScaleHeight) then warnlog "Scale Height isn't right !"
250     if StrToDouble(GroesseBreite.GetText)  >= StrToDouble(sImageWidth)  then warnlog "Image Width  isn't right !"
251     if StrToDouble(GroesseHoehe.GetText)   <> StrToDouble(sImageHeight) then warnlog "Image Height isn't right !"
253     sImageWidth  = GroesseBreite.GetText
255    PrintLog "- increase Top "
256     Oben.SetText sUp
257     Sleep 2
259     if StrToDouble(MassstabBreite.GetText) <> StrToDouble(sScaleWidth)  then warnlog "Scale Width  isn't right !"
260     if StrToDouble(MassstabHoehe.GetText)  <> StrToDouble(sScaleHeight) then warnlog "Scale Height isn't right !"
261     if StrToDouble(GroesseBreite.GetText)  <> StrToDouble(sImageWidth)  then warnlog "Image Width  isn't right !"
262     if StrToDouble(GroesseHoehe.GetText)   >= StrToDouble(sImageHeight) then warnlog "Image Height isn't right !"
264     sImageHeight = GroesseHoehe.GetText
266    PrintLog "- increase Bottom "
267     Unten.SetText sBottom
268     Sleep 2
270     if StrToDouble(MassstabBreite.GetText) <> StrToDouble(sScaleWidth)  then warnlog "Scale Width  isn't right !"
271     if StrToDouble(MassstabHoehe.GetText)  <> StrToDouble(sScaleHeight) then warnlog "Scale Height isn't right !"
272     if StrToDouble(GroesseBreite.GetText)  <> StrToDouble(sImageWidth)  then warnlog "Image Width  isn't right !"
273     if StrToDouble(GroesseHoehe.GetText)   >= StrToDouble(sImageHeight) then warnlog "Image Height isn't right !"
275    TabZuschneiden.Cancel
277    '/// - decrease value
278    fFormatGraphic("TabZuschneiden")
279     wait 500
280     MassstabBeibehalten.Check
281     wait 500
283     sScaleWidth  = MassstabBreite.GetText
284     sScaleHeight = MassstabHoehe.GetText
285     sImageWidth  = GroesseBreite.GetText
286     sImageHeight = GroesseHoehe.GetText
288    PrintLog "- decrease Left "
289     Links.SetText "-" + sLeft
290     Sleep 2
292     if StrToDouble(MassstabBreite.GetText) <> StrToDouble(sScaleWidth)  then warnlog "Scale Width  isn't right !"
293     if StrToDouble(MassstabHoehe.GetText)  <> StrToDouble(sScaleHeight) then warnlog "Scale Height isn't right !"
294     if StrToDouble(GroesseBreite.GetText)  <= StrToDouble(sImageWidth)  then warnlog "Image Width  isn't right !"
295     if StrToDouble(GroesseHoehe.GetText)   <> StrToDouble(sImageHeight) then warnlog "Image Height isn't right !"
297     sImageWidth  = GroesseBreite.GetText
299    PrintLog "- decrease Right"
300     Rechts.SetText "-" + sRight
301     Sleep 2
303     if StrToDouble(MassstabBreite.GetText) <> StrToDouble(sScaleWidth)  then warnlog "Scale Width  isn't right !"
304     if StrToDouble(MassstabHoehe.GetText)  <> StrToDouble(sScaleHeight) then warnlog "Scale Height isn't right !"
305     if StrToDouble(GroesseBreite.GetText)  <= StrToDouble(sImageWidth)  then warnlog "Image Width  isn't right !"
306     if StrToDouble(GroesseHoehe.GetText)   <> StrToDouble(sImageHeight) then warnlog "Image Height isn't right !"
308     sImageWidth  = GroesseBreite.GetText
310    PrintLog "- decrease Top "
311     Oben.SetText "-" + sUp
312     Sleep 2
314     if StrToDouble(MassstabBreite.GetText) <> StrToDouble(sScaleWidth)  then warnlog "Scale Width  isn't right !"
315     if StrToDouble(MassstabHoehe.GetText)  <> StrToDouble(sScaleHeight) then warnlog "Scale Height isn't right !"
316     if StrToDouble(GroesseBreite.GetText)  <> StrToDouble(sImageWidth)  then warnlog "Image Width  isn't right !"
317     if StrToDouble(GroesseHoehe.GetText)   <= StrToDouble(sImageHeight) then warnlog "Image Height isn't right !"
319     sImageHeight = GroesseHoehe.GetText
321    PrintLog "- decrease Bottom "
322     Unten.SetText "-" + sBottom
323     Sleep 2
325     if StrToDouble(MassstabBreite.GetText) <> StrToDouble(sScaleWidth)  then warnlog "Scale Width  isn't right !"
326     if StrToDouble(MassstabHoehe.GetText)  <> StrToDouble(sScaleHeight) then warnlog "Scale Height isn't right !"
327     if StrToDouble(GroesseBreite.GetText)  <> StrToDouble(sImageWidth)  then warnlog "Image Width  isn't right !"
328     if StrToDouble(GroesseHoehe.GetText)   <= StrToDouble(sImageHeight) then warnlog "Image Height isn't right !"
330    TabZuschneiden.Cancel
332    Call hCloseDocument
334 endcase
336 '-------------------------------------------------------------------------------------------
338 testcase tInsertGraphic_43
340   Dim sLeft as String
341   Dim sRight as String
342   Dim sUp as String
343   Dim sBottom as String
345   sLeft    = "1"+ gSeperator + "00" + gMeasurementUnit
346   sRight   = "2"+ gSeperator + "00" + gMeasurementUnit
347   sUp      = "3"+ gSeperator + "00" + gMeasurementUnit
348   sBottom  = "4"+ gSeperator + "00" + gMeasurementUnit
350   PrintLog "- Test spacing in tabpage 'wrap'"
351  '/// Test spacing in tabpage 'wrap'
353    Call hNewDocument
355   '/// Insert a graphics
356    fInsertGraphics("game.bmp")
358   '/// Format / Graphic / Wrap , set value in spacing area
359    fFormatGraphic("TabUmlauf")
360     Sleep 1
361     Kein.Check
362     wait 500
363     AbstaendeLinks.SetText  sLeft
364     wait 500
365     AbstaendeRechts.SetText sRight
366     wait 500
367     AbstaendeOben.SetText   sUp
368     wait 500
369     AbstaendeUnten.SetText  sBottom
370     wait 500
371    TabUmlauf.OK
373   '/// Check if the set value is correct
374    fFormatGraphic("TabUmlauf")
375     if AbstaendeLinks.GetText  <> sLeft   then  warnlog "Spacing - Lefe isn't correct!"
376     if AbstaendeRechts.GetText <> sRight  then  warnlog "Spacing - Right isn't correct!"
377     if AbstaendeOben.GetText   <> sUp     then  warnlog "Spacing - Top isn't correct!"
378     if AbstaendeUnten.GetText  <> sBottom then  warnlog "Spacing - Bottom isn't correct!"
379    TabUmlauf.Cancel
381    Call hCloseDocument
383 endcase
385 '-------------------------------------------------------------------------------------------
387 testcase tInsertGraphic_44
389   PrintLog "- Set the possible Options for the different Wrap types"
390  '/// Set the possible Options for the different Wrap types
392   Call hNewDocument
394   '/// Insert a graphics
395    fInsertGraphics("Bughunter.jpg")
397    PrintLog "  1. No Wrap:"
398   '/// Format / Graphic / tabpage Wrap - No page , check possible options
399    fFormatGraphic("TabUmlauf")
400     Sleep 1
401     Kein.Check
402     Sleep 1
403     if ErsterAbsatz.IsEnabled   = TRUE then Warnlog "Checkbox - First paragraph should be unenabled!"
404     if ImHintergrund.IsEnabled  = TRUE then Warnlog "Checkbox - In background should be unenabled!"
405     if Kontur.IsEnabled         = TRUE then Warnlog "Checkbox - Contour should be unenabled!"
406     if NurAussen.IsEnabled      = TRUE then Warnlog "Checkbox - Outside only should be unenabled!"
407    TabUmlauf.Cancel
409    PrintLog "  2. Before:"
410   '/// Format / Graphic / tabpage Wrap - Before , check possible options
411    fFormatGraphic("TabUmlauf")
412     Sleep 1
413     Links.Check
414     Sleep 1
415     if ErsterAbsatz.IsEnabled   <> TRUE then Warnlog "Checkbox - First paragraph should be enabled!"
416     if ImHintergrund.IsEnabled  =  TRUE then Warnlog "Checkbox - In background should be unenabled!"
417     if Kontur.IsEnabled         <> TRUE then Warnlog "Checkbox - Contour should be enabled!"
418     if NurAussen.IsEnabled      =  TRUE then Warnlog "Checkbox - Outside only should be unenabled!"
420     Kontur.Check
421     wait 500
422     if NurAussen.IsEnabled      <> TRUE then Warnlog "Checkbox - Outside only should be enabled after checking contour!"
423    TabUmlauf.Cancel
425    PrintLog "  3. After:"
426   '/// Format / Graphic / tabpage Wrap - After , check possible options
427    fFormatGraphic("TabUmlauf")
428     Sleep 1
429     Rechts.Check
430     Sleep 1
431     if ErsterAbsatz.IsEnabled   <> TRUE then Warnlog "Checkbox - First paragraph should be enabled!"
432     if ImHintergrund.IsEnabled  =  TRUE then Warnlog "Checkbox - In background should be unenabled!"
433     if Kontur.IsEnabled         <> TRUE then Warnlog "Checkbox - Contour should be enabled!"
434     if NurAussen.IsEnabled      =  TRUE then Warnlog "Checkbox - Outside only should be unenabled!"
436     Kontur.Check
437     wait 500
438     if NurAussen.IsEnabled      <> TRUE then Warnlog "Checkbox - Outside only should be enabled after checking contour!"
439    TabUmlauf.Cancel
441    PrintLog "  4. Parallel:"
442   '/// Format / Graphic / tabpage Wrap - Parallel , check possible options
443    fFormatGraphic("TabUmlauf")
444     Sleep 1
445     Parallel.Check
446     Sleep 1
447     if ErsterAbsatz.IsEnabled   <> TRUE then Warnlog "Checkbox - First paragraph should be enabled!"
448     if ImHintergrund.IsEnabled  =  TRUE then Warnlog "Checkbox - In background should be unenabled!"
449     if Kontur.IsEnabled         <> TRUE then Warnlog "Checkbox - Contour should be enabled!"
450     if NurAussen.IsEnabled      =  TRUE then Warnlog "Checkbox - Outside only should be unenabled!"
452     Kontur.Check
453     wait 500
454     if NurAussen.IsEnabled      <> TRUE then Warnlog "Checkbox - Outside only should be enabled after checking contour!"
455    TabUmlauf.Cancel
457    PrintLog "  5. Through:"
458   '/// Format / Graphic / tabpage Wrap - Through , check possible options
459    fFormatGraphic("TabUmlauf")
460     Sleep 1
461     Durchlauf.Check
462     Sleep 1
463     if ErsterAbsatz.IsEnabled   <> TRUE then Warnlog "Checkbox - First paragraph should be enabled!"
464     if ImHintergrund.IsEnabled  <> TRUE then Warnlog "Checkbox - In background should be enabled!"
465     if Kontur.IsEnabled         =  TRUE then Warnlog "Checkbox - Contour should be unenabled!"
466     if NurAussen.IsEnabled      =  TRUE then Warnlog "Checkbox - Outside only should be unenabled!"
467    TabUmlauf.Cancel
469    PrintLog "  6. Optimal:"
470   '/// Format / Graphic / tabpage Wrap - Optimal , check possible options
471    fFormatGraphic("TabUmlauf")
472     Sleep 1
473     Dynamisch.Check
474     Sleep 1
475     if ErsterAbsatz.IsEnabled   <> TRUE then Warnlog "Checkbox - First paragraph should be enabled!"
476     if ImHintergrund.IsEnabled  =  TRUE then Warnlog "Checkbox - In background should be unenabled!"
477     if Kontur.IsEnabled         <> TRUE then Warnlog "Checkbox - Contour should be enabled!"
478     if NurAussen.IsEnabled      =  TRUE then Warnlog "Checkbox - Outside only should be unenabled!"
480     Kontur.Check
481     wait 500
482     if NurAussen.IsEnabled      <> TRUE then Warnlog "Checkbox - Outside only should be enabled after checking contour!"
483    TabUmlauf.Cancel
485    Call hCloseDocument
487 endcase
489 '-------------------------------------------------------------------------------------------
491 testcase tInsertGraphic_45
493   Dim sScaleWidth as String
494   Dim sScaleHeight as String
495   Dim sImageWidth as String
496   Dim sImageHeight as String
498   sScaleWidth  = "100%"
499   sScaleHeight = "100%"
501   PrintLog "- Test Scale in Corp tabpage"
502  '/// Test Scale in Corp tabpage
504   Call hNewDocument
506   '/// Insert a graphics
507    fInsertGraphics("game.bmp")
508    Sleep 1
510   '/// Format/Graphic tabpage corp , double Scale (width and height)
511    fFormatGraphic("TabZuschneiden")
512     wait 500
513     MassstabBreite.SetText sScaleWidth
514     MassstabHoehe.SetText  sScaleHeight
515    TabZuschneiden.OK
517    fFormatGraphic("TabZuschneiden")
518     wait 500
519     sImageWidth  = GroesseBreite.GetText
520     sImageHeight = GroesseHoehe.GetText
522     sScaleWidth  = "200%"
523     sScaleHeight = "200%"
525     MassstabBreite.SetText sScaleWidth
526     wait 500
527     MassstabHoehe.SetText  sScaleHeight
528     wait 500
530     sImageWidth  = Str(StrToDouble(sImageWidth) *2) + gMeasurementUnit
531     sImageHeight = Str(StrToDouble(sImageHeight)*2) + gMeasurementUnit
533    '/// Check if the image size (width and height) are changed corresponding
534     if fCalculateTolerance(GroesseBreite.GetText , sImageWidth) > 0.03 then
535        Warnlog "Image Width is wrong, should be " + sImageWidth + " but get " + GroesseBreite.GetText
536     end if
538     if fCalculateTolerance(GroesseHoehe.GetText , sImageHeight) > 0.03 then
539        Warnlog "Image Height is wrong, should be " + sImageHeight + " but get " + GroesseHoehe.GetText
540     end if
541    TabZuschneiden.Cancel
543    Call hCloseDocument
545 endcase
547 '-------------------------------------------------------------------------------------------
549 testcase tInsertGraphic_46
551   Dim sScaleWidth as String
552   Dim sScaleHeight as String
553   Dim sImageWidth as String
554   Dim sImageHeight as String
556   sImageWidth  = "4"+ gSeperator + "00" + gMeasurementUnit
557   sImageHeight = "2"+ gSeperator + "80" + gMeasurementUnit
559   PrintLog "- Test Image size in Corp tabpage"
560  '/// Test Image size in Corp tabpage
562   Call hNewDocument
564   '/// Insert a graphics
565    fInsertGraphics("game.bmp")
566    Sleep 1
568   '/// Format/Graphic tabpage corp , double Imagin size (width and height)
569    fFormatGraphic("TabZuschneiden")
570     wait 500
571     GroesseBreite.SetText  sImageWidth
572     GroesseHoehe.SetText   sImageHeight
573    TabZuschneiden.OK
575    fFormatGraphic("TabZuschneiden")
576     wait 500
577     sScaleWidth  = MassstabBreite.GetText
578     sScaleHeight = MassstabHoehe.GetText
580     sImageWidth  = "8"+ gSeperator + "00" + gMeasurementUnit
581     sImageHeight = "5"+ gSeperator + "60" + gMeasurementUnit
583     GroesseBreite.SetText  sImageWidth
584     wait 500
585     GroesseHoehe.SetText   sImageHeight
586     wait 500
588    '/// Check if the Scale(width and height) are changed corresponding
589     if Abs(StrToDouble(sScaleWidth) *2 - StrToDouble(MassstabBreite.GetText) ) > 2 then
590        Warnlog "Scale Width is wrong, should be " + Str(StrToDouble(sScaleWidth) *2) + "%" + " but get " + MassstabBreite.GetText
591     end if
593     if Abs(StrToDouble(sScaleHeight) *2 - StrToDouble(MassstabHoehe.GetText) ) > 2 then
594        Warnlog "Scale Height is wrong, should be " + Str(StrToDouble(sScaleHeight)*2) + "%" + " but get " + MassstabHoehe.GetText
595     end if
596    TabZuschneiden.Cancel
598    Call hCloseDocument
600 endcase
602 '-------------------------------------------------------------------------------------------
604 testcase tInsertGraphic_47
606   Dim sScaleWidth as String
607   Dim sScaleHeight as String
608   Dim sImageWidth as String
609   Dim sImageHeight as String
610   Dim sNewImageWidth as String
611   Dim sNewImageHeight as String
613   sNewImageWidth  = "8"+ gSeperator + "00" + gMeasurementUnit
614   sNewImageHeight = "5"+ gSeperator + "60" + gMeasurementUnit
616   PrintLog "- Test Restore via 'Original Size' button"
617  '/// Test Restore via "Original Size" button
619   Call hNewDocument
621   '/// Insert a graphics
622    fInsertGraphics("game.bmp")
623    Sleep 1
625   '/// Format/Graphic tabpage corp , double Image size (width and height)
626    fFormatGraphic("TabZuschneiden")
627     wait 500
628     sScaleWidth  = MassstabBreite.GetText
629     sScaleHeight = MassstabHoehe.GetText
630     sImageWidth  = GroesseBreite.GetText
631     sImageHeight = GroesseHoehe.GetText
633     GroesseBreite.SetText  sNewImageWidth
634     wait 500
635     GroesseHoehe.SetText   sNewImageHeight
636     wait 500
638    '/// + Click 'Original size' button
639     Originalgroesse.Click
640     Sleep 1
642    '/// Check if the Scale and Image size are recovered to the original size
643     if MassstabBreite.GetText <> sScaleWidth  then warnlog "Scale Width  isn't right !"
644     if MassstabHoehe.GetText  <> sScaleHeight then warnlog "Scale Height isn't right !"
645     if GroesseBreite.GetText  <> sImageWidth  then warnlog "Image Width  isn't right !"
646     if GroesseHoehe.GetText   <> sImageHeight then warnlog "Image Height isn't right !"
647    TabZuschneiden.Cancel
649    Call hCloseDocument
651 endcase
653 '-------------------------------------------------------------------------------------------
655 testcase tInsertGraphic_48
657   Dim sFileName as String
659   sFileName = "game.bmp"
661   PrintLog "- Test link area via a embedded file"
662  '/// Test link area via a embedded file
664   Call hNewDocument
666   '/// Insert a graphics (embeded)
667    InsertGraphicsFromFile
668    Kontext "GrafikEinfuegenDlg"
669    Dateiname.Settext (ConvertPath (gTesttoolpath + "writer\optional\input\insertgraphic\" + sFileName) )
670    Sleep 1
671    Link.UnCheck
672    Sleep 1
673    Oeffnen.Click
674    Sleep 2
676   '/// Format/Graphic tabpage Graphics , check if we can get [None] in file name in Link area
677    fFormatGraphic("TabGrafik")
678     wait 500
679     if left(Dateiname.GetText , 1) <> "["  then warnlog "Should be none in file name, but get " + Dateiname.GetText
680     if Durchsuchen.IsEnabled       =  TRUE then Warnlog "Button should be unEnabled!"
681    TabGrafik.Cancel
683    Call hCloseDocument
685 endcase
687 '-------------------------------------------------------------------------------------------
689 testcase tInsertGraphic_49
691   Dim sFileName   as String
692   Dim sHopeResult as String
694   sFileName   = "game.bmp"
695   sHopeResult = fConvertBacklashToSlash(gTesttoolpath + "writer\optional\input\insertgraphic\" + sFileName)
697   if gPlatGroup <> "unx" then
698      sHopeResult = "file:///" + sHopeResult
699   else
700      sHopeResult = "file://"  + sHopeResult
701   end if
703   PrintLog "- Test link area via a linked file"
704  '/// Test link area via a linked file
706   Call hNewDocument
708   '/// Insert a graphics (linked)
709    fInsertGraphics(sFileName)
711   '/// Format/Graphic tabpage Graphics , check if we can get
712   '/// + the correct name in 'file name' in Link area
713    fFormatGraphic("TabGrafik")
714     wait 500
715     if Dateiname.GetText <> sHopeResult  then warnlog "linked file name is wrong, should be " + sHopeResult + " but get " + Dateiname.GetText
716     try
717        Durchsuchen.Click
718        Kontext
719        Kontext "GrafikEinfuegenDlg"
720        if Dateiname.GetSelText <> sFileName then warnlog "file name is wrong, should be " + sFileName + " but get " + Dateiname.GetText
721        if Link.IsChecked       <> TRUE      then warnlog "The linked checkbox should be checked!"
722        GrafikEinfuegenDlg.Cancel
723     catch
724        warnlog "Button should be enabled!"
725     endcatch
727    Kontext "TabGrafik"
728    TabGrafik.Cancel
730    Call hCloseDocument
732 endcase
734 '-------------------------------------------------------------------------------------------
736 function fCalculateTolerance( sNumber1 , sNumber2 )
738 '/// change 2 parameters to number , then Compare them and return the result.
740    Dim dNumber1 as Single
741    dim dNumber2 as Single
742    Dim iCommaLocation1 as integer
743    Dim iCommaLocation2 as Integer
745   'the code below 4 lines is set "2,00cm" to "2.00"cm if needed
746    iCommaLocation1 = InStr(sNumber1 , ",")
747    if iCommaLocation1 > 0 then
748       sNumber1 = Left(sNumber1 , iCommaLocation1-1) + "." + Right(sNumber1,Len(sNumber1) - iCommaLocation1)
749    end if
751    iCommaLocation2 = InStr(sNumber2 , ",")
752    if iCommaLocation2 > 0 then
753       sNumber2 = Left(sNumber2 , iCommaLocation2-1) + "." + Right(sNumber2,Len(sNumber2) - iCommaLocation2)
754    end if
756    dNumber1 = Val( Left(sNumber1, Len(sNumber1)-Len(gMeasurementUnit) ))
757    dNumber2 = Val( Left(sNumber2, Len(sNumber2)-Len(gMeasurementUnit) ))
758   fCalculateTolerance = Abs( dNumber1 - dNumber2 )
760 end function