Branch Coverage

blib/lib/PDF/Builder/Content.pm
Criterion Covered Total %
branch 310 710 43.6


line true false branch
122 6 0 if ($self->{'-docompress'} and $self->{'Filter'})
329 36 39 unless defined $opts{$o}
331 12 27 if ($o eq 'translate') { }
9 18 elsif ($o eq 'rotate') { }
9 9 elsif ($o eq 'scale') { }
9 0 elsif ($o eq 'skew') { }
0 0 elsif ($o eq 'matrix') { }
368 0 15 if ($opts{'point'})
385 7 9 if ($opts{'-translate'} and not defined $opts{'translate'})
386 7 9 if ($opts{'-rotate'} and not defined $opts{'rotate'})
387 7 9 if ($opts{'-scale'} and not defined $opts{'scale'})
388 7 9 if ($opts{'-skew'} and not defined $opts{'skew'})
389 0 16 if ($opts{'-point'} and not defined $opts{'point'})
390 0 16 if ($opts{'-matrix'} and not defined $opts{'matrix'})
391 0 16 if ($opts{'-repeat'} and not defined $opts{'repeat'})
394 1 15 if $opts{'repeat'}
399 12 3 if ($opts{'translate'}) { }
405 9 6 if ($opts{'rotate'}) { }
411 9 6 if ($opts{'scale'}) { }
417 9 6 if ($opts{'skew'}) { }
445 1 1 if (defined $opts{'-skew'} and not defined $opts{'skew'})
446 1 1 if (defined $opts{'-scale'} and not defined $opts{'scale'})
447 1 1 if (defined $opts{'-rotate'} and not defined $opts{'rotate'})
448 1 1 if (defined $opts{'-translate'} and not defined $opts{'translate'})
450 2 0 $opts{'skew'} ? :
453 2 0 $opts{'scale'} ? :
459 2 0 $opts{'translate'} ? :
523 26 0 if (defined $a)
524 3 23 if ($self->_in_text_object) { }
526 0 3 if ($self->{' doPending'}) { }
538 3 23 if ($self->_in_text_object) { }
579 0 89 unless (defined $linewidth)
639 0 3 unless (defined $linecap)
645 0 3 if $style eq "butt" or $style eq "b"
646 0 3 if $style eq "round" or $style eq "r"
647 0 3 if $style eq "square" or $style eq "s"
648 0 3 unless ($style >= 0 and $style <= 2)
715 0 3 unless (defined $linejoin)
721 0 3 if $style eq "miter" or $style eq "m"
722 0 3 if $style eq "round" or $style eq "r"
723 0 3 if $style eq "bevel" or $style eq "b"
724 0 3 unless ($style >= 0 and $style <= 2)
775 0 3 unless (defined $ratio)
839 4 7 if (@pat) { }
843 1 3 if ($pat[0] =~ /^\-?pattern/ or $pat[0] =~ /^\-?shift/) { }
846 1 0 if (defined $pat{'-pattern'} and not defined $pat{'pattern'})
847 1 0 if (defined $pat{'-shift'} and not defined $pat{'shift'})
866 0 11 if (scalar @pat == 1 and $pat[0] == -1)
870 0 1 if (scalar @pat == 2 and ref $pat[0] eq "ARRAY" and ref $pat[1] eq "")
872 0 0 if (@{$pat[0];}) { }
914 0 3 if ($tolerance < 0)
915 0 3 if ($tolerance > 100)
924 0 3 unless (defined $tolerance)
987 0 134 if ($self->_in_text_object) { }
1066 0 101 if ($self->_in_text_object) { }
1101 0 2 if ($self->_in_text_object) { }
1116 0 1 if ($self->_in_text_object) { }
1151 0 2 unless (@_ % 2 == 0)
1226 1 1 if ($x2 < $x1)
1231 0 2 if ($y2 < $y1)
1384 0 228 unless (defined $dir)
1386 0 228 if ($rx <= 0 or $ry <= 0)
1390 0 228 if ($alpha == $beta)
1403 0 228 if (not $dir and $alpha > $beta)
1404 0 0 if ($alpha == 360.0 and $beta == 0.0) { }
0 0 elsif ($alpha == 360.0) { }
0 0 elsif ($beta == 0.0) { }
1417 2 226 if ($dir and $alpha < $beta)
1418 0 2 if ($alpha == 0.0 and $beta == 360.0) { }
2 0 elsif ($alpha == 0.0) { }
0 0 elsif ($beta == 360.0) { }
1434 106 120 if (abs $beta - $alpha > 30) { }
1493 4 1 unless (defined $dir)
1501 3 2 if $move
1554 1 0 unless (defined $dir)
1597 0 125 if ($self->_in_text_object) { }
1877 0 1 if (defined $opts{'-firstseg'} and not defined $opts{'firstseg'})
1878 0 1 if (defined $opts{'-lastseg'} and not defined $opts{'lastseg'})
1879 0 1 if (defined $opts{'-ratio'} and not defined $opts{'ratio'})
1880 0 1 if (defined $opts{'-colinear'} and not defined $opts{'colinear'})
1881 0 1 if (defined $opts{'-debug'} and not defined $opts{'debug'})
1889 0 1 if (defined $opts{'firstseg'}) { }
1894 0 1 if (defined $opts{'lastseg'}) { }
1901 0 1 if (defined $opts{'ratio'}) { }
1904 0 0 if ($ratio <= "0.1")
1909 0 1 if (defined $opts{'colinear'}) { }
1915 0 1 if (defined $opts{'debug'}) { }
1930 0 7 if ($inputs[-2][0] == $inputs[-1][0] and $inputs[-2][1] == $inputs[-1][1])
1941 0 1 if (scalar @inputs == 1) { }
0 1 elsif (scalar @inputs == 2) { }
0 1 elsif (scalar @inputs == 3) { }
1950 0 0 if ($firstseg ne "curve")
1951 0 0 if ($lastseg ne "curve")
1956 0 1 if ($debug > 0)
1983 7 1 if ($i < $last)
1994 6 2 if ($i > 0 and $i < $last)
1996 0 6 if ($polyline[$i - 1][0] == $polyline[$i][0] and $polyline[$i - 1][1] == $polyline[$i][1])
2001 0 0 if ($i == 1)
2003 0 0 if ($firstseg =~ /^constraint/) { }
2013 0 0 if ($i == $last - 1)
2015 0 0 if ($lastseg =~ /^constraint/) { }
2038 7 1 if ($i > 0)
2041 7 1 if ($i < $last)
2045 1 7 if ($i == 0 or $i < $last and $colinpt[$i]) { }
1 6 elsif ($i == $last) { }
2048 0 1 if ($i > 0)
2067 0 6 if ($l == 0) { }
2083 0 1 if ($debug > 0)
2095 0 0 if ($debug > 1)
2105 0 0 if ($debug > 2)
2117 0 0 if ($debug > 3)
2133 0 1 if ($colinpt[$i]) { }
2144 0 1 if ($colinpt[$i]) { }
2164 0 1 if ($firstseg eq 'line1') { }
0 1 elsif ($firstseg eq 'line2') { }
0 1 elsif ($firstseg eq 'constraint1') { }
0 1 elsif ($firstseg eq 'constraint2') { }
2201 0 1 if ($lastseg eq 'line1') { }
0 1 elsif ($lastseg eq 'line2') { }
0 1 elsif ($lastseg eq 'constraint1') { }
0 1 elsif ($lastseg eq 'constraint2') { }
2244 0 4 if ($colinpt[$i]) { }
2248 0 0 unless ($colinpt[$j])
2253 0 0 if ($colinear eq 'line' and $j > $i) { }
2278 0 0 if ($dtheta >= 0 and $dthetap < 0 or $dtheta < 0 and $dthetap >= 0) { }
2288 0 0 if ($odd) { }
2320 0 0 if ($odd)
2321 0 0 if ($same) { }
2355 0 1 if ($debug > 3)
2359 0 0 if ($i < $last and $type[$i] == 1 || $type[$i] == 3)
2388 0 1 if ($debug > 0)
2397 1 0 if ($type[0] < 2) { }
2403 0 7 if ($type[$i] > 1)
2404 7 0 if ($type[$i] == 0) { }
2430 1 1 if ($ptheta >= 0 and $ttheta >= 0 or $ptheta < 0 and $ttheta < 0) { }
2435 0 1 if ($ttheta < 0) { }
2440 0 1 if ($ttheta <= $antip) { }
2455 2 0 if ($ptheta >= 0) { }
2456 0 2 if ($dtheta >= 0) { }
2460 2 0 if ($max >= -$dtheta) { }
2468 0 0 if ($dtheta >= 0) { }
2470 0 0 if ($max >= $dtheta) { }
2554 0 8 if ($x1 == $x2 and $y1 == $y2)
2558 0 8 if ($r <= 0)
2562 0 8 unless defined $move
2563 4 4 unless defined $larc
2564 6 2 unless defined $dir
2571 0 8 if $dx < 0
2577 2 6 if $dir
2581 0 8 if ($z > $d)
2588 2 6 if $larc
2595 2 6 if ($dir)
2610 2 6 if $move
2618 0 72 if (scalar @points == 0) { }
2710 0 3 if (@_ == 2) { }
2712 0 0 if (defined $opts{'-rule'} and not defined $opts{'rule'})
2713 0 0 if (($opts{'rule'} // "nonzero") eq "even-odd")
2720 2 1 $even_odd ? :
2782 0 4 if (@_ == 2) { }
2784 0 0 if (defined $opts{'-rule'} and not defined $opts{'rule'})
2785 0 0 if (($opts{'rule'} // "nonzero") eq "even-odd")
2792 2 2 $even_odd ? :
2866 0 3 if (@_ == 2) { }
2868 0 0 if (defined $opts{'-rule'} and not defined $opts{'rule'})
2869 0 0 if (($opts{'rule'} // "nonzero") eq "even-odd")
2876 2 1 $even_odd ? :
3061 31 5 if (scalar @clr == 1) { }
5 0 elsif (scalar @clr > 1) { }
3062 0 31 if (ref $clr[0]) { }
25 6 elsif ($clr[0] =~ /^[a-z#!]/i) { }
2 4 elsif ($clr[0] =~ /^%/) { }
2 2 elsif ($clr[0] =~ /^[\$\&]/) { }
3064 0 0 $sf ? :
0 0 $sf ? :
3071 15 10 $sf ? :
3077 1 1 $sf ? :
3082 2 0 unless (defined $self->resource("ColorSpace", "LabS"))
3091 1 1 $sf ? :
1 1 $sf ? :
3097 1 1 $sf ? :
3104 1 4 if (ref $clr[0]) { }
2 2 elsif (scalar @clr == 3) { }
2 0 elsif (scalar @clr == 4) { }
3110 0 1 $sf ? :
3112 0 1 $sf ? :
3130 1 1 $sf ? :
3139 1 1 $sf ? :
3155 0 16 unless (&Scalar::Util::looks_like_number($val))
3156 1 15 if ($val < $min) { }
2 13 elsif ($val > $max) { }
3168 0 20 if (ref($clrs[0]) =~ /^PDF::Builder::Resource::ColorSpace/) { }
0 20 elsif (ref($clrs[0]) =~ /^PDF::Builder::Resource::Pattern/) { }
3182 20 0 if (@_) { }
3185 0 20 if ($self->_in_text_object) { }
3186 0 0 if ($self->{' doPending'}) { }
3192 0 20 if ($self->{' doPending'}) { }
3209 1 15 if (ref($clrs[0]) =~ /^PDF::Builder::Resource::ColorSpace/) { }
0 15 elsif (ref($clrs[0]) =~ /^PDF::Builder::Resource::Pattern/) { }
3223 16 0 if (@_) { }
3226 0 16 if ($self->_in_text_object) { }
3227 0 0 if ($self->{' doPending'}) { }
3233 0 16 if ($self->{' doPending'}) { }
3291 0 8 unless (defined $y)
3292 0 8 unless (defined $x)
3295 0 8 if (ref $img eq "ARRAY")
3302 0 8 if (defined $img->{'Metadata'})
3306 0 8 if (not defined $w) { }
0 8 elsif (not defined $h) { }
3319 0 8 if (defined $img->{'Metadata'})
3363 0 2 unless (defined $y)
3364 0 2 unless (defined $x)
3368 0 2 unless (defined $sx)
3369 2 0 unless (defined $sy)
3453 0 0 if (UNIVERSAL::isa($object, 'PDF::Builder::Resource::XObject::Image')) { }
0 0 elsif (ref $object eq 'ARRAY') { }
3460 0 0 if (defined $object->[0]) { }
3473 0 0 unless (defined $width and defined $vwidth and defined $height and defined $vheight)
3483 0 0 if ($flag) { }
3494 0 0 if ($x == 0 and $y == 0)
3500 0 0 if ($bb[3] > 0) { }
3621 14 5 if (defined $space) { }
3680 17 5 if (defined $space) { }
3723 9 16 if (defined $scale) { }
3773 10 38 if (defined $leading) { }
3828 1 0 if (defined $mode) { }
3868 1 0 if (defined $dist) { }
3899 0 0 if (@_) { }
3902 0 0 unless $state{$k}
3905 0 0 if ($state{'font'} and $state{'fontsize'})
3908 0 0 if ($state{'textmatrix'})
3915 0 0 if ($state{'fillcolor'})
3918 0 0 if ($state{'strokecolor'})
3975 1 16 if ($font->isvirtual) { }
3985 0 18 unless (defined $font)
3992 1 17 unless ($size)
3997 0 17 if ($self->{' doPending'}) { }
4014 1 16 if ($font->isvirtual) { }
4051 0 0 if (defined $x and not defined $y)
4055 0 0 if (defined $x)
4187 5 2 if (defined $offset) { }
4236 1 23 if (defined $indent and $indent != 0)
4266 0 0 if ($leading or not $self->{' fontsize'}) { }
4348 0 181 unless defined $text and length $text
4351 903 2 unless defined $opts{$k}
4357 0 181 unless defined $opts{'font'}
4496 0 0 if (ref $underline eq 'ARRAY') { }
4499 0 0 if ($underline eq "none")
4502 0 0 if @underline % 2
4515 0 0 if (ref $thickness)
4519 0 0 if ($distance eq "auto")
4522 0 0 if ($thickness eq "auto")
4528 0 0 if (scalar @{$xy1;} > 2) { }
4556 0 0 if (ref $strikethru eq 'ARRAY') { }
4559 0 0 if ($strikethru eq "none")
4562 0 0 if @strikethru % 2
4579 0 0 if (ref $thickness)
4583 0 0 if ($distance eq "auto")
4586 0 0 if ($thickness eq "auto")
4592 0 0 if (scalar @{$xy1;} > 2) { }
4618 0 31 if (defined $opts{'-align'} and not defined $opts{'align'})
4619 1 30 if (defined $opts{'-indent'} and not defined $opts{'indent'})
4620 0 31 if (defined $opts{'-underline'} and not defined $opts{'underline'})
4621 0 31 if (defined $opts{'-strokecolor'} and not defined $opts{'strokecolor'})
4622 0 31 if (defined $opts{'-strikethru'} and not defined $opts{'strikethru'})
4625 26 5 if (defined $opts{'align'})
4627 17 9 if ($align eq 'l' or $align eq 'left') { }
6 3 elsif ($align eq 'c' or $align eq 'center') { }
3 0 elsif ($align eq 'r' or $align eq 'right') { }
0 0 elsif ($align eq 'j' or $align eq 'justified') { }
4642 1 30 if ($self->{' fontset'} == 0)
4643 1 0 unless (defined $self->{' font'} and $self->{' fontsize'})
4653 3 27 if (defined $opts{'indent'})
4661 21 9 if ($align eq 'l' or $align eq 'j') { }
6 3 elsif ($align eq 'c') { }
4671 12 18 if $indent
4675 12 18 if ($indent) { }
4698 0 30 if (defined $opts{'underline'})
4702 0 30 if (defined $opts{'strikethru'})
4713 0 0 if (defined $obj) { }
4893 0 0 if (defined $opts{'-underline'} and not defined $opts{'underline'})
4894 0 0 if (defined $opts{'-strikethru'} and not defined $opts{'strikethru'})
4895 0 0 if (defined $opts{'-strokecolor'} and not defined $opts{'strokecolor'})
4906 0 0 if (defined $settings->{'language'})
4914 0 0 if ($feature ne "-kern")
4918 0 0 if ($dir eq "T" or $dir eq "B")
4921 0 0 if ($self->{' fontset'} == 0)
4922 0 0 unless (defined $self->{' font'} and $self->{' fontsize'})
4947 0 0 if ($dir eq 'L' or $dir eq 'T') { }
4948 0 0 if ($align eq 'B') { }
0 0 elsif ($align eq 'C') { }
4956 0 0 if ($align eq 'B') { }
0 0 elsif ($align eq 'C') { }
4964 0 0 if ($mult != 0)
4965 0 0 if ($dir eq 'L' or $dir eq 'R') { }
4987 0 0 if ($dokern)
4996 0 0 if ($kernPts != 0)
4997 0 0 if (int abs($kernPts * 1000 / $fontsize) + "0.5" <= $minKern)
5003 0 0 if ($dump and $cw != $ax)
5011 0 0 if ($dump)
5013 0 0 if ($glyph->{'name'} ne "")
5019 0 0 if (defined $glyph->{'axs'}) { }
0 0 elsif (defined $glyph->{'axsp'}) { }
0 0 elsif (defined $glyph->{'axr'}) { }
0 0 elsif (defined $glyph->{'axrp'}) { }
5029 0 0 if ($dump)
5032 0 0 if ($ay != 0 or $dx != 0 or $dy != 0)
5035 0 0 if ($kernPts != 0)
5046 0 0 if ($dy != 0) { }
5087 0 0 if ($dir eq 'L' or $dir eq 'T') { }
5088 0 0 if ($align eq 'B') { }
0 0 elsif ($align eq 'C') { }
5097 0 0 if ($align eq 'B') { }
0 0 elsif ($align eq 'C') { }
5104 0 0 if ($dir eq 'L' or $dir eq 'R') { }
5110 0 0 if ($dir eq 'L' or $dir eq 'R') { }
5118 0 0 if ($dir eq 'L' || $dir eq 'R' and $ulxy1[1] > $ulxy2[1] or $dir eq 'T' || $dir eq 'B' and $ulxy1[2] < $ulxy2[2])
5126 0 0 if (defined $opts{'underline'})
5129 0 0 if (defined $opts{'strikethru'})
5145 0 284 if (defined $item and $item ne "")
5161 0 1096 if (defined $item and $item ne "")
5171 0 0 if ($self->{' openglyphlist'})
5178 0 0 unless ($self->{' openglyphlist'})
5193 0 0 unless ($self->{' openglyphlist'})
5199 0 0 if ($dx == $kern) { }
5287 0 0 if (defined $opts{'-doKern'} and not defined $opts{'doKern'})
5288 0 0 if (defined $opts{'-minKern'} and not defined $opts{'minKern'})
5291 0 0 if ($self->{' fontset'} == 0)
5292 0 0 unless (defined $self->{' font'} and $self->{' fontsize'})
5302 0 0 if ($dir eq "T" or $dir eq "B")
5324 0 0 if ($dir eq "T" or $dir eq "B")
5328 0 0 if (defined $glyph->{'axs'}) { }
0 0 elsif (defined $glyph->{'axsp'}) { }
0 0 elsif (defined $glyph->{'axr'}) { }
0 0 elsif (defined $glyph->{'axrp'}) { }
5337 0 0 if ($doKern)
5347 0 0 if ($kernPts > 0)
5348 0 0 if (int abs($kernPts * 1000 / $fontsize) + "0.5" <= $minKern)
5407 0 11 if ($self->_in_text_object) { }
5409 0 0 unless ($MSG_COUNT[2])
5443 0 11 if ($self->_in_text_object) { }
5527 0 0 if (@_)
5528 0 0 unless ($self->{' poststream'} =~ /\s$/)
5540 919 0 if (@_)
5541 159 760 unless (defined $self->{' stream'} and $self->{' stream'} =~ /\s$/)
5548 2521 0 if (defined $_)
5549 919 1602 if ($ecstr eq '') { }
5556 919 0 if ($ecstr ne "")
5567 0 0 if (@_)
5628 20 0 unless ($self->_in_text_object)
5674 16 136 if ($self->_in_text_object)
5687 32 2 if ($self->{' apipage'}) { }
5695 0 2 if ref($dict) =~ /Objind$/
5698 0 2 if ref($dict->{$type}) =~ /Objind$/
5699 2 0 if (defined $obj) { }
5702 0 2 if ($force) { }