Branch Coverage

blib/lib/Imager/Graph.pm
Criterion Covered Total %
branch 226 342 66.0


line true false branch
93 3 2 if (defined $series_name)
105 19 296 if ($$opts{'data'})
108 0 19 if (@$data and ref $$data[0] and ref $$data[0] =~ /ARRAY/) { }
132 22 64 if $$opts{'labels'}
171 5 34 if $$opts{'style'}
1586 10 29 if $pre_def_style
1599 389 787 if ($composite{$key}) { }
1600 351 38 unless exists $work{$key}
1601 387 2 if (ref $$src{$key}) { }
1611 787 0 if defined $$src{$key}
1621 76 80 if ($$src{'features'})
1622 73 3 if (ref $$src{'features'}) { }
1623 30 43 if (ref($$src{'features'}) =~ /ARRAY/) { }
43 0 elsif (ref($$src{'features'}) =~ /HASH/) { }
1626 0 78 if ($feature =~ /^no(.+)$/) { }
1635 0 43 if ($$src{'features'}{'reset'})
1644 0 3 if ($$src{'features'} =~ /^no(.+)$/) { }
1672 965 420 if ($name =~ /^(\w+)\.(\w+)$/) { }
1678 53 1332 unless defined $what
1680 487 845 if (ref $what) { }
840 5 elsif ($what =~ /^lookup\((\w+(?:\.\w+)?)\)$/) { }
1684 0 840 unless @depth < 10
1718 4369 7034 if ($name =~ /^(\w+)\.(\w+)$/) { }
1724 101 11302 unless defined $what
1727 0 11302 if (ref $what) { }
1728 0 0 if ($what =~ /CODE/)
1733 5706 5596 if ($what =~ /^lookup\(([\w.]+)\)$/) { }
195 5401 elsif ($what =~ /^scale\( ((?:[a-z][\w.]*)|$NUM_RE) , ((?:[a-z][\w.]*)|$NUM_RE)\)$/x) { }
1734 0 5706 unless @depth < 10
1743 99 96 unless ($left =~ /^$NUM_RE$/)
1744 0 99 unless @depth < 10
1748 96 99 unless ($right =~ /^$NUM_RE$/)
1749 0 96 unless @depth < 10
1773 0 40 unless my $number = $self->_get_number($name, @depth)
1796 902 468 if ($name =~ /^(\w+)\.(\w+)$/) { }
1803 0 1370 unless defined $what
1806 1370 0 unless (ref $what)
1807 826 544 if ($what =~ /^lookup\((\w+(?:\.\w+)?)\)$/)
1808 0 826 unless @depth < 10
1836 3246 102 if (ref $what) { }
1837 0 3246 if (UNIVERSAL::isa($what, 'Imager::Color')) { }
1844 10 3236 if ($$what{'hatch'}) { }
3227 9 elsif ($$what{'fountain'}) { }
1845 10 0 unless ($work{'fg'})
1846 0 10 unless $work{'fg'} = $self->_get_color('fg')
1849 10 0 unless ($work{'bg'})
1850 0 10 unless $work{'bg'} = $self->_get_color('bg')
1857 12908 0 if (exists $work{"${key}_ratio"})
1858 6454 6454 if ($key =~ /^x/) { }
1876 20 82 if ($what =~ /^lookup\((\w+(?:\.\w+)?)\)$/) { }
1909 0 1075 unless (ref $fill)
1913 1075 0 if (@$colors)
1930 32 63 if ($name =~ /^(\w+)\.(\w+)$/) { }
1937 0 95 unless defined $what
1955 18 19 if ($name =~ /^(\w+)\.(\w+)$/) { }
1962 0 37 unless defined $what
1965 3 34 if (ref $what) { }
1966 0 3 if (eval { do { $what->isa('Imager::Color') } })
1969 3 0 if (ref $what eq 'HASH')
1973 1 2 if ($work{'color'} =~ /^lookup\((.*)\)$/)
1977 3 3 if $key eq 'color'
1979 0 3 if ($work{$key} =~ /^lookup\((.*)\)$/)
1989 17 17 if ($what =~ /^lookup\((\w+(?:\.\w+)?)\)$/) { }
1990 0 17 unless @depth < 10
1996 0 17 unless my $color = 'Imager::Color'->new($what)
2020 1 38 unless my $img = 'Imager'->new('xsize', $width, 'ysize', $height, 'channels', $channels)
2053 523 0 if ($$self{'_style'}{$name}) { }
2059 0 523 unless $work{'font'}
2062 46 477 unless $work{'font'} = $self->_get_thing("$name.font")
2064 0 477 unless UNIVERSAL::isa($work{'font'}, 'Imager::Font')
2066 477 0 if ($work{'color'} and not ref $work{'color'})
2067 0 477 unless $work{'color'} = $self->_get_color("$name.color")
2071 0 477 if $work{'sizew'}
2089 21 411 unless my(%text_info) = $self->_text_style($name)
2112 0 18 unless $line{'color'} = $self->_get_color("$name.line")
2115 0 18 unless defined $line{'aa'}
2123 0 17 unless my $halign = $$self{'_style'}{$name}{'halign'}
2127 5 12 if ($halign eq 'right') { }
5 7 elsif ($halign eq 'left') { }
7 0 elsif ($halign eq 'center' or $halign eq 'centre') { }
2140 11 6 if ($valign eq 'top') { }
4 2 elsif ($valign eq 'bottom') { }
2 0 elsif ($valign eq 'center' or $valign eq 'centre') { }
2161 44 41 if ($$object_box[0] - $$chart_box[0] < $$chart_box[2] - $$object_box[2]) { }
2171 29 56 if ($$object_box[1] - $$chart_box[1] < $$chart_box[3] - $$object_box[3]) { }
2181 48 37 if ($areay < $areax) { }
2182 27 21 if ($$object_box[1] - $$chart_box[1] < $$chart_box[3] - $$object_box[3]) { }
2191 24 13 if ($$object_box[0] - $$chart_box[0] < $$chart_box[2] - $$object_box[2]) { }
2205 7 5 unless defined $orient
2207 7 5 if ($orient eq 'vertical') { }
5 0 elsif ($orient eq 'horizontal') { }
2221 0 5 unless defined(my $padding = $self->_get_integer('legend.padding'))
2223 0 5 unless my $patchsize = $self->_get_integer('legend.patchsize')
2225 0 5 unless defined(my $gap = $self->_get_integer('legend.patchgap'))
2235 1 29 unless my(@text_box) = $self->_text_bbox($label, 'legend')
2239 4 25 if ($pos == 0) { }
2244 2 23 if ($pos + $gap + $entry_width > $$chart_box[2])
2252 27 2 if $entry_right > $width
2253 0 29 if ($text_box[3] > $row_height)
2260 2 2 if ($$self{'_style'}{'legend'}{'border'})
2261 0 2 unless defined($outsidepadding = $self->_get_integer('legend.outsidepadding'))
2266 0 4 unless $self->_align_box(\@box, $chart_box, 'legend')
2268 3 1 if ($$self{'_style'}{'legend'}{'fill'})
2279 0 4 unless my(%text_info) = $self->_text_style('legend')
2282 3 1 if ($$self{'_style'}{'legend'}{'patchborder'})
2283 0 3 unless $patchborder = $self->_get_color('legend.patchborder')
2295 0 29 unless my(@fill) = $self->_data_fill($dataindex, \@patchbox)
2299 24 5 if ($$self{'_style'}{'legend'}{'patchborder'})
2309 2 2 if ($$self{'_style'}{'legend'}{'border'})
2310 0 2 unless my $border_color = $self->_get_color('legend.border')
2322 0 7 unless defined(my $padding = $self->_get_integer('legend.padding'))
2324 0 7 unless my $patchsize = $self->_get_integer('legend.patchsize')
2326 0 7 unless defined(my $gap = $self->_get_integer('legend.patchgap'))
2332 1 25 unless my(@box) = $self->_text_bbox($label, 'legend')
2335 11 14 if $box[2] > $width
2336 25 0 if ($minrowsize > $box[3]) { }
2347 2 4 if ($$self{'_style'}{'legend'}{'border'})
2348 0 2 unless defined($outsidepadding = $self->_get_integer('legend.outsidepadding'))
2353 0 6 unless $self->_align_box(\@box, $chart_box, 'legend')
2355 1 5 if ($$self{'_style'}{'legend'}{'fill'})
2369 0 6 unless my(%text_info) = $self->_text_style('legend')
2372 6 0 if ($$self{'_style'}{'legend'}{'patchborder'})
2373 0 6 unless $patchborder = $self->_get_color('legend.patchborder')
2382 1 24 if ($self->_draw_flat_legend) { }
2386 0 24 unless @fill = $self->_data_fill($dataindex, \@patchbox)
2391 25 0 if ($$self{'_style'}{'legend'}{'patchborder'})
2400 0 25 if ($minrowsize < $sizes[$dataindex][3]) { }
2408 2 4 if ($$self{'_style'}{'legend'}{'border'})
2409 0 2 unless my $border_color = $self->_get_color('legend.border')
2422 1 7 unless my(@box) = $self->_text_bbox($title, 'title')
2427 0 7 unless my(%text_info) = $self->_text_style('title')
2437 32 0 if ($$box[2] - $$box[0] > $$box[3] - $$box[1]) { }
2463 10 0 unless (ref $filter)
2465 0 10 unless $filter = $self->_get_thing($name)
2467 0 10 unless $$filter{'type'}
2471 1 9 unless $left > 0
2472 0 10 unless $top > 0
2490 0 12 unless my $img = delete $opts{'img'}
2494 0 12 if ($style eq 'solid' or $opts{'x1'} != $opts{'x2'} and $opts{'y1'} != $opts{'y2'}) { }
12 0 elsif ($style eq 'dashed' or $style eq 'dotted') { }
2500 0 12 if $x1 > $x2
2501 0 12 if $y1 > $y2
2503 8 4 $style eq 'dashed' ? :
2505 2 10 if ($x1 == $x2) { }
2515 534 328 if ($style eq 'dotted') { }
2519 328 0 $stepx ? :
2520 0 328 if $xe > $x2
2521 0 328 $stepy ? :
2522 0 328 if $ye > $y2
2548 0 18 unless my $img = delete $opts{'img'}
2551 17 1 if ($style eq 'solid') { }
2559 1 0 if ($box)
2562 0 1 if $xmin > $xmax
2563 0 1 if $ymin > $ymax
2565 1 0 if ($xmax - $xmin > 1)
2590 0 2030 unless ($markers)
2605 0 2030 unless $style
2613 2030 0 if ($type eq 'circle') { }
0 0 elsif ($type eq 'open_circle') { }
0 0 elsif ($type eq 'open_square') { }
0 0 elsif ($type eq 'open_triangle') { }
0 0 elsif ($type eq 'open_diamond') { }
0 0 elsif ($type eq 'square') { }
0 0 elsif ($type eq 'diamond') { }
0 0 elsif ($type eq 'triangle') { }
0 0 elsif ($type eq 'x') { }
0 0 elsif ($type eq 'plus') { }
2678 0 0 unless $img->line('x1', $x1 - $radius, 'y1', $y1 - $radius, 'x2', $x1 + $radius, 'y2', $y1 + $radius, 'aa', $line_aa, 'color', $color)
2679 0 0 unless $img->line('x1', $x1 + $radius, 'y1', $y1 - $radius, 'x2', $x1 - $radius, 'y2', $y1 + $radius, 'aa', $line_aa, 'color', $color)
2683 0 0 unless $img->line('x1', $x1, 'y1', $y1 - $radius, 'x2', $x1, 'y2', $y1 + $radius, 'aa', $line_aa, 'color', $color)
2684 0 0 unless $img->line('x1', $x1 + $radius, 'y1', $y1, 'x2', $x1 - $radius, 'y2', $y1, 'aa', $line_aa, 'color', $color)