1 #!/usr/bin/perl 2 # 3 # Test accessing X11 server 4 # 5 # Contributed by Bob Friesenhahn <bfriesen (at] simple.dallas.tx.us> 6 # 7 8 BEGIN { $| = 1; $test=1; print "1..2\n"; } 9 END {print "not ok $test\n" unless $loaded;} 10 use Image::Magick; 11 $loaded=1; 12 13 require 't/subroutines.pl'; 14 15 chdir 't/x11' || die 'Cd failed'; 16 17 # 18 # 1) Test rendering text using common X11 font 19 # 20 21 $font = '-*-courier-bold-r-normal-*-14-*-*-*-*-*-iso8859-1'; 22 23 # Ensure that Ghostscript is out of the picture 24 $SAVEDPATH=$ENV{'PATH'}; 25 $ENV{'PATH'}=''; 26 27 $image=Image::Magick->new; 28 $x=$image->Set(font=>"$font", pen=>'#0000FF', dither=>'False'); 29 if( "$x" ) { 30 print "$x\n"; 31 print "not ok $test\n"; 32 } else { 33 $x=$image->ReadImage('label:The quick brown fox jumps over the lazy dog.'); 34 if( "$x" ) { 35 print "ReadImage: $x\n"; 36 # If server can't be accessed, ImageMagick returns this warning 37 # Warning 305: Unable to open X server 38 $x =~ /(\d+)/; 39 my $errorCode = $1; 40 if ( $errorCode > 0 ) { 41 print "not ok $test\n"; 42 } else { 43 print "ok $test\n"; 44 } 45 } else { 46 #$image->Display(); 47 print "ok $test\n"; 48 } 49 } 50 undef $image; 51 52 $ENV{'PATH'}=$SAVEDPATH; 53 54 print("X Windows system window dump file (color) ...\n"); 55 ++$test; 56 testReadCompare('input.xwd', '../reference/read/input_xwd.miff', q//, 0.0, 0.0); 57