| 1 | #! perl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 4 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 4 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | package Text::Layout::Testing; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 4 | ▶ | use parent 'Text::Layout'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 4 | ▶ | use Text::Layout::FontConfig; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 4 | my $fc = Text::Layout::FontConfig->new( corefonts => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | #### API | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 3 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 3 | my ( $pkg, @data ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 3 | my $self = $pkg->SUPER::new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 3 | $self->set_font_description( $fc->from_string("Times 10") ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 3 | $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | #### API | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | ▶ | sub render { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
render: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | my $res = "Testing 1 2 3"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | #### API | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | ▶ | sub bbox { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bbox: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | [ 0, -5, 10, 15 ]; # dummy | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | #### API | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | ▶ | sub load_font { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load_font: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | my ( $self, $description ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | return $description; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | # For testing. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 23 | ▶ | sub _debug_text { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_debug_text: called CC=11 SCAR=24.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 23 | my $c = $_[0]->{_content}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 23 | for my $f ( @$c ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | $f->{font} = $f->{font}->{loader_data} . "(" . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | join(",", $f->{font}->{family}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | $f->{font}->{style}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | $f->{font}->{weight}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 70 | ▶ | $f->{font}->{size} // $f->{size}) . ")"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$f->{"font"}{"size"} // $f->{"size"}
MC/DC0%0/2
$f->{"font"}{"size"} // $f->{"size"}
$f->{"font"}{"size"}
$f->{"size"}
Truth table66%2/3
A // B
A= $f->{"font"}{"size"}B= $f->{"size"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 70 | for ( keys %$f ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | $f->{$_} = sprintf("%.3f",$f->{$_}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 980 | ▶ | if $_ eq "size" && defined($f->{$_}) && int($f->{$_}) != $f->{$_}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$_ eq "size" and defined $f->{$_} and int $f->{$_} != $f->{$_}
$_ eq "size" and defined $f->{$_}
MC/DC66%2/3
$_ eq "size" and defined $f->{$_} and int $f->{$_} != $f->{$_}
$_ eq "size"
defined $f->{$_}
int $f->{$_} != $f->{$_}
Truth table75%3/4
A and B and C
A= $_ eq "size"B= defined $f->{$_}C= int $f->{$_} != $f->{$_}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | next if defined($f->{$_}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 980 | ▶ | && ! ( !$f->{$_} || /col/ && $f->{$_} eq 'black' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%9/9
defined $f->{$_} and not !$f->{$_} || /col/ && $f->{$_} eq "black"
!$f->{$_} || /col/ && $f->{$_} eq 'black'
/col/ and $f->{$_} eq "black"
MC/DC100%4/4
defined $f->{$_} and not !$f->{$_} || /col/ && $f->{$_} eq "black"
defined $f->{$_}
!$f->{$_}
/col/
$f->{$_} eq "black"
Truth table100%5/5
A and not(not(B) || C and D)
A= defined $f->{$_}B= !$f->{$_}C= /col/D= $f->{$_} eq "black"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 687 | delete $f->{$_}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 23 | return $c; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 4 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||