# Test Games::Chess::Position::to_GIF (-*- cperl -*-) BEGIN { $| = 1; print "1..3\n"; } END {print "not ok 1\n" unless $loaded;} use Games::Chess qw(:constants :functions debug); debug(1); $loaded = 1; print "ok 1\n"; use strict; use UNIVERSAL 'isa'; $^W = 1; my $n = 1; my $success; sub do_test (&) { my ($test) = @_; ++ $n; $success = 1; &$test; print 'not ' unless $success; print "ok $n\n"; } sub fail { my ($mesg) = @_; print STDERR $mesg, "\n"; $success = 0; } my $gif = 0; # Check Position->to_GIF on each position: do_test { my %tests = ( 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1' => < < < <new($c); next unless $p->validate; #++$gif; #open(GIF, "> /tmp/chess$gif.gif") # or die "Couldn't open /tmp/chess$gif.gif: $!"; #print GIF $p->to_GIF; #close(GIF); } }; # Now check it for various combinations of input parameters: do_test { require GD; my @inputs = ( [ letters => 0 ], [ font => GD::Font->Tiny ], [ lmargin => 50, bmargin => 60, border => 20 ] ); foreach (@inputs) { my $p = Games::Chess::Position->new; next unless $p->validate; #++$gif; #open(GIF, "> /tmp/chess$gif.gif") # or die "Couldn't open /tmp/chess$gif.gif: $!"; #print GIF $p->to_GIF(@$_); #close(GIF); } };