Experimental Image::BoxFind module: Image/t/15-direction_axis_direction_sign.t
# Test file created outside of h2xs framework.
# Run this like so: `perl Image-BoxFind.t'
# doom@kzsu.stanford.edu 2007/10/22 04:50:12
use warnings;
use strict;
$|=1;
my $DEBUG = 1; # TODO set to 0 before ship
use Data::Dumper;
use Test::More;
BEGIN { plan tests => 10 };
use Test::Number::Delta;
use Data::Dumper;
use File::Basename qw( basename );
use FindBin qw( $Bin );
use lib "$Bin/../..";
my $lib = "$Bin/../..";
BEGIN { #1
use_ok( 'Image::BoxFind' );
}
#2
ok(1, "Traditional: If we made it this far, we're ok.");
{#3,4,5,6
my $test_name = "getter direction_axis";
# my $image_file = "$Bin/dat/images/firefox_save_as.png";
# my $basename = basename( $image_file );
# $basename =~ s{\.png$}{}x;
my $bf = Image::BoxFind->new( {
# image_file => $image_file,
DEBUG => $DEBUG,
} );
foreach my $direction_init ('x_plus', 'x_minus') {
$bf->set_direction( $direction_init );
my $axis = $bf->direction_axis;
is( $axis, 'x', "Testing $test_name" );
}
foreach my $direction_init ( 'y_plus', 'y_minus') {
$bf->set_direction( $direction_init );
my $axis = $bf->direction_axis;
is( $axis, 'y', "Testing $test_name" );
}
}
{#7,8,9,10
my $test_name = "getter direction_sign";
# my $image_file = "$Bin/dat/images/firefox_save_as.png";
# my $basename = basename( $image_file );
# $basename =~ s{\.png$}{}x;
my $bf = Image::BoxFind->new( {
# image_file => $image_file,
DEBUG => $DEBUG,
} );
foreach my $direction_init ('x_plus', 'y_plus') {
$bf->set_direction( $direction_init );
my $axis = $bf->direction_sign;
is( $axis, '+', "Testing $test_name" );
}
foreach my $direction_init ('x_minus', 'y_minus') {
$bf->set_direction( $direction_init );
my $axis = $bf->direction_sign;
is( $axis, '-', "Testing $test_name" );
}
}
Joseph Brenner,
Tue Nov 27 17:40:02 2007