summaryrefslogtreecommitdiff
path: root/testautomation/writer/optional/includes/insertgraphic/w_insertgraphic1.inc
blob: 034bbd7c1793cef35312ba729713de7a7d672e32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
'encoding UTF-8  Do not remove or change this line!
'**************************************************************************
'* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
'* 
'* Copyright 2008 by Sun Microsystems, Inc.
'*
'* OpenOffice.org - a multi-platform office productivity suite
'*
'* $RCSfile: w_insertgraphic1.inc,v $
'*
'* $Revision: 1.2 $
'*
'* last change: $Author: vg $ $Date: 2008-08-18 12:30:39 $
'*
'* This file is part of OpenOffice.org.
'*
'* OpenOffice.org is free software: you can redistribute it and/or modify
'* it under the terms of the GNU Lesser General Public License version 3
'* only, as published by the Free Software Foundation.
'*
'* OpenOffice.org is distributed in the hope that it will be useful,
'* but WITHOUT ANY WARRANTY; without even the implied warranty of
'* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
'* GNU Lesser General Public License version 3 for more details
'* (a copy is included in the LICENSE file that accompanied this code).
'*
'* You should have received a copy of the GNU Lesser General Public License
'* version 3 along with OpenOffice.org.  If not, see
'* <http://www.openoffice.org/license.html>
'* for a copy of the LGPLv3 License.
'*
'/************************************************************************
'*
'* owner : helge.delfs@sun.com
'*
'* short description : Test of the insert graphic function - 1
'*
'************************************************************************
'*
' #1 tInsertGraphic_1        'Test default directory of inserting graphic -1
' #1 tInsertGraphic_2        'Test default directory of inserting graphic -2
' #1 tInsertGraphic_3        'Call up dialog Insert / Graphic via Menu ?Insert - Graphics - From File...
' #1 tInsertGraphic_4        'Call up dialog Insert / Graphic via button from Insert-Toolbox of the Toolbar
' #1 tInsertGraphic_5        'Insert a graphic with open button
' #1 tInsertGraphic_6        'Insert a graphic with double click (Return)
' #1 Tinsertgraphic_7        'Default setting in insert/graphic dialog
' #1 tInsertGraphic_8        'Test preselect Filter (Format <All>)
' #1 tInsertGraphic_9        'Test preselect Filter excepte for (Format <All>)
' #1 tInsertGraphic_10       'Insert linked graphics and break the links via Menu Edit - Link
' #1 tInsertGraphic_11       'Insert graphics from clipboard -- Edit/Paste
' #1 tInsertGraphic_12       'Insert graphics from clipboard -- Edit/Paste special
' #1 fInsertGraphics         'This function will insert a graphic with Link checked
'*
'\***********************************************************************

