GD-Graph3d
view release on metacpan or search on metacpan
t/visual-test.pl view on Meta::CPAN
# If the failure is in building the graph then returns undef.
# If the failure is in the comparison of images, returns 0.
#
sub compare {
my( $graph, $file ) = @_;
# Normalize the filename into the test directory
($file) = fileparse( $file );
$file = File::Spec->catfile( $FindBin::RealBin, $file );
# Open the file it should look like
if( open( FILE, $file ) ) {
my $gd = GD::Image->newFromPng( \*FILE ) || die "Error loading $file: $!\n";
close FILE;
# See if GD compares them (bypass user part if possible)
return 1 unless ($graph->compare( $gd ) & GD_CMP_IMAGE);
} else {
warn "Cannot open $file: $!\n";
} # end if
# The images differ!
# So write the image to a file and ask the user if they compare
my $f2 = _write( $graph, $file );
( run in 0.477 second using v1.01-cache-2.11-cpan-0a6323c29d9 )