blob: 174fa2bf5b0dfd8ee8c1e38af5dc584ed4a20573 (
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
|
#!/usr/local/bin/perl
# Copyright (C) 2003 GraphicsMagick Group
# Copyright (C) 2002 ImageMagick Studio
# Copyright (C) 1991-1999 E. I. du Pont de Nemours and Company
#
# This program is covered by multiple licenses, which are described in
# Copyright.txt. You should have received a copy of Copyright.txt with this
# package; otherwise see http://www.graphicsmagick.org/www/Copyright.html.
#
#
# Test accessing X11 server
#
# Contributed by Bob Friesenhahn <bfriesen@simple.dallas.tx.us>
#
BEGIN { $| = 1; $test=1; print "1..1\n"; }
END {print "not ok $test\n" unless $loaded;}
use Graphics::Magick;
$loaded=1;
require 't/subroutines.pl';
chdir 't/x' || die 'Cd failed';
#
# 1) Test rendering text using common X11 font
#
if ( defined($ENV{'DISPLAY'}) && ($ENV{'DISPLAY'} ne '') ) {
$font = '-*-courier-bold-r-normal--14-100-100-100-m-90-iso8859-1';
# Ensure that Ghostscript is out of the picture
$SAVEDPATH=$ENV{'PATH'};
$ENV{'PATH'}='';
$image=Graphics::Magick->new;
$x=$image->Set(font=>"$font", pen=>'#0000FF', dither=>'False');
if( "$x" ) {
print "$x\n";
print "not ok $test\n";
} else {
$x=$image->ReadImage('label:The quick brown fox jumps over the lazy dog.');
if( "$x" ) {
print "ReadImage: $x\n";
# If server can't be accessed, ImageMagick returns this warning
# Warning 305: Unable to open X server
$x =~ /(\d+)/;
my $errorCode = $1;
if ( $errorCode > 0 ) {
print "not ok $test\n";
} else {
print "ok $test\n";
}
} else {
#$image->Display();
print "ok $test\n";
}
}
undef $image;
$ENV{'PATH'}=$SAVEDPATH;
} else {
print "ok $test\n";
}
$test = 0; # Quench PERL compliaint
|