Branch Coverage

blib/lib/Image/Xpm.pm
Criterion Covered Total %
branch 83 138 60.1


line true false branch
80 52 0 if ($ch[$i] < $MAX_CH) { }
92 0 52 unless $found
96 0 35 if length $$self{-'cc'} > $$self{-'cpp'}
111 0 38 if exists $$self{-'cindex'}{$lccolour}
113 35 3 if exists $$self{-'palette'}{$$self{-'cc'}}
134 1 7 ref $self ? :
154 1 7 if (defined $obj)
162 15 113 if defined $arg{$field}
168 4 4 if (defined $file and not $$self{-'pixels'})
169 4 0 if ref $file or -r $file
171 0 8 if defined $file and not defined $self->get('-width')
175 0 24 unless defined $self->get($field)
178 3 5 unless ($$self{-'pixels'})
199 0 26 unless defined $val
200 0 26 if $field =~ /^-(?:cpp|comments|cindex|ncolours|palette|pixels| width|height|ext(?:name|lines))/ox
204 0 6 if $field eq '-hotx' and $val < $UNSET || $val >= $self->get('-width')
206 0 6 if $field eq '-hoty' and $val < $UNSET || $val >= $self->get('-height')
220 41 23 if (defined $colour) { }
244 0 0 if (defined $colour) { }
287 0 0 unless defined $cc
292 0 0 if substr($$self{-'pixels'}, $i, $cpp) eq $cc
309 0 6 unless $file
322 3 3 if (not ref $file) { }
3 0 elsif (ref $file eq 'SCALAR') { }
323 0 3 unless open $fh, $file
326 3 0 if ($] >= 5.008001) { }
327 0 3 unless eval ' open $fh, "<", $file '
336 0 0 unless seek $file, 0, 0
351 0 205 if /^\s*$/o
353 6 199 if ($state == $STATE_START)
354 0 6 unless m[/\*\s*XPM\s*\*/]o
360 9 190 if (m[^(\s*/\*.*\*/\s*)$]o)
362 3 6 if ($comment =~ m[^\s*/\*\s*colou?rs?\s*\*/\s*$]o) { }
3 3 elsif ($comment =~ m[^\s*/\*\s*pixels?\s*\*/\s*$]o) { }
374 0 190 if ($state != $STATE_IN_COMMENT and m[^\s*/\*]o)
381 0 190 if ($state == $STATE_IN_COMMENT)
383 0 0 if m[\*/]o
387 6 184 if ($state == $STATE_ARRAY)
397 6 178 if ($state == $STATE_VALUES)
401 0 6 unless defined $width
402 0 6 unless defined $height
403 0 6 unless defined $ncolours
404 0 6 unless defined $cpp
405 0 6 if $width == 0
406 0 6 if $height == 0
407 0 6 if $ncolours == 0
408 0 6 if $cpp == 0
409 0 6 if (defined $hotx and not defined $hoty or defined $hotx and $hotx >= $width or defined $hoty and $hoty >= $height)
415 5 1 unless defined $hotx
416 0 6 if $cpp > 4
423 42 136 if ($state == $STATE_COLOURS)
427 42 0 if exists $pair{'c'}
430 0 42 if $i > $ncolours
431 6 36 if ($i == $ncolours)
438 131 5 if ($state == $STATE_PIXELS)
442 0 131 if $i > $height
443 0 6 defined $extname ? :
6 125 if $i == $height
448 0 5 if ($state == $STATE_EXTENSIONS)
449 0 0 if (/XPMENDEXT/o) { }
458 5 0 if ($state == $STATE_FINISH)
466 0 6 unless close $fh
468 0 6 if scalar @{$$self{-'extlines'};}
486 0 2 unless $file
493 0 2 unless open $fh, ">$file"
502 0 2 if $self->get(-'hotx') > $UNSET
504 0 2 if defined $self->get(-'extname')
521 2 51 if $y == $height - 1
530 0 2 unless close $fh