Debian lenny version packages
[pkg-perl] / deb-src / libwww-mechanize-perl / libwww-mechanize-perl-1.34 / t / image-parse.t
1 #!perl -Tw
2
3 use warnings;
4 use strict;
5
6 use Test::More tests=>15;
7 use URI::file;
8
9 BEGIN {
10     delete @ENV{qw(PATH IFS CDPATH ENV BASH_ENV)};  # Placates taint-unsafe Cwd.pm in 5.6.1
11     use_ok( 'WWW::Mechanize' );
12 }
13
14 my $mech = WWW::Mechanize->new( cookie_jar => undef );
15 isa_ok( $mech, 'WWW::Mechanize' );
16
17 my $uri = URI::file->new_abs( 't/image-parse.html' )->as_string;
18
19 $mech->get( $uri );
20 ok( $mech->success, "Fetched $uri" ) or die 'Can\'t get test page';
21
22 my @images = $mech->images;
23 is( scalar @images, 3, 'Only two images' );
24
25 my $first = $images[0];
26 is( $first->tag, 'img', 'img tag' );
27 is( $first->url, 'wango.jpg', 'URL matches' );
28 is( $first->alt, 'The world of the wango', 'alt matches' );
29
30 my $second = $images[1];
31 is( $second->tag, 'input', 'input tag' );
32 is( $second->url, 'bongo.gif', 'URL matches' );
33 is( $second->alt, undef, 'alt matches' );
34 is( $second->height, 142, 'height' );
35 is( $second->width, 43, 'width' );
36
37 my $third = $images[2];
38 is( $third->url, 'linked.gif', 'Got the third image' );
39 is( $third->tag, 'img', 'input tag' );
40 is( $third->alt, undef, 'alt' );