Branch Coverage

blib/lib/PDF/Builder/Content.pm
Criterion Covered Total %
branch 277 638 43.4


line true false branch
107 0 0 if ($self->{'-docompress'} and $self->{'Filter'})
286 36 39 unless defined $opts{$o}
288 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') { }
325 0 15 if ($opts{'point'})
342 7 9 if ($opts{'-translate'} and not defined $opts{'translate'})
343 7 9 if ($opts{'-rotate'} and not defined $opts{'rotate'})
344 7 9 if ($opts{'-scale'} and not defined $opts{'scale'})
345 7 9 if ($opts{'-skew'} and not defined $opts{'skew'})
346 0 16 if ($opts{'-point'} and not defined $opts{'point'})
347 0 16 if ($opts{'-matrix'} and not defined $opts{'matrix'})
348 0 16 if ($opts{'-repeat'} and not defined $opts{'repeat'})
351 1 15 if $opts{'repeat'}
356 12 3 if ($opts{'translate'}) { }
362 9 6 if ($opts{'rotate'}) { }
368 9 6 if ($opts{'scale'}) { }
374 9 6 if ($opts{'skew'}) { }
396 1 1 if (defined $opts{'-skew'} and not defined $opts{'skew'})
397 1 1 if (defined $opts{'-scale'} and not defined $opts{'scale'})
398 1 1 if (defined $opts{'-rotate'} and not defined $opts{'rotate'})
399 1 1 if (defined $opts{'-translate'} and not defined $opts{'translate'})
401 2 0 $opts{'skew'} ? :
404 2 0 $opts{'scale'} ? :
410 2 0 $opts{'translate'} ? :
465 26 0 if (defined $a)
466 3 23 if ($self->_in_text_object) { }
474 3 23 if ($self->_in_text_object) { }
513 0 89 unless (defined $linewidth)
567 0 3 unless (defined $linecap)
573 0 3 if $style eq "butt" or $style eq "b"
574 0 3 if $style eq "round" or $style eq "r"
575 0 3 if $style eq "square" or $style eq "s"
576 0 3 unless ($style >= 0 and $style <= 2)
637 0 3 unless (defined $linejoin)
643 0 3 if $style eq "miter" or $style eq "m"
644 0 3 if $style eq "round" or $style eq "r"
645 0 3 if $style eq "bevel" or $style eq "b"
646 0 3 unless ($style >= 0 and $style <= 2)
691 0 3 unless (defined $ratio)
746 4 7 if (@pat) { }
750 1 3 if ($pat[0] =~ /^\-?pattern/ or $pat[0] =~ /^\-?shift/) { }
753 1 0 if (defined $pat{'-pattern'} and not defined $pat{'pattern'})
754 1 0 if (defined $pat{'-shift'} and not defined $pat{'shift'})
772 0 11 if (scalar @pat == 1 and $pat[0] == -1)
803 0 3 if ($tolerance < 0)
804 0 3 if ($tolerance > 100)
813 0 3 unless (defined $tolerance)
867 0 116 if ($self->_in_text_object) { }
960 0 101 if ($self->_in_text_object) { }
988 0 2 if ($self->_in_text_object) { }
1002 0 1 if ($self->_in_text_object) { }
1031 0 2 unless (@_ % 2 == 0)
1092 1 1 if ($x2 < $x1)
1097 0 2 if ($y2 < $y1)
1225 0 228 unless (defined $dir)
1227 0 228 if ($rx <= 0 or $ry <= 0)
1231 0 228 if ($alpha == $beta)
1244 0 228 if (not $dir and $alpha > $beta)
1245 0 0 if ($alpha == 360 and $beta == 0) { }
0 0 elsif ($alpha == 360) { }
0 0 elsif ($beta == 0) { }
1258 2 226 if ($dir and $alpha < $beta)
1259 0 2 if ($alpha == 0 and $beta == 360) { }
2 0 elsif ($alpha == 0) { }
0 0 elsif ($beta == 360) { }
1275 106 120 if (abs $beta - $alpha > 30) { }
1328 4 1 unless (defined $dir)
1335 3 2 if $move
1382 1 0 unless (defined $dir)
1417 0 125 if ($self->_in_text_object) { }
1678 0 1 if (defined $opts{'-firstseg'} and not defined $opts{'firstseg'})
1679 0 1 if (defined $opts{'-lastseg'} and not defined $opts{'lastseg'})
1680 0 1 if (defined $opts{'-ratio'} and not defined $opts{'ratio'})
1681 0 1 if (defined $opts{'-colinear'} and not defined $opts{'colinear'})
1682 0 1 if (defined $opts{'-debug'} and not defined $opts{'debug'})
1690 0 1 if (defined $opts{'firstseg'}) { }
1695 0 1 if (defined $opts{'lastseg'}) { }
1702 0 1 if (defined $opts{'ratio'}) { }
1705 0 0 if ($ratio <= "0.1")
1710 0 1 if (defined $opts{'colinear'}) { }
1716 0 1 if (defined $opts{'debug'}) { }
1730 0 7 if ($inputs[-2][0] == $inputs[-1][0] and $inputs[-2][1] == $inputs[-1][1])
1741 0 1 if (scalar @inputs == 1) { }
0 1 elsif (scalar @inputs == 2) { }
0 1 elsif (scalar @inputs == 3) { }
1750 0 0 if ($firstseg ne "curve")
1751 0 0 if ($lastseg ne "curve")
1756 0 1 if ($debug > 0)
1783 7 1 if ($i < $last)
1794 6 2 if ($i > 0 and $i < $last)
1796 0 6 if ($polyline[$i - 1][0] == $polyline[$i][0] and $polyline[$i - 1][1] == $polyline[$i][1])
1801 0 0 if ($i == 1)
1803 0 0 if ($firstseg =~ /^constraint/) { }
1813 0 0 if ($i == $last - 1)
1815 0 0 if ($lastseg =~ /^constraint/) { }
1838 7 1 if ($i > 0)
1841 7 1 if ($i < $last)
1845 1 7 if ($i == 0 or $i < $last and $colinpt[$i]) { }
1 6 elsif ($i == $last) { }
1848 0 1 if ($i > 0)
1867 0 6 if ($l == 0) { }
1883 0 1 if ($debug > 0)
1895 0 0 if ($debug > 1)
1905 0 0 if ($debug > 2)
1917 0 0 if ($debug > 3)
1933 0 1 if ($colinpt[$i]) { }
1944 0 1 if ($colinpt[$i]) { }
1964 0 1 if ($firstseg eq 'line1') { }
0 1 elsif ($firstseg eq 'line2') { }
0 1 elsif ($firstseg eq 'constraint1') { }
0 1 elsif ($firstseg eq 'constraint2') { }
2001 0 1 if ($lastseg eq 'line1') { }
0 1 elsif ($lastseg eq 'line2') { }
0 1 elsif ($lastseg eq 'constraint1') { }
0 1 elsif ($lastseg eq 'constraint2') { }
2044 0 4 if ($colinpt[$i]) { }
2048 0 0 unless ($colinpt[$j])
2053 0 0 if ($colinear eq 'line' and $j > $i) { }
2078 0 0 if ($dtheta >= 0 and $dthetap < 0 or $dtheta < 0 and $dthetap >= 0) { }
2088 0 0 if ($odd) { }
2120 0 0 if ($odd)
2121 0 0 if ($same) { }
2155 0 1 if ($debug > 3)
2159 0 0 if ($i < $last and $type[$i] == 1 || $type[$i] == 3)
2188 0 1 if ($debug > 0)
2197 1 0 if ($type[0] < 2) { }
2203 0 7 if ($type[$i] > 1)
2204 7 0 if ($type[$i] == 0) { }
2230 1 1 if ($ptheta >= 0 and $ttheta >= 0 or $ptheta < 0 and $ttheta < 0) { }
2235 0 1 if ($ttheta < 0) { }
2240 0 1 if ($ttheta <= $antip) { }
2255 2 0 if ($ptheta >= 0) { }
2256 0 2 if ($dtheta >= 0) { }
2260 2 0 if ($max >= -$dtheta) { }
2268 0 0 if ($dtheta >= 0) { }
2270 0 0 if ($max >= $dtheta) { }
2333 0 8 if ($x1 == $x2 and $y1 == $y2)
2336 0 8 if ($r <= 0)
2339 0 8 unless defined $move
2340 4 4 unless defined $larc
2341 6 2 unless defined $spf
2347 0 8 if $dx < 0
2353 2 6 if $spf
2357 0 8 if ($z > $d)
2364 2 6 if $larc
2371 2 6 if ($spf)
2386 2 6 if $move
2394 0 72 if (scalar @points == 0) { }
2475 0 3 if (@_ == 2) { }
2477 0 0 if (defined $opts{'-rule'} and not defined $opts{'rule'})
2478 0 0 if (($opts{'rule'} // "nonzero") eq "even-odd")
2485 2 1 $even_odd ? :
2541 0 4 if (@_ == 2) { }
2543 0 0 if (defined $opts{'-rule'} and not defined $opts{'rule'})
2544 0 0 if (($opts{'rule'} // "nonzero") eq "even-odd")
2551 2 2 $even_odd ? :
2619 0 3 if (@_ == 2) { }
2621 0 0 if (defined $opts{'-rule'} and not defined $opts{'rule'})
2622 0 0 if (($opts{'rule'} // "nonzero") eq "even-odd")
2629 2 1 $even_odd ? :
2772 31 5 if (scalar @clr == 1) { }
5 0 elsif (scalar @clr > 1) { }
2773 0 31 if (ref $clr[0]) { }
25 6 elsif ($clr[0] =~ /^[a-z#!]/i) { }
2 4 elsif ($clr[0] =~ /^%/) { }
2 2 elsif ($clr[0] =~ /^[\$\&]/) { }
2775 0 0 $sf ? :
0 0 $sf ? :
2781 15 10 $sf ? :
2786 1 1 $sf ? :
2791 2 0 unless (defined $self->resource("ColorSpace", "LabS"))
2799 1 1 $sf ? :
1 1 $sf ? :
2804 1 1 $sf ? :
2811 1 4 if (ref $clr[0]) { }
2 2 elsif (scalar @clr == 3) { }
2 0 elsif (scalar @clr == 4) { }
2815 0 1 $sf ? :
0 1 $sf ? :
2831 1 1 $sf ? :
2839 1 1 $sf ? :
2855 0 16 unless (&Scalar::Util::looks_like_number($val))
2856 1 15 if ($val < $min) { }
2 13 elsif ($val > $max) { }
2868 0 20 if (ref($clrs[0]) =~ /^PDF::Builder::Resource::ColorSpace/) { }
0 20 elsif (ref($clrs[0]) =~ /^PDF::Builder::Resource::Pattern/) { }
2882 20 0 if (@_) { }
2896 1 15 if (ref($clrs[0]) =~ /^PDF::Builder::Resource::ColorSpace/) { }
0 15 elsif (ref($clrs[0]) =~ /^PDF::Builder::Resource::Pattern/) { }
2910 16 0 if (@_) { }
2958 0 8 unless (defined $y)
2959 0 8 unless (defined $x)
2961 0 8 if (defined $img->{'Metadata'})
2965 0 8 if (not defined $w) { }
0 8 elsif (not defined $h) { }
2978 0 8 if (defined $img->{'Metadata'})
3016 0 2 unless (defined $y)
3017 0 2 unless (defined $x)
3021 0 2 unless (defined $sx)
3022 2 0 unless (defined $sy)
3069 0 0 if ($object->isa('PDF::Builder::Resource::XObject::Image')) { }
3136 14 5 if (defined $space) { }
3182 17 5 if (defined $space) { }
3219 9 16 if (defined $scale) { }
3273 12 38 if (defined $leading) { }
3322 1 0 if (defined $mode) { }
3356 1 0 if (defined $dist) { }
3381 0 0 if (@_) { }
3384 0 0 unless $state{$k}
3387 0 0 if ($state{'font'} and $state{'fontsize'})
3390 0 0 if ($state{'textmatrix'})
3397 0 0 if ($state{'fillcolor'})
3400 0 0 if ($state{'strokecolor'})
3442 1 16 if ($font->isvirtual) { }
3452 1 17 unless ($size)
3469 1 16 if ($font->isvirtual) { }
3504 0 0 if (defined $x and not defined $y)
3508 0 0 if (defined $x)
3611 5 2 if (defined $offset) { }
3648 1 23 if (defined $indent and $indent != 0)
3671 0 0 if ($leading or not $self->{' fontsize'}) { }
3740 0 190 unless defined $text and length $text
3743 948 2 unless defined $opts{$k}
3836 0 0 if (ref $underline eq 'ARRAY') { }
3839 0 0 if ($underline eq "none")
3842 0 0 if @underline % 2
3854 0 0 if (ref $thickness)
3858 0 0 if ($distance eq "auto")
3861 0 0 if ($thickness eq "auto")
3867 0 0 if (scalar @{$xy1;} > 2) { }
3895 0 0 if (ref $strikethru eq 'ARRAY') { }
3898 0 0 if ($strikethru eq "none")
3901 0 0 if @strikethru % 2
3917 0 0 if (ref $thickness)
3921 0 0 if ($distance eq "auto")
3924 0 0 if ($thickness eq "auto")
3930 0 0 if (scalar @{$xy1;} > 2) { }
3956 1 30 if (defined $opts{'-indent'} and not defined $opts{'indent'})
3957 0 31 if (defined $opts{'-underline'} and not defined $opts{'underline'})
3958 0 31 if (defined $opts{'-strokecolor'} and not defined $opts{'strokecolor'})
3959 0 31 if (defined $opts{'-strikethru'} and not defined $opts{'strikethru'})
3962 1 30 if ($self->{' fontset'} == 0)
3963 1 0 unless (defined $self->{' font'} and $self->{' fontsize'})
3969 12 18 if (defined $opts{'indent'})
3975 12 18 if (defined $opts{'indent'}) { }
3988 0 30 if (defined $opts{'underline'})
3992 0 30 if (defined $opts{'strikethru'})
4003 0 0 if (defined $obj) { }
4183 0 0 if (defined $opts{'-underline'} and not defined $opts{'underline'})
4184 0 0 if (defined $opts{'-strikethru'} and not defined $opts{'strikethru'})
4185 0 0 if (defined $opts{'-strokecolor'} and not defined $opts{'strokecolor'})
4194 0 0 if (defined $settings->{'language'})
4202 0 0 if ($feature ne "-kern")
4206 0 0 if ($dir eq "T" or $dir eq "B")
4209 0 0 if ($self->{' fontset'} == 0)
4210 0 0 unless (defined $self->{' font'} and $self->{' fontsize'})
4235 0 0 if ($dir eq 'L' or $dir eq 'T') { }
4236 0 0 if ($align eq 'B') { }
0 0 elsif ($align eq 'C') { }
4244 0 0 if ($align eq 'B') { }
0 0 elsif ($align eq 'C') { }
4252 0 0 if ($mult != 0)
4253 0 0 if ($dir eq 'L' or $dir eq 'R') { }
4275 0 0 if ($dokern)
4284 0 0 if ($kernPts != 0)
4285 0 0 if (int abs($kernPts * 1000 / $fontsize) + "0.5" <= $minKern)
4291 0 0 if ($dump and $cw != $ax)
4299 0 0 if ($dump)
4301 0 0 if ($glyph->{'name'} ne "")
4307 0 0 if (defined $glyph->{'axs'}) { }
0 0 elsif (defined $glyph->{'axsp'}) { }
0 0 elsif (defined $glyph->{'axr'}) { }
0 0 elsif (defined $glyph->{'axrp'}) { }
4317 0 0 if ($dump)
4320 0 0 if ($ay != 0 or $dx != 0 or $dy != 0)
4323 0 0 if ($kernPts != 0)
4334 0 0 if ($dy != 0) { }
4375 0 0 if ($dir eq 'L' or $dir eq 'T') { }
4376 0 0 if ($align eq 'B') { }
0 0 elsif ($align eq 'C') { }
4385 0 0 if ($align eq 'B') { }
0 0 elsif ($align eq 'C') { }
4392 0 0 if ($dir eq 'L' or $dir eq 'R') { }
4398 0 0 if ($dir eq 'L' or $dir eq 'R') { }
4406 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])
4414 0 0 if (defined $opts{'underline'})
4417 0 0 if (defined $opts{'strikethru'})
4426 0 0 if ($self->{' openglyphlist'})
4433 0 0 unless ($self->{' openglyphlist'})
4448 0 0 unless ($self->{' openglyphlist'})
4454 0 0 if ($dx == $kern) { }
4536 0 0 if (defined $opts{'-doKern'} and not defined $opts{'doKern'})
4537 0 0 if (defined $opts{'-minKern'} and not defined $opts{'minKern'})
4540 0 0 if ($self->{' fontset'} == 0)
4541 0 0 unless (defined $self->{' font'} and $self->{' fontsize'})
4551 0 0 if ($dir eq "T" or $dir eq "B")
4573 0 0 if ($dir eq "T" or $dir eq "B")
4577 0 0 if (defined $glyph->{'axs'}) { }
0 0 elsif (defined $glyph->{'axsp'}) { }
0 0 elsif (defined $glyph->{'axr'}) { }
0 0 elsif (defined $glyph->{'axrp'}) { }
4586 0 0 if ($doKern)
4596 0 0 if ($kernPts > 0)
4597 0 0 if (int abs($kernPts * 1000 / $fontsize) + "0.5" <= $minKern)
4741 0 0 if (@_)
4742 0 0 unless ($self->{' poststream'} =~ /\s$/)
4754 905 0 if (@_)
4755 161 744 unless ($self->{' stream'} =~ /\s$/)
4767 0 0 if (@_)
4816 21 0 unless ($self->_in_text_object)
4856 17 137 if ($self->_in_text_object)
4873 32 2 if ($self->{' apipage'}) { }
4881 0 2 if ref($dict) =~ /Objind$/
4884 0 2 if ref($dict->{$type}) =~ /Objind$/
4885 2 0 if (defined $obj) { }
4888 0 2 if ($force) { }