From: Marius Gavrilescu Date: Sat, 16 Apr 2016 18:48:34 +0000 (+0300) Subject: Significantly expand testsuite X-Git-Tag: 0.001001~1 X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=2b0bab05781bde6b9175f25075fefd39d3d88b81;p=image-openalpr.git Significantly expand testsuite --- diff --git a/t/Image-OpenALPR.t b/t/Image-OpenALPR.t index 1218eeb..31e87d2 100644 --- a/t/Image-OpenALPR.t +++ b/t/Image-OpenALPR.t @@ -2,10 +2,13 @@ use strict; use warnings; -use Test::More tests => 5; +use Test::More tests => 9; BEGIN { use_ok('Image::OpenALPR') }; -my $alpr = Image::OpenALPR->new('eu'); +my $alpr = Image::OpenALPR->new('us'); +my $version = $alpr->getVersion; +note "OpenALPR version is $version, this module was designed for 2.2.4" unless $version =~ /^2\.2/; +$alpr->setCountry('eu'); $alpr->set_top_n(3); my @plates = $alpr->recognise('t/ex.jpg'); is @plates, 1, 'Found only one plate'; @@ -13,3 +16,23 @@ is $plates[0]->plate, 'ZP36709', 'plate number'; cmp_ok $plates[0]->confidence, '>=', 80, 'high confidence'; my @cands = $plates[0]->candidates; is @cands, 3, 'number of candidates matches top_n'; + +# These two methods should not die (nor do anything useful) +$cands[0]->coordinates; +$cands[0]->candidates; + +my $data; + +{ + open my $fh, '; + close $fh; +} + +my $plate = $alpr->recognise(\$data); +is $plate, 'ZP36709', 'recogniseArray + string conversion'; +my @coords = $plate->coordinates; +is $coords[0][0], 306, 'coordinates'; +is $plate->coordinates->[0][1], 351, 'coordinates in scalar context'; +is $plate->candidates->[0], $plate, 'candidates in scalar context';