testcase tInsertGraphic_1
    
    Dim iJump     as Integer
    Dim sPathName as String
    Dim i as integer
    
    PrintLog "- Test default dirtory of inserting graphic -1"
    '/// Test default directory of inserting graphic -1
    select case iSprache
        case 01: iJump =  5
        case 31: iJump =  1
        case 33: iJump = 14
        case 34: iJump = 12
        case 36: iJump = 10
        case 39: iJump = 5
        case 46: iJump = 11
        case 49: iJump = 11
        case 55: iJump =  9
        case 81: iJump = 16
        case 82: iJump =  4
        case 86: iJump =  7
        case 88: iJump =  5
        case else : QAErrorLog "The test does not support the language " + iSprache
        Goto endsub
    end select
    
    Call hNewDocument
    
    '/// Tools / Options / StarOffice / Paths
    ToolsOptions
    call hToolsOptions ("StarOffice", "Paths")
        
    Typ.TypeKeys "<HOME><SPACE>"
    Sleep 1
    if iJump-1 > 0 then Typ.TypeKeys "<DOWN>", iJump-1
    Sleep 1
    Bearbeiten.Click
    
    Kontext "OeffnenDlg"
    '/// Set a new path to Graphic
    Pfad.SetText (ConvertPath (gTesttoolpath + "writer\optional\input\insertgraphic\"))
    Sleep 1
    Oeffnen.Click
    Sleep 1
    
    Kontext "ExtrasOptionenDlg"
    ExtrasOptionenDlg.OK
    Sleep 1
    
    '/// Insert / Graphic / From file
    InsertGraphicsFromFile
    Kontext "GrafikEinfuegenDlg"
    
    '/// Input the jpg file's name which exists in the graphic dirtory , then press open button
    Dateiname.Settext "Bughunter.jpg"
    Sleep 1
    
    Oeffnen.Click
    Sleep 2
    
    Kontext "Active"
    if Active.Exists then
        if Active.GetRT = 304 then
            Active.OK
            QAErrorLog "#112220#The graphic directory in Tools/options doesn't work"
        end if
    end if
    
    Kontext "GrafikEinfuegenDlg"
    if GrafikEinfuegenDlg.Exists then GrafikEinfuegenDlg.Cancel
    
    '/// Reset to default path
    ToolsOptions
    call hToolsOptions ("StarOffice", "Paths")
    Typ.TypeKeys "<HOME>"
    Sleep 1
    if iJump-1 > 0 then Typ.TypeKeys "<DOWN>", iJump-1
    Sleep 1
    Standard.Click

    Kontext "ExtrasOptionenDlg"
    ExtrasOptionenDlg.OK
    
    Call hCloseDocument

endcase

'-------------------------------------------------------------------------------------------

testcase tInsertGraphic_2

  PrintLog "- Test default dirtory of inserting graphic -2"
 '/// Test default dirtory of inserting graphic -2

  Call hNewDocument

  '/// Input the 1st picture which exists in the dirtory1(full path) ,
  '/// +  then press open button
   InsertGraphicsFromFile
   Kontext "GrafikEinfuegenDlg"
   Dateiname.Settext ConvertPath(gTesttoolpath + "writer\optional\input\insertgraphic\Bughunter.jpg")
   Sleep 1
   Oeffnen.Click
   Sleep 2

   Kontext "Active"
   if Active.Exists then
      if Active.GetRT = 304 then
         Active.OK
         Sleep 1
         Warnlog "1 - the file isn't in the dirtory " + ConvertPath(gTesttoolpath + "writer\optional\input\insertgraphic\")
      end if

      Kontext "GrafikEinfuegenDlg"
      GrafikEinfuegenDlg.Cancel
   end if

   Call wTypeKeys "<ESCAPE>"

  '/// Input the 2nd picture which exists in the dirtory2(only file name) ,
  '/// + then press open button
   InsertGraphicsFromFile
   Kontext "GrafikEinfuegenDlg"
   Dateiname.Settext "jolink.jpg"
   Sleep 1
   Oeffnen.Click
   Sleep 2

   Kontext "Active"
   if Active.Exists then
      if Active.GetRT = 304 then
         Active.OK
         Sleep 1
      else
         Warnlog "2 - Should get the warning messagebox"
      end if

      Kontext "GrafikEinfuegenDlg"
      GrafikEinfuegenDlg.Cancel
   end if

   Call wTypeKeys "<ESCAPE>"

  '/// Input the 3rd picture which exists in the dirtory2(full path) ,
  '/// + then press open button
   InsertGraphicsFromFile
   Kontext "GrafikEinfuegenDlg"
   Dateiname.Settext ConvertPath(gTesttoolpath + "writer\optional\input\graphics\bild.jpg")
   Sleep 1
   Oeffnen.Click
   Sleep 2

   Kontext "Active"
   if Active.Exists then
      if Active.GetRT = 304 then
         Active.OK
         Sleep 1
         Warnlog "3 - the file isn't in the dirtory " + ConvertPath(gTesttoolpath + "writer\optional\input\grafik")
      end if

      Kontext "GrafikEinfuegenDlg"
      GrafikEinfuegenDlg.Cancel
   end if

   Call wTypeKeys "<ESCAPE>"

  '/// Input the 2nd picture which exists in the dirtory2(only file name) again,
  '/// + then press open button
   InsertGraphicsFromFile
   Kontext "GrafikEinfuegenDlg"
   Dateiname.Settext "jolink.jpg"
   Sleep 1
   Oeffnen.Click
   Sleep 2

   Kontext "Active"
   if Active.Exists then
      if Active.GetRT = 304 then
         Active.OK
         Sleep 1
         Warnlog "2 - the file isn't in the dirtory " + ConvertPath(gTesttoolpath + "writer\optional\input\grafik")
      end if

      Kontext "GrafikEinfuegenDlg"
      GrafikEinfuegenDlg.Cancel
   end if

   Call hCloseDocument

endcase

'-------------------------------------------------------------------------------------------

testcase tInsertGraphic_3

  PrintLog "- Call up dialog Insert / Graphic via Menu ?Insert - Graphics - From File..."
 '/// Call up dialog Insert / Graphic via Menu ?Insert - Graphics - From File

  Call hNewDocument

  try
     InsertGraphicsFromFile
     Kontext "GrafikEinfuegenDlg"

     if GrafikEinfuegenDlg.Exists then
        GrafikEinfuegenDlg.Cancel
     else
        Warnlog "The dialogue can't be opened from Menu Insert - Graphics - From File..."
     end if
  catch
     Warnlog "Something wrong when calling up dialogue from Menu Insert - Graphics - From File..."
  endcatch

  Call hCloseDocument

endcase

'-------------------------------------------------------------------------------------------

testcase tInsertGraphic_X
    Dim sShortcut as string
    PrintLog "- Call up dialog Insert / Picture via Alt+I+U+F ..."
    '/// Call up dialog Insert / Graphic via Alt+I+G+F
 
    Select case iSprache
        case 01: sShortcut = "<MOD2 I U F>"
        case else
            QAErrorlog "Please add shortcut for Insert->Picture"
            goto endsub
    end select
    
    Call hNewDocument
    
    try
        Call wTypeKeys sShortcut
        Kontext "GrafikEinfuegenDlg"
    
        if GrafikEinfuegenDlg.Exists then
            GrafikEinfuegenDlg.Cancel
        else
            Warnlog "The dialogue can't be opened from Menu Insert - Picture - From File..."
        end if
    catch
        Warnlog "Something wrong when calling up dialogue from Menu Insert - Picture - From File..."
    endcatch
    
    Call hCloseDocument

endcase

'-------------------------------------------------------------------------------------------

testcase tInsertGraphic_4

  PrintLog "- Call up dialog Insert / Graphic via button from Insert-Toolbox of the Toolbar "
 '/// Call up dialog Insert / Graphic via button from Insert-Toolbox of the Toolbar

  Call hNewDocument

  Call hToolbarSelect("INSERT", true )
  Sleep 2
  Grafik.Click
  Sleep 3

  Kontext "GrafikEinfuegenDlg"

  if GrafikEinfuegenDlg.Exists then
     GrafikEinfuegenDlg.Cancel
  else
     Warnlog "The dialogue can't be opened from Insert-Toolbox of the Toolbar"
  end if

  Call hCloseDocument

endcase

'-------------------------------------------------------------------------------------------

testcase tInsertGraphic_5

  PrintLog "- Insert a graphic with open button"
 '/// Insert a graphic with open button

  Call hNewDocument

  '/// Insert a Graphic , Insert/Graphics/From file
   InsertGraphicsFromFile
   Kontext "GrafikEinfuegenDlg"
   Dateiname.Settext (ConvertPath (gTesttoolpath + "writer\optional\input\insertgraphic") )
   Sleep 1
   Oeffnen.Click

   if NOT GrafikEinfuegenDlg.Exists then  Warnlog "The insert graphic dialog should be still there!"

   Dateiname.Settext ("boy.gif")

  '/// check if open button can insert a graphic or not
   Oeffnen.Click
   Sleep 2

   if GrafikEinfuegenDlg.Exists then  Warnlog "The insert graphic dialog should NOT be there!"

   try
      fFormatGraphic("TabZusaetze")
      Kontext "TabZusaetze"
      TabZusaetze.Cancel
   catch
      Warnlog "The graphic is NOT inserted correctly !"
   endcatch

  Call hCloseDocument

endcase

'-------------------------------------------------------------------------------------------

testcase tInsertGraphic_6

  PrintLog "- Insert a graphic with double click (Return)"
 '/// Insert a graphic with double click (Return)

  Call hNewDocument

  '/// Insert a Graphic , Insert/Graphics/From file
   InsertGraphicsFromFile
   Kontext "GrafikEinfuegenDlg"
   Dateiname.Settext (ConvertPath (gTesttoolpath + "writer\optional\input\insertgraphic") )
   Sleep 1
   Oeffnen.Click

   if NOT GrafikEinfuegenDlg.Exists then  Warnlog "The insert graphic dialog should be still there!"

   Dateiname.Settext ("boy.gif")

  '/// check if double click (return) can insert a graphic or not
  '/// [Note : the first is CVS directory]
   DateiAuswahl.Select 2
   Sleep 1

   DateiAuswahl.TypeKeys "<Return>"
   Sleep 2

   if GrafikEinfuegenDlg.Exists then  Warnlog "The insert graphic dialog should NOT be there!"

   try
      fFormatGraphic("TabZusaetze")
      Kontext "TabZusaetze"
      TabZusaetze.Cancel
   catch
      Warnlog "The graphic is NOT inserted correctly !"
   endcatch

  Call hCloseDocument

endcase

'-------------------------------------------------------------------------------------------

testcase tInsertGraphic_7

  Dim iFileType   as Integer
  Dim sStyle      as String

  iFileType = 1

  select case iSprache
      case 01   : sStyle = "Graphics"
      case 31   : sStyle = "Afbeeldingen"
      case 33   : sStyle = "Image"
      case 34   : sStyle = "Imagen"
      case 39   : sStyle = "Immagine"
      case 46   : sStyle = "Grafik"
      case 49   : sStyle = "Grafik"
      case 55   : sStyle = "Figuras"
      case 81   : sStyle = "図"
      case 82   : sStyle = "그래픽"
      case 86   : sStyle = "图形"
      case 88   : sStyle = "圖形"
      case else : QAErrorLog "Now, this testcase does not support for the language " +iSprache
                  exit sub
  end select

  PrintLog "- Default setting in insert/graphic dialog"
 '/// Default setting in insert/graphic dialog

  Call hNewDocument

  '/// Insert a Graphic , Insert/Graphics/From file
   InsertGraphicsFromFile
   Kontext "GrafikEinfuegenDlg"
    if Stil.GetItemText(Stil.GetSelIndex) <> sStyle    then Warnlog "The default setting for Style is wrong ! should be "+ sStyle + " but get " + Stil.GetItemText(Stil.GetSelIndex)
    if Dateityp.GetSelIndex               <> iFileType then Warnlog "The default setting for file type is wrong ! should be "+ Dateityp.GetItemText(iFileType) + " but get " + Dateityp.GetItemText(Dateityp.GetSelIndex)
   GrafikEinfuegenDlg.Cancel

  Call hCloseDocument

endcase

'-------------------------------------------------------------------------------------------

testcase tInsertGraphic_8

  Dim iFileType      as Integer
  Dim iFileNumber as Integer

    iFileType = 1  'filter (Format <All>)

    if gPlatGroup = "unx" then
        iFileNumber = 4  '4 graphic files. (directory hidden on Unix)
    else
        iFileNumber = 5  '4 graphic files and 1 directory.
    end if

  PrintLog "- Test preselect Filter (Format <All>)"
 '/// Test preselect Filter (Format <All>)

  Call hNewDocument

  '/// Insert a Graphic , Insert/Graphics/From file
   InsertGraphicsFromFile

  '/// Select filter (Format <All>)
   Kontext "GrafikEinfuegenDlg"
    Dateiname.Settext (ConvertPath (gTesttoolpath + "writer\optional\input\insertgraphic") )
    Sleep 1
    Oeffnen.Click

    Dateityp.Select iFileType
    Sleep 1

  '/// Check if Filter (Format <All>) works well
    if DateiAuswahl.GetItemCount <> iFileNumber then Warnlog "Filter (Format <All>) does NOT work well"
   GrafikEinfuegenDlg.Cancel

  Call hCloseDocument

endcase

'-------------------------------------------------------------------------------------------

testcase tInsertGraphic_9

  Dim iFileType      as Integer
  Dim iFileNumber as Integer

    iFileType   = 2  'another filter except for (Format <All>) -- bmp

    if gPlatGroup = "unx" then
      iFileNumber = 1
    else
      iFileNumber = 2  'the first is the .svn-directory
    end if

  PrintLog "- Test preselect Filter excepte for (Format <All>)"
 '/// Test preselect Filter excepte for (Format <All>)

  Call hNewDocument

  '/// Insert a Graphic , Insert/Graphics/From file
   InsertGraphicsFromFile

  '/// Select filter 'BMP'
   Kontext "GrafikEinfuegenDlg"
    Dateiname.Settext (ConvertPath (gTesttoolpath + "writer\optional\input\insertgraphic") )
    Sleep 1
    Oeffnen.Click

    Dateityp.Select iFileType
    Sleep 1

  '/// Check if Filter BMP works well
    if DateiAuswahl.GetItemCount <> iFileNumber then Warnlog "Filter BMP does NOT work well"
   GrafikEinfuegenDlg.Cancel

  Call hCloseDocument

endcase

'-------------------------------------------------------------------------------------------

testcase tInsertGraphic_10

    Dim sTestFile as String

    sTestFile = ConvertPath(gOfficepath + "user\work\tInsertGraphic_5.sxw")

    PrintLog "- Insert linked graphics and break the links via Menu Edit - Link"
    '/// Insert linked graphics and break the links via Menu Edit - Link

    Call hNewDocument

    Call wTypeKeys "<Return>" , 2

    '/// Insert a jpg  Graphic
    Call fInsertGraphics("Bughunter.jpg")

    '/// + and set name as TEST1
    Call fFormatGraphic("TabZusaetze")
     sleep(1)
     Kontext "TabZusaetze"
     ObjektName.SetText "TEST1"
    TabZusaetze.OK
    sleep(1)

    Kontext "DocumentWriter"
    Call wTypeKeys "<ESCAPE>"
    Call wTypeKeys "<Return>" , 2
    sleep(2)

    '/// Insert a gif  Graphic  (animated)
    Call fInsertGraphics("boy.gif")

    '/// + and set name as TEST2
    Call fFormatGraphic("TabZusaetze")
     sleep(1)
     Kontext "TabZusaetze"
     ObjektName.SetText "TEST2"
    TabZusaetze.OK
    sleep(1)

    Kontext "DocumentWriter"
    Call wTypeKeys "<ESCAPE>"
    Call wTypeKeys "<Return>" , 2
    sleep(2)

    '/// Insert a bmp Graphic
    Call fInsertGraphics("game.bmp")

    '/// + and set name as TEST3
    Call fFormatGraphic("TabZusaetze")
     sleep(2)
     Kontext "TabZusaetze"
     ObjektName.SetText "TEST3"
    TabZusaetze.OK
    sleep(1)

    Kontext "DocumentWriter"
    Call wTypeKeys "<ESCAPE>"
    Call wTypeKeys "<Return>" , 2
    sleep(2)

    '/// Edit / Links
    EditLinksWriter
    Kontext "VerknuepfungenBearbeiten"

    '/// Select all graphics
    Liste.TypeKeys "<Shift End>"
    sleep(1)

    '/// Remove link
     Loesen.Click
     sleep(1)
     Kontext "Active"
     if Active.Exists(1) then
        Active.YES
     else
        warnlog "Messagebox should appear!"
     end if
     sleep(2)

    '/// Close the edit/link dialogue
    Kontext "VerknuepfungenBearbeiten"
    VerknuepfungenBearbeiten.Close
    sleep(1)

    '/// Check if the inserted graphics are still there
    Kontext "DocumentWriter"
    Call wTypeKeys ( "<Shift F4>" )
    sleep(1)
    fFormatGraphic("TabZusaetze")
    sleep(1)
    Kontext "TabZusaetze"
    if ObjektName.GetText <> "TEST1" then  warnlog "The first graphic isn't right!"
    TabZusaetze.OK
    sleep(1)

    Kontext "DocumentWriter"
    Call wTypeKeys "<Tab>"
    Call fFormatGraphic("TabZusaetze")
    sleep(1)
    Kontext "TabZusaetze"
    if ObjektName.GetText <> "TEST2" then  Warnlog "The second graphic isn't right!"
    TabZusaetze.OK
    sleep(1)

    Kontext "DocumentWriter"
    Call wTypeKeys "<Tab>"
    Call fFormatGraphic("TabZusaetze")
    sleep(1)
    Kontext "TabZusaetze"
    if ObjektName.GetText <> "TEST3" then  Warnlog "The third graphic isn't right!"
    TabZusaetze.OK
    sleep(1)

    Kontext "DocumentWriter"
    Call wTypeKeys "<ESCAPE><Home>"
    PrintLog "- Save and Reload the file"

    '/// Save the file and close the file
    Call hFileSaveAsWithFilterKill(gOfficepath + "user\work\tInsertGraphic_5.odt", "writer8")
    sleep(2)
    Call hCloseDocument
    sleep(2)

    '/// Reload the file
    Call hFileOpen(gOfficepath + "user\work\tInsertGraphic_5.odt")
    sleep(2)
    Call sMakeReadOnlyDocumentEditable

    '/// Check if the inserted graphics are still there
    Kontext "DocumentWriter"
    Call wTypeKeys ( "<Shift F4>" )
    sleep(1)
    if fFormatGraphic("TabZusaetze") = false then
        Warnlog "#i46300#linked JPEG pictures will disappear when doc is modified."
        Call hCloseDocument
        goto endsub
    end if
    sleep(1)
    Kontext "TabZusaetze"
    if ObjektName.GetText <> "TEST1" then  Warnlog "The first graphic isn't right!"
    TabZusaetze.OK
    sleep(1)

    Kontext "DocumentWriter"
    Call wTypeKeys "<Tab>"
    sleep(1)
    Call fFormatGraphic("TabZusaetze")
    sleep(1)
    Kontext "TabZusaetze"
    if ObjektName.GetText <> "TEST2" then  Warnlog "The second graphic isn't right!"
    TabZusaetze.OK
    sleep(2)

    Kontext "DocumentWriter"
    Call wTypeKeys "<Tab>"
    sleep(1)
    Call fFormatGraphic("TabZusaetze")
    sleep(1)
    Kontext "TabZusaetze"
    if ObjektName.GetText <> "TEST3" then  Warnlog "The third graphic isn't right!"
    TabZusaetze.OK
    sleep(1)

    Call hCloseDocument
endcase

'-------------------------------------------------------------------------------------------

testcase tInsertGraphic_11

  Dim sGraphicName  as String
  Dim sWidth as String
  Dim sHeight as String
  Dim sLeft as String
  Dim sUp as String
  Dim iFromLeft as Integer
  Dim iFromUp as Integer
  Dim sURL as String

  sGraphicName = "TEST1"
  sWidth       = "5"+ gSeperator + "00" + gMeasurementUnit
  sHeight      = "4"+ gSeperator + "00" + gMeasurementUnit
  sLeft        = "2"+ gSeperator + "00" + gMeasurementUnit
  sUp          = "3"+ gSeperator + "00" + gMeasurementUnit

  iFromLeft = 4
  iFromUp   = 4

  sURL      = "http://www.sun.com/"

  PrintLog "- Insert graphics from clipboard -- Edit/Paste"
 '/// Insert graphics from clipboard -- Edit/Paste

  Call hNewDocument

  '/// Insert a jpg  Graphic and do some configuration
   fInsertGraphics("Bughunter.jpg")

   fFormatGraphic("TabZusaetze")
   Sleep 1
   Kontext "TabZusaetze"
   ObjektName.SetText sGraphicName
   TabZusaetze.OK
   sleep(2)
   fFormatGraphic("TabType")
   Kontext "TabType"
   KeepRatio.UnCheck
   Sleep 1
   Width.SetText        sWidth
   wait 500
   Height.SetText       sHeight
   wait 500
   Horizontal.Select    iFromLeft
   wait 500
   Vertical.Select      iFromUp
   wait 500
   HorizontalBy.SetText sLeft
   wait 500
   VerticalBy.SetText   sUp
   wait 500
   TabType.OK
   sleep(1)
   Call fFormatGraphic("TabHyperlinkRahmen")
   Kontext "TabHyperlinkRahmen"
   Sleep 1
   URL.SetText  sURL
   wait 500
   TabHyperlinkRahmen.OK

   '/// copy graphic to clipboard
   EditCopy
   Sleep 1

  Call hCloseDocument

  Call hNewDocument

   '/// paste the graphic from clipboard
   EditPaste
   Sleep 1

  '/// Check if the pasted graphic is correct
   Call fFormatGraphic("TabZusaetze")
   Sleep 1
   Kontext "TabZusaetze"
   if ObjektName.GetText <> sGraphicName   then Warnlog "The graphic's name is not correct ! "
   TabZusaetze.Cancel
   sleep(1)
   Call fFormatGraphic("TabType")
   Sleep 1
   Kontext "TabType"
   if Width.GetText          <> sWidth     then Warnlog "The graphic's width is not correct ! "
   wait 500
   if Height.GetText         <> sHeight    then Warnlog "The graphic's height is not correct ! "
   wait 500
   if Horizontal.GetSelIndex <> iFromLeft  then Warnlog "The graphic's Horizontal option is not correct ! "
   wait 500
   if Vertical.GetSelIndex   <> iFromUp    then Warnlog "The graphic's vertical option is not correct ! "
   wait 500
   if HorizontalBy.GetText   <> sLeft      then Warnlog "The graphic's Horizontal is not correct ! "
   wait 500
   if VerticalBy.GetText     <> sUp        then Warnlog "The graphic's vertical is not correct ! "
   wait 500
   TabType.Cancel

   Call fFormatGraphic("TabHyperlinkRahmen")
   Sleep 1
   Kontext "TabHyperlinkRahmen"
   if URL.GetText <>  sURL  then Warnlog "The graphic's URL is not correct ! "
   wait 500
   TabHyperlinkRahmen.Cancel
   sleep(1)
  Call hCloseDocument
endcase

'-------------------------------------------------------------------------------------------

testcase tInsertGraphic_12

    Dim sGraphicName as String
    Dim sOriginalGraphicName as String
    Dim sWidth as String
    Dim sHeight as String
    Dim sLeft as String
    Dim sUp as String
    Dim sOriginalWidth as String
    Dim sOriginalHeight as String
    Dim sOriginalLeft as String
    Dim sOriginalUp as String
    Dim iFromLeft as Integer
    Dim iFromUp as Integer
    Dim iOriginalFromLeft as Integer
    Dim iOriginalFromUp as Integer
    Dim sURL as String
    Dim i as integer
    
    sGraphicName = "TEST1"
    sWidth       = "5"+ gSeperator + "00" + gMeasurementUnit
    sHeight      = "4"+ gSeperator + "00" + gMeasurementUnit
    sLeft        = "2"+ gSeperator + "00" + gMeasurementUnit
    sUp          = "3"+ gSeperator + "00" + gMeasurementUnit
    
    iFromLeft = 4
    iFromUp   = 4
    
    sURL      = "http://www.sun.com/"
    
    PrintLog "- Insert graphics from clipboard -- Edit/Paste special"
    '/// Insert graphics from clipboard -- Edit/Paste special
    
    Call hNewDocument
    
    '/// Insert a jpg  Graphic and do some configuration
    fInsertGraphics("Bughunter.jpg")
    
    fFormatGraphic("TabZusaetze")
    Sleep 1
    sOriginalGraphicName = ObjektName.GetText
    wait 500
    ObjektName.SetText sGraphicName
    wait 500
    TabZusaetze.OK
    
    fFormatGraphic("TabType")
    KeepRatio.UnCheck
    
    sOriginalWidth    =  Width.GetText
    sOriginalHeight   =  Height.GetText
    iOriginalFromLeft =  Horizontal.GetSelIndex
    iOriginalFromUp   =  Vertical.GetSelIndex
    sOriginalLeft     =  HorizontalBy.GetText
    sOriginalUp       =  VerticalBy.GetText
    
    Sleep 1
    Width.SetText        sWidth
    wait 500
    Height.SetText       sHeight
    wait 500
    Horizontal.Select    iFromLeft
    wait 500
    Vertical.Select      iFromUp
    wait 500
    HorizontalBy.SetText sLeft
    wait 500
    VerticalBy.SetText   sUp
    wait 500
    TabType.OK
    
    fFormatGraphic("TabHyperlinkRahmen")
    Sleep 1
    URL.SetText  sURL
    wait 500
    TabHyperlinkRahmen.OK
    
    '/// copy graphic to clipboard
    EditCopy
    Sleep 1
    
    '/// delete the graphic
    Call wTypeKeys "<Delete>"
    Sleep 1
    
    '/// 1. Edit/Paste special the graphic from
    '/// +  Graphic [StarOffice Writer]
    EditPasteSpecialWriter
    Sleep 1
    Kontext "InhaltEinfuegen"
    if Auswahl.GetItemCount < 4 then
        QAErrorlog "#i47320#Only " & Auswahl.GetItemCount & " graphic formats available"
        InhaltEinfuegen.Cancel
    else
        Auswahl.Select 1
        PrintLog "- " & Auswahl.GetSelText
        InhaltEinfuegen.OK
        Sleep 1

        '/// Check if the pasted graphic properties are correct
        FormatGraphics
        Kontext
        Active.Setpage TabZusaetze
        Kontext "TabZusaetze"
        Sleep 1
        if ObjektName.GetText     <> sGraphicName  then Warnlog "The graphic's name is not correct ! "

        Kontext
        Active.Setpage TabType
        Kontext "TabType"
        Sleep 1
        if Width.GetText          <> sWidth        then Warnlog "The graphic's width is not correct ! "
        wait 500
        if Height.GetText         <> sHeight       then Warnlog "The graphic's height is not correct ! "
        wait 500
        if Horizontal.GetSelIndex <> iFromLeft     then Warnlog "The graphic's Horizontal option is not correct ! "
        wait 500
        if Vertical.GetSelIndex   <> iFromUp       then Warnlog "The graphic's vertical option is not correct ! "
        wait 500
        if HorizontalBy.GetText   <> sLeft         then Warnlog "The graphic's Horizontal is not correct ! "
        wait 500
        if VerticalBy.GetText     <> sUp           then Warnlog "The graphic's vertical is not correct ! "
        wait 500

        Kontext
        Active.Setpage TabHyperlinkRahmen
        Kontext "TabHyperlinkRahmen"
        Sleep 1
        if URL.GetText <> sURL then Warnlog "The graphic's URL is not correct ! "
        wait 500
        TabHyperlinkRahmen.Ok

        'delete the graphic
        Call wTypeKeys "<Delete>"
        Sleep 1
    end if

    Call hCloseDocument
endcase

'-------------------------------------------------------------------------------------------

function fInsertGraphics (sFileName as String)
   'This function will insert a graphic with Link checked

   InsertGraphicsFromFile
   Kontext "GrafikEinfuegenDlg"
   Dateiname.Settext (ConvertPath (gTesttoolpath + "writer\optional\input\insertgraphic\" + sFileName) )
   Sleep 1
   Link.Check
   Sleep 1
   Oeffnen.Click
   Sleep 2

end function