Branch Coverage

blib/lib/Image/Base/GD.pm
Criterion Covered Total %
branch 22 134 16.4


line true false branch
40 0 6 if (ref $class)
43 0 0 unless (defined $params{'-gd'})
54 5 1 unless (defined $params{'-gd'})
55 2 3 if (defined(my $filename = delete $params{'-file'})) { }
84 0 0 if (my $method = $attr_to_get_method{$key})
95 0 9 if (exists $param{$key})
101 0 3 if (exists $param{'-interlaced'})
104 0 3 if (exists $param{'-truecolor'})
106 0 0 if (delete $param{'-truecolor'}) { }
107 0 0 unless ($gd->isTrueColor)
111 0 0 if ($gd->isTrueColor)
122 0 2 if (@_ == 1) { }
129 0 2 unless open $fh, '<', $filename
131 0 2 unless binmode $fh
141 0 2 if ($bytes =~ /^\x89PNG/) { }
0 2 elsif ($bytes =~ /^\xFF\xD8/) { }
0 2 elsif ($bytes =~ /^GIF8/) { }
0 2 elsif ($bytes =~ /^gd2\0/) { }
0 2 elsif ($bytes =~ m[^/\* XPM \*/]) { }
1 1 elsif ($bytes =~ /^#define /) { }
0 1 elsif ($bytes =~ /^\0\0/) { }
1 0 elsif ($bytes =~ /^\xFF[\xFF\xFE]/ or length $bytes >= 4 and do { my($width, $height) = unpack('nn', $bytes); -s $fh == 775 + $width * $height }) { }
179 0 2 if ($file_format eq 'xpm' or not seek($fh, $filepos, 0))
182 0 0 unless binmode $tempfh
185 0 0 unless print $tempfh $bytes, $rest
186 0 0 unless seek $tempfh, 0, 0
196 0 0 unless close $fh
205 0 0 if ($file_format eq 'xpm') { }
214 0 0 unless close $fh
217 0 0 unless ($gd)
248 0 0 if (@_ == 2) { }
257 0 0 if (defined($file_format = $$self{'-file_format'})) { }
264 0 0 if ($file_format eq 'png') { }
0 0 elsif ($file_format eq 'jpeg') { }
0 0 elsif ($file_format eq 'wbmp') { }
0 0 elsif (my $method = $file_format_save_method{$file_format}) { }
268 0 0 defined $quality ? :
285 0 0 unless open $fh, '>', $filename and $text_mode{$file_format} || binmode($fh) and print $fh $data and close $fh
299 0 0 if (@_ == 4) { }
305 0 0 if ($pixel == $gd->transparent)
309 0 0 if ($pixel >= 2130706432)
338 0 0 if ($x2 < 0 or $y2 < 0)
352 0 0 $fill || $y1 == $y2 ? :
374 0 0 if ($gd->isa('GD::SVG::Image') or $xw > 1 and not $xw & 1 and $yw > 1 and not $yw & 1) { }
381 0 0 $fill ? :
396 0 0 if ($x1 == $x2 or $y1 == $y2) { }
417 0 0 if ($yeven)
421 0 0 if ($xeven)
424 0 0 if ($yeven)
428 0 0 if ($xeven)
431 0 0 $fill ? :
441 0 0 if ($gd->isTrueColor)
448 0 0 if ($colour eq 'None') { }
449 0 0 if ($gd->transparent != -1)
453 0 0 if ((my $index = $$self{'-gd'}->colorAllocateAlpha(0, 0, 0, 127)) != -1)
461 0 0 if ($gd->can('colorExact') and $gd->colorExact(@rgb) != -1)
466 0 0 if ($gd->colorAllocate(@rgb) != -1)
484 0 0 if ($colour eq 'None')
485 0 0 if ($gd->isTrueColor)
494 0 0 if ((my $index = $gd->transparent) != -1)
498 0 0 unless ($$self{'-allocate_colours'})
501 0 0 if ((my $index = $$self{'-gd'}->colorAllocate(0, 0, 0)) != -1)
511 0 0 if ($$self{'-allocate_colours'})
512 0 0 if ($gd->can('colorExact') and (my $index = $gd->colorExact(@rgb)) != -1)
517 0 0 if ((my $index = $gd->colorAllocate(@rgb)) != -1)
530 10 0 if ($colour =~ /^#(([0-9A-F]{3}){1,4})$/i)
538 0 0 if (defined(my $aref = 'GD::Simple'->color_names->{lc $colour}))