Layout/Testing.pm

filter: Statementstmt 82.0% 32 / 39 Branchbran 100% 4 / 4 Conditioncond 88.8% 16 / 18 MC/DCmcdc 66.6% 6 / 9 Subroutinesub 72.7% 8 / 11 Podpod 25.0% 1 / 4 totaltotal 78.8% 67 / 85 CC 11 SCAR 18.6
CC
11
Cov
85%
_debug_text
11.0
render
2.0
bbox
2.0
CRAP 6.4
« Layout/Utils.pm ↑ Summary Layout/FontDescriptor.pm »
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"}
l!l&&r!l&&!r
55150
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"}
ABresult
1X1
011
000
52 70 for ( keys %$f ) {
53 $f->{$_} = sprintf("%.3f",$f->{$_})
54 980 ▶ if $_ eq "size" && defined($f->{$_}) && int($f->{$_}) != $f->{$_};
Branch: 1 branch
BranchTrueFalseTotal
if $_ eq "size" and defined $f->{$_} and int $f->{$_} != $f->{$_} 2 978 980
Condition83%5/6
$_ eq "size" and defined $f->{$_} and int $f->{$_} != $f->{$_}
!ll&&!rl&&r
910682
$_ eq "size" and defined $f->{$_}
!ll&&!rl&&r
910070
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->{$_}
ABCresult
0XX0
10X0
1100
1111
55 next if defined($f->{$_})
56 980 ▶ && ! ( !$f->{$_} || /col/ && $f->{$_} eq 'black' );
Branch: 1 branch
BranchTrueFalseTotal
if defined $f->{$_} and not !$f->{$_} || /col/ && $f->{$_} eq "black" 293 687 980
Condition100%9/9
defined $f->{$_} and not !$f->{$_} || /col/ && $f->{$_} eq "black"
!ll&&!rl&&r
343344293
!$f->{$_} || /col/ && $f->{$_} eq 'black'
l!l&&r!l&&!r
70274293
/col/ and $f->{$_} eq "black"
!ll&&!rl&&r
2876274
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"
ABCDresult
0XXX0
11XX0
10110
100X1
10101
57 687 delete $f->{$_};
58 }
59 }
60 23 return $c;
61 }
62  
63 4 1;
« Layout/Utils.pm ↑ Summary Layout/FontDescriptor.pm »