Image-Info-1.28.tar.gz
[Image-Info.git] / t / svg.t
blob207aadbbe9ccd56d47eb6bcdda6df73156cbb205
1 #!/usr/bin/perl -w
3 use Test::More;
4 use strict;
6 # test SVG images
8 BEGIN
10 chdir 't' if -d 't';
11 use lib '../lib';
13 plan skip_all => "Need XML::Simple for this test",
14 unless do {
15 eval "use XML::Simple;";
16 $@ ? 0 : 1;
18 plan tests => 12;
21 use Image::Info qw(image_info dim);
23 my $i = image_info("../img/test.svg") ||
24 die ("Couldn't read test.svg: $!");
26 #use Data::Dumper; print Dumper($i), "\n";
28 is ($i->{color_type}, 'sRGB', 'color_type');
29 is ($i->{file_media_type}, 'image/svg+xml', 'file_media_type');
31 is ($i->{SVG_StandAlone}, 'yes', 'SVG_StandAlone');
32 is ($i->{file_ext}, 'svg', 'file_ext');
33 is ($i->{SVG_Version}, 'unknown', 'SVG_Version unknown');
35 is (dim($i), '4inx3in', 'dim()');
37 #############################################################################
38 # second test file
39 $i = image_info("../img/graph.svg") ||
40 die ("Couldn't read graph.svg: $!");
42 #use Data::Dumper; print Dumper($i), "\n";
44 is ($i->{SVG_StandAlone}, 'yes', 'SVG_StandAlone');
45 is ($i->{file_ext}, 'svg', 'file_ext');
46 is ($i->{file_media_type}, 'image/svg+xml', 'file_media_type');
47 is ($i->{SVG_Title}, 'Untitled graph', 'title');
48 is ($i->{SVG_Version}, '1.1', 'SVG_Version 1.1');
50 is (dim($i), '209x51', 'dim()');