Image-Maps-Plot-FromLatLong
view release on metacpan or search on metacpan
# LatLong tests
print "1..11\n";
use Cwd;
use Image::Magick;
print "ok 1\n";
use Image::Maps::Plot::FromLatLong;
print "ok 2\n";
if (not mkdir cwd."/__test__"){
print "not ok 4\n";
die "Could not make test dir: dying before messing with files: unlink the __test__ dir manually to prevent errors";
} else {
print "ok 4\n";
}
chdir cwd."/__test__";
my $cwd = cwd."/";
# Do things with maps
if ($^O =~ /win/ig and $ENV{WINDIR}){
my $maker = new Image::Maps::Plot::FromLatLong(
FONT=>$ENV{WINDIR}.'/fonts/arial.ttf',
THUMB_SIZE => '200',
PATH => cwd."/test.foo",
);
if (ref $maker){
print "ok 3\n";
} else {
print "not ok 3\n";
die;
}
} else{
print "skip 3\n";
}
if ($maker){
if ($maker->all(cwd)){
print "ok 5\n";
} else {
print "no ok 5\n";
}
my $i = Image::Magick->new;
if ($i->BlobToImage( ${$maker->create_blob} )){
print "not ok 6\n";
} else {
print "ok 6\n";
}
if ($i->Write($cwd."__test__.jpg")){
print "not ok 7\n";
} else {
print "ok 7\n";
unlink "__test__.jpg";
}
if ($maker->create_imagefile){
print "ok 8\n";
} else {
print "no ok 8\n";
}
} else {
for (5..8){
print "skip $_\n";
}
}
$maker = new Image::Maps::Plot::FromLatLong(
# FONT=>$ENV{WINDIR}.'/fonts/arial.ttf',
THUMB_SIZE => '200',
PATH => cwd."/test.foo",
DBFILE => undef,
);
if (0==scalar keys %Image::Maps::Plot::FromLatLong::locations){
print "ok 9\n";
} else {
print "no ok 9\n";
}
%Image::Maps::Plot::FromLatLong::MAPS->{"THE WORLD"}->{FILE} = cwd."/../world.jpg";
# $Image::Maps::Plot::FromLatLong::MAPS{'world.jpg'} = 'world.jpg';
$maker = new Image::Maps::Plot::FromLatLong(
# FONT=>$ENV{WINDIR}.'/fonts/arial.ttf',
THUMB_SIZE => '200',
PATH => $cwd."/Two.foo",
DBFILE => undef,
LOCATIONS => {
'Lee' => {
'LAT' => '51.592423',
'PLACE' => 'Leslie Road, London, N2 8BH, United Kingdom',
'LON' => '-0.171996'
},
'Lee Again' => {
'PLACE' => 'Veres Péter U.198, Budapest XVI, H-1165',
'LAT' => 46,
'LON' => 16
},
},
);
( run in 1.859 second using v1.01-cache-2.11-cpan-39bf76dae61 )