lib/PDF/Boxer/Role/SizePosition.pm

filter: Statementstmt 46.6% 62 / 133 Branchbran 5.1% 3 / 58 Conditioncond 1.0% 1 / 96 MC/DCmcdc 0.0% 0 / 56 Subroutinesub 35.1% 13 / 37 Podpod 7.1% 1 / 14 totaltotal 20.3% 80 / 394 CC 64 SCAR 33.1
CC
64
Cov
23%
move
56.0
set_size
56.0
_build_margin_top
42.0
CRAP 27.4
« lib/PDF/Boxer/Content/Row.pm ↑ Summary lib/PDF/Boxer/Role/Text.pm »
1 package PDF::Boxer::Role::SizePosition;
2 {
3 4 $PDF::Boxer::Role::SizePosition::VERSION = '0.004';
4 }
5 4 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 # ABSTRACT: size and position stuff
7  
8 4 ▶use Carp qw(carp croak confess cluck);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 4 requires qw!margin border padding children!;
11  
12 4 has 'max_width' => ( isa => 'Int', is => 'rw' );
13 4 has 'max_height' => ( isa => 'Int', is => 'rw' );
14  
15 4 has 'width' => ( isa => 'Maybe[Int]', is => 'rw', lazy_build => 1, );
16 4 has 'height' => ( isa => 'Maybe[Int]', is => 'rw', lazy_build => 1, );
17  
18 4 has 'margin_left' => ( isa => 'Maybe[Int]', is => 'rw', lazy_build => 1 );
19 4 has 'margin_top' => ( isa => 'Maybe[Int]', is => 'rw', lazy_build => 1 );
20  
21 4 has 'margin_right' => ( isa => 'Int', is => 'rw', lazy_build => 1 );
22 4 has 'margin_bottom' => ( isa => 'Int', is => 'rw', lazy_build => 1 );
23  
24 4 has 'border_left' => ( isa => 'Int', is => 'ro', lazy_build => 1 );
25 4 has 'border_top' => ( isa => 'Int', is => 'ro', lazy_build => 1 );
26  
27 4 has 'padding_left' => ( isa => 'Int', is => 'ro', lazy_build => 1 );
28 4 has 'padding_top' => ( isa => 'Int', is => 'ro', lazy_build => 1 );
29  
30 4 has 'content_left' => ( isa => 'Int', is => 'ro', lazy_build => 1 );
31 4 has 'content_top' => ( isa => 'Int', is => 'ro', lazy_build => 1 );
32  
33 4 has 'content_right' => ( isa => 'Int', is => 'rw', lazy_build => 1 );
34 4 has 'content_bottom' => ( isa => 'Int', is => 'rw', lazy_build => 1 );
35  
36 4 has 'margin_width' => ( isa => 'Int', is => 'rw', lazy_build => 1 );
37 4 has 'margin_height' => ( isa => 'Int', is => 'rw', lazy_build => 1 );
38  
39 4 has 'border_width' => ( isa => 'Int', is => 'rw', lazy_build => 1 );
40 4 has 'border_height' => ( isa => 'Int', is => 'rw', lazy_build => 1 );
41  
42 4 has 'padding_width' => ( isa => 'Int', is => 'rw', lazy_build => 1 );
43 4 has 'padding_height' => ( isa => 'Int', is => 'rw', lazy_build => 1 );
44  
45  
46 4 has 'grow' => ( isa => 'Bool', is => 'ro', default => 0 );
47  
48 4 has 'attribute_rels' => ( isa => 'HashRef', is => 'ro', lazy_build => 1 );
49  
50 1 ▶sub _build_attribute_rels{
Subroutine _build_attribute_rels: called CC=1 SCAR=0.0
51 return {
52 1 max_width => [qw! margin_right content_right margin_width border_width padding_width !],
53 max_height => [qw! margin_bottom content_bottom margin_height border_height padding_height!],
54 width => [qw! margin_right content_right margin_width border_width padding_width !],
55 height => [qw! margin_bottom content_bottom margin_height border_height padding_height!],
56 margin_left => [qw! margin_right border_left padding_left content_left !],
57 margin_top => [qw! margin_bottom border_top padding_top content_top content_bottom !],
58 margin_right => [qw! margin_left border_left padding_left content_left content_right !],
59 margin_bottom => [qw! margin_top border_top padding_top content_top content_bottom !],
60 margin_width => [qw! width margin_right content_right border_width padding_width !],
61 margin_height => [qw! height margin_bottom content_bottom border_height padding_height !],
62 }
63 }
64  
65  
66 7 ▶sub adjust{
Subroutine adjust: called CC=4 SCAR=13.9
Pod documented
67 7 my ($self, $spec, $sender) = @_;
68  
69 7 foreach my $attr (keys %$spec){
70 7 $self->$attr($spec->{$attr});
71 7 foreach ( @{$self->attribute_rels->{$attr}} ){
72 34 ▶ next if $spec->{$_}; # don't clear anything which is in the spec
Branch: 1 branch
BranchTrueFalseTotal
if $spec->{$_} 0 34 34
73 34 my $clear = 'clear_'.$_;
74 34 $self->$clear();
75 }
76 }
77  
78 }
79  
80 0 ▶sub move{
Subroutine move: not called CC=7 SCAR=40.3
Pod undocumented
81 0 my ($self, $x, $y) = @_;
82 return if
83 0 ▶ ($self->margin_left && $self->margin_left == $x)
Branch: 1 branch
BranchTrueFalseTotal
if $self->margin_left and $self->margin_left == $x and ($self->margin_top and $self->margin_top == $y) 0 0 0
Condition0%0/9
$self->margin_left and $self->margin_left == $x and ($self->margin_top and $self->margin_top == $y)
!ll&&!rl&&r
000
$self->margin_left and $self->margin_left == $x
!ll&&!rl&&r
000
$self->margin_top and $self->margin_top == $y
!ll&&!rl&&r
000
MC/DC0%0/4
$self->margin_left and $self->margin_left == $x and ($self->margin_top and $self->margin_top == $y)
$self->margin_left $self->margin_left == $x $self->margin_top $self->margin_top == $y
Truth table0%0/5
A and B and C and D
A= $self->margin_leftB= $self->margin_left == $xC= $self->margin_topD= $self->margin_top == $y
ABCDresult
0XXX0
10XX0
110X0
11100
11111
84 && ($self->margin_top && $self->margin_top == $y);
85 0 ▶ warn $self->name." move $x, $y from ".join('-',(caller)[0,2])."\n" if $self->debug && $self->name;
Branch: 1 branch
BranchTrueFalseTotal
if $self->debug and $self->name 0 0 0
Condition0%0/3
$self->debug and $self->name
!ll&&!rl&&r
000
MC/DC0%0/2
$self->debug and $self->name
$self->debug $self->name
Truth table0%0/3
A and B
A= $self->debugB= $self->name
ABresult
0X0
100
111
86 0 $self->adjust({ margin_left => $x, margin_top => $y });
87 }
88  
89 0 ▶sub set_width{
Subroutine set_width: not called CC=5 SCAR=34.0
Pod undocumented
90 0 my ($self, $arg) = @_;
91 0 ▶ return if $self->width && $self->width == $arg;
Branch: 1 branch
BranchTrueFalseTotal
if $self->width and $self->width == $arg 0 0 0
Condition0%0/3
$self->width and $self->width == $arg
!ll&&!rl&&r
000
MC/DC0%0/2
$self->width and $self->width == $arg
$self->width $self->width == $arg
Truth table0%0/3
A and B
A= $self->widthB= $self->width == $arg
ABresult
0X0
100
111
92 0 ▶ warn $self->name." set width $arg from ".join('-',(caller)[0,2])."\n" if $self->debug && $self->name;
Branch: 1 branch
BranchTrueFalseTotal
if $self->debug and $self->name 0 0 0
Condition0%0/3
$self->debug and $self->name
!ll&&!rl&&r
000
MC/DC0%0/2
$self->debug and $self->name
$self->debug $self->name
Truth table0%0/3
A and B
A= $self->debugB= $self->name
ABresult
0X0
100
111
93 0 $self->adjust({ width => $arg });
94 }
95  
96 0 ▶sub set_margin_width{
Subroutine set_margin_width: not called CC=5 SCAR=34.0
Pod undocumented
97 0 my ($self, $arg) = @_;
98 0 ▶ return if $self->margin_width && $self->margin_width == $arg;
Branch: 1 branch
BranchTrueFalseTotal
if $self->margin_width and $self->margin_width == $arg 0 0 0
Condition0%0/3
$self->margin_width and $self->margin_width == $arg
!ll&&!rl&&r
000
MC/DC0%0/2
$self->margin_width and $self->margin_width == $arg
$self->margin_width $self->margin_width == $arg
Truth table0%0/3
A and B
A= $self->margin_widthB= $self->margin_width == $arg
ABresult
0X0
100
111
99 0 ▶ warn $self->name." set margin_width $arg from ".join('-',(caller)[0,2])."\n" if $self->debug && $self->name;
Branch: 1 branch
BranchTrueFalseTotal
if $self->debug and $self->name 0 0 0
Condition0%0/3
$self->debug and $self->name
!ll&&!rl&&r
000
MC/DC0%0/2
$self->debug and $self->name
$self->debug $self->name
Truth table0%0/3
A and B
A= $self->debugB= $self->name
ABresult
0X0
100
111
100 0 $self->adjust({ margin_width => $arg });
101 }
102  
103 0 ▶sub set_height{
Subroutine set_height: not called CC=5 SCAR=34.0
Pod undocumented
104 0 my ($self, $arg) = @_;
105 0 ▶ return if $self->height && $self->height == $arg;
Branch: 1 branch
BranchTrueFalseTotal
if $self->height and $self->height == $arg 0 0 0
Condition0%0/3
$self->height and $self->height == $arg
!ll&&!rl&&r
000
MC/DC0%0/2
$self->height and $self->height == $arg
$self->height $self->height == $arg
Truth table0%0/3
A and B
A= $self->heightB= $self->height == $arg
ABresult
0X0
100
111
106 0 ▶ warn $self->name." set height $arg from ".join('-',(caller)[0,2])."\n" if $self->debug && $self->name;
Branch: 1 branch
BranchTrueFalseTotal
if $self->debug and $self->name 0 0 0
Condition0%0/3
$self->debug and $self->name
!ll&&!rl&&r
000
MC/DC0%0/2
$self->debug and $self->name
$self->debug $self->name
Truth table0%0/3
A and B
A= $self->debugB= $self->name
ABresult
0X0
100
111
107 0 $self->adjust({ height => $arg });
108 }
109  
110 0 ▶sub set_margin_height{
Subroutine set_margin_height: not called CC=5 SCAR=34.0
Pod undocumented
111 0 my ($self, $arg) = @_;
112 0 ▶ return if $self->margin_height && $self->margin_height == $arg;
Branch: 1 branch
BranchTrueFalseTotal
if $self->margin_height and $self->margin_height == $arg 0 0 0
Condition0%0/3
$self->margin_height and $self->margin_height == $arg
!ll&&!rl&&r
000
MC/DC0%0/2
$self->margin_height and $self->margin_height == $arg
$self->margin_height $self->margin_height == $arg
Truth table0%0/3
A and B
A= $self->margin_heightB= $self->margin_height == $arg
ABresult
0X0
100
111
113 0 ▶ warn $self->name." set margin_height $arg from ".join('-',(caller)[0,2])."\n" if $self->debug && $self->name;
Branch: 1 branch
BranchTrueFalseTotal
if $self->debug and $self->name 0 0 0
Condition0%0/3
$self->debug and $self->name
!ll&&!rl&&r
000
MC/DC0%0/2
$self->debug and $self->name
$self->debug $self->name
Truth table0%0/3
A and B
A= $self->debugB= $self->name
ABresult
0X0
100
111
114 0 $self->adjust({ margin_height => $arg });
115 }
116  
117 0 ▶sub set_size{
Subroutine set_size: not called CC=7 SCAR=40.3
Pod undocumented
118 0 my ($self, $x, $y) = @_;
119 return if
120 0 ▶ ($self->width && $self->width == $x)
Branch: 1 branch
BranchTrueFalseTotal
if $self->width and $self->width == $x and ($self->height and $self->height == $y) 0 0 0
Condition0%0/9
$self->width and $self->width == $x and ($self->height and $self->height == $y)
!ll&&!rl&&r
000
$self->width and $self->width == $x
!ll&&!rl&&r
000
$self->height and $self->height == $y
!ll&&!rl&&r
000
MC/DC0%0/4
$self->width and $self->width == $x and ($self->height and $self->height == $y)
$self->width $self->width == $x $self->height $self->height == $y
Truth table0%0/5
A and B and C and D
A= $self->widthB= $self->width == $xC= $self->heightD= $self->height == $y
ABCDresult
0XXX0
10XX0
110X0
11100
11111
121 && ($self->height && $self->height == $y);
122 0 ▶ warn $self->name." size $x, $y from ".join('-',(caller)[0,2])."\n" if $self->debug && $self->name;
Branch: 1 branch
BranchTrueFalseTotal
if $self->debug and $self->name 0 0 0
Condition0%0/3
$self->debug and $self->name
!ll&&!rl&&r
000
MC/DC0%0/2
$self->debug and $self->name
$self->debug $self->name
Truth table0%0/3
A and B
A= $self->debugB= $self->name
ABresult
0X0
100
111
123 0 $self->adjust({ width => $x, height => $y });
124 }
125  
126 0 ▶sub set_margin_size{
Subroutine set_margin_size: not called CC=5 SCAR=34.0
Pod undocumented
127 0 my ($self, $x, $y) = @_;
128 0 ▶ return if $self->margin_width == $x && $self->margin_height == $y;
Branch: 1 branch
BranchTrueFalseTotal
if $self->margin_width == $x and $self->margin_height == $y 0 0 0
Condition0%0/3
$self->margin_width == $x and $self->margin_height == $y
!ll&&!rl&&r
000
MC/DC0%0/2
$self->margin_width == $x and $self->margin_height == $y
$self->margin_width == $x $self->margin_height == $y
Truth table0%0/3
A and B
A= $self->margin_width == $xB= $self->margin_height == $y
ABresult
0X0
100
111
129 0 ▶ warn $self->name." size $x, $y from ".join('-',(caller)[0,2])."\n" if $self->debug && $self->name;
Branch: 1 branch
BranchTrueFalseTotal
if $self->debug and $self->name 0 0 0
Condition0%0/3
$self->debug and $self->name
!ll&&!rl&&r
000
MC/DC0%0/2
$self->debug and $self->name
$self->debug $self->name
Truth table0%0/3
A and B
A= $self->debugB= $self->name
ABresult
0X0
100
111
130 0 $self->adjust({ margin_width => $x, margin_height => $y });
131 }
132  
133 0 ▶sub child_height_set{};
Subroutine child_height_set: not called CC=1 SCAR=0.0
Pod undocumented
134 0 ▶sub child_width_set{};
Subroutine child_width_set: not called CC=1 SCAR=0.0
Pod undocumented
135  
136 0 ▶sub position_set{
Subroutine position_set: not called CC=5 SCAR=34.0
Pod undocumented
137 0 my ($self) = @_;
138 0 ▶ return 1 if ($self->has_margin_left || $self->has_margin_right)
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_margin_left || $self->has_margin_right and $self->has_margin_top || $self->has_margin_bottom 0 0 0
Condition0%0/9
$self->has_margin_left || $self->has_margin_right and $self->has_margin_top || $self->has_margin_bottom
!ll&&!rl&&r
000
$self->has_margin_left or $self->has_margin_right
l!l&&r!l&&!r
000
$self->has_margin_top or $self->has_margin_bottom
l!l&&r!l&&!r
000
MC/DC0%0/4
$self->has_margin_left || $self->has_margin_right and $self->has_margin_top || $self->has_margin_bottom
$self->has_margin_left $self->has_margin_right $self->has_margin_top $self->has_margin_bottom
Truth table0%0/7
A or B and C or D
A= $self->has_margin_leftB= $self->has_margin_rightC= $self->has_margin_topD= $self->has_margin_bottom
ABCDresult
00XX0
1X000
01000
1X1X1
1X011
011X1
01011
139 && ($self->has_margin_top || $self->has_margin_bottom);
140 }
141  
142 0 ▶sub size_set{
Subroutine size_set: not called CC=5 SCAR=34.0
Pod undocumented
143 0 my ($self) = @_;
144 0 ▶ return 1 if ($self->has_margin_width || $self->has_width)
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_margin_width || $self->has_width and $self->has_margin_height || $self->has_height 0 0 0
Condition0%0/9
$self->has_margin_width || $self->has_width and $self->has_margin_height || $self->has_height
!ll&&!rl&&r
000
$self->has_margin_width or $self->has_width
l!l&&r!l&&!r
000
$self->has_margin_height or $self->has_height
l!l&&r!l&&!r
000
MC/DC0%0/4
$self->has_margin_width || $self->has_width and $self->has_margin_height || $self->has_height
$self->has_margin_width $self->has_width $self->has_margin_height $self->has_height
Truth table0%0/7
A or B and C or D
A= $self->has_margin_widthB= $self->has_widthC= $self->has_margin_heightD= $self->has_height
ABCDresult
00XX0
1X000
01000
1X1X1
1X011
011X1
01011
145 && ($self->has_margin_height || $self->has_height);
146 }
147  
148 1 ▶sub _build_margin_left{
Subroutine _build_margin_left: called CC=6 SCAR=28.1
149 1 my ($self) = @_;
150 1 ▶ if ($self->has_content_left){
Branch: 3 branches
BranchTrueFalseTotal
if ($self->has_content_left) { } 0 1 1
elsif ($self->has_margin_right and $self->has_margin_width) { } 1 0 1
elsif ($self->has_content_right and $self->has_content_width) { } 0 0 0
151 0 return $self->content_left - $self->padding->[3] - $self->border->[3] - $self->margin->[3];
152 ▶ } elsif ($self->has_margin_right && $self->has_margin_width){
Condition33%1/3
$self->has_margin_right and $self->has_margin_width
!ll&&!rl&&r
001
MC/DC0%0/2
$self->has_margin_right and $self->has_margin_width
$self->has_margin_right $self->has_margin_width
Truth table33%1/3
A and B
A= $self->has_margin_rightB= $self->has_margin_width
ABresult
0X0
100
111
153 1 return $self->margin_right - $self->margin_width;
154 ▶ } elsif ($self->has_content_right && $self->has_content_width){
Condition0%0/3
$self->has_content_right and $self->has_content_width
!ll&&!rl&&r
000
MC/DC0%0/2
$self->has_content_right and $self->has_content_width
$self->has_content_right $self->has_content_width
Truth table0%0/3
A and B
A= $self->has_content_rightB= $self->has_content_width
ABresult
0X0
100
111
155 0 return $self->content_right - $self->content_width;
156 }
157 0 return;
158 }
159  
160 4 ▶sub _build_margin_right{
Subroutine _build_margin_right: called CC=1 SCAR=0.0
161 4 my ($self) = @_;
162 4 return $self->margin_left + $self->margin_width;
163 }
164  
165 0 ▶sub _build_margin_top{
Subroutine _build_margin_top: not called CC=6 SCAR=37.4
166 0 my ($self) = @_;
167 0 ▶ if ($self->has_content_top){
Branch: 3 branches
BranchTrueFalseTotal
if ($self->has_content_top) { } 0 0 0
elsif ($self->has_margin_bottom and $self->has_margin_height) { } 0 0 0
elsif ($self->has_content_bottom and $self->has_content_height) { } 0 0 0
168 0 return $self->content_top + $self->padding->[0] + $self->border->[0] + $self->margin->[0];
169 ▶ } elsif ($self->has_margin_bottom && $self->has_margin_height){
Condition0%0/3
$self->has_margin_bottom and $self->has_margin_height
!ll&&!rl&&r
000
MC/DC0%0/2
$self->has_margin_bottom and $self->has_margin_height
$self->has_margin_bottom $self->has_margin_height
Truth table0%0/3
A and B
A= $self->has_margin_bottomB= $self->has_margin_height
ABresult
0X0
100
111
170 0 return $self->margin_bottom - $self->margin_height;
171 ▶ } elsif ($self->has_content_bottom && $self->has_content_height){
Condition0%0/3
$self->has_content_bottom and $self->has_content_height
!ll&&!rl&&r
000
MC/DC0%0/2
$self->has_content_bottom and $self->has_content_height
$self->has_content_bottom $self->has_content_height
Truth table0%0/3
A and B
A= $self->has_content_bottomB= $self->has_content_height
ABresult
0X0
100
111
172 0 return $self->content_bottom - $self->content_height;
173 }
174 0 return;
175 }
176  
177 4 ▶sub _build_margin_bottom{
Subroutine _build_margin_bottom: called CC=1 SCAR=0.0
178 4 my ($self) = @_;
179 4 return $self->margin_top - $self->margin_height;
180 }
181  
182 0 ▶sub _build_border_left{
Subroutine _build_border_left: not called CC=1 SCAR=6.9
183 0 my ($self) = @_;
184 0 return $self->margin_left + $self->margin->[3];
185 }
186  
187 0 ▶sub _build_border_top{
Subroutine _build_border_top: not called CC=1 SCAR=6.9
188 0 my ($self) = @_;
189 0 return $self->margin_top - $self->margin->[0];
190 }
191  
192 0 ▶sub _build_padding_left{
Subroutine _build_padding_left: not called CC=1 SCAR=6.9
193 0 my ($self) = @_;
194 0 return $self->border_left + $self->border->[3];
195 }
196  
197 0 ▶sub _build_padding_top{
Subroutine _build_padding_top: not called CC=1 SCAR=6.9
198 0 my ($self) = @_;
199 0 return $self->border_top - $self->border->[0];
200 }
201  
202 0 ▶sub _build_content_left{
Subroutine _build_content_left: not called CC=1 SCAR=6.9
203 0 my ($self) = @_;
204 0 return $self->padding_left + $self->padding->[3];
205 }
206  
207 0 ▶sub _build_content_top{
Subroutine _build_content_top: not called CC=1 SCAR=6.9
208 0 my ($self) = @_;
209 0 return $self->padding_top - $self->padding->[0];
210 }
211  
212 0 ▶sub _build_content_right{
Subroutine _build_content_right: not called CC=1 SCAR=6.9
213 0 my ($self) = @_;
214 0 return $self->content_left + $self->width;
215 }
216  
217 0 ▶sub _build_content_bottom{
Subroutine _build_content_bottom: not called CC=1 SCAR=6.9
218 0 my ($self) = @_;
219 0 return $self->content_top - $self->height;
220 }
221  
222 0 ▶sub _build_width{
Subroutine _build_width: not called CC=6 SCAR=37.4
223 0 my ($self) = @_;
224 0 ▶ if ($self->has_margin_width){
Branch: 3 branches
BranchTrueFalseTotal
if ($self->has_margin_width) { } 0 0 0
elsif ($self->has_margin_left and $self->has_margin_right) { } 0 0 0
elsif ($self->has_content_left and $self->has_content_right) { } 0 0 0
225 0 return $self->margin_width - (
226 $self->padding->[3] + $self->padding->[1]
227 + $self->border->[3] + $self->border->[1]
228 + $self->margin->[3] + $self->margin->[1]
229 );
230 ▶ } elsif ($self->has_margin_left && $self->has_margin_right){
Condition0%0/3
$self->has_margin_left and $self->has_margin_right
!ll&&!rl&&r
000
MC/DC0%0/2
$self->has_margin_left and $self->has_margin_right
$self->has_margin_left $self->has_margin_right
Truth table0%0/3
A and B
A= $self->has_margin_leftB= $self->has_margin_right
ABresult
0X0
100
111
231 0 return $self->margin_right - $self->margin_left - (
232 $self->padding->[3] + $self->padding->[1]
233 + $self->border->[3] + $self->border->[1]
234 + $self->margin->[3] + $self->margin->[1]
235 );
236 ▶ } elsif ($self->has_content_left && $self->has_content_right){
Condition0%0/3
$self->has_content_left and $self->has_content_right
!ll&&!rl&&r
000
MC/DC0%0/2
$self->has_content_left and $self->has_content_right
$self->has_content_left $self->has_content_right
Truth table0%0/3
A and B
A= $self->has_content_leftB= $self->has_content_right
ABresult
0X0
100
111
237 0 return $self->content_right - $self->content_left;
238 }
239 0 return;
240 }
241  
242 0 ▶sub _build_height{
Subroutine _build_height: not called CC=6 SCAR=37.4
243 0 my ($self) = @_;
244 0 ▶ if ($self->has_margin_height){
Branch: 3 branches
BranchTrueFalseTotal
if ($self->has_margin_height) { } 0 0 0
elsif ($self->has_margin_left and $self->has_margin_right) { } 0 0 0
elsif ($self->has_content_left and $self->has_content_right) { } 0 0 0
245 0 return $self->margin_height - (
246 $self->padding->[0] + $self->padding->[2]
247 + $self->border->[0] + $self->border->[2]
248 + $self->margin->[0] + $self->margin->[2]
249 );
250 ▶ } elsif ($self->has_margin_left && $self->has_margin_right){
Condition0%0/3
$self->has_margin_left and $self->has_margin_right
!ll&&!rl&&r
000
MC/DC0%0/2
$self->has_margin_left and $self->has_margin_right
$self->has_margin_left $self->has_margin_right
Truth table0%0/3
A and B
A= $self->has_margin_leftB= $self->has_margin_right
ABresult
0X0
100
111
251 0 return $self->margin_right - $self->margin_left - (
252 $self->padding->[0] + $self->padding->[2]
253 + $self->border->[0] + $self->border->[2]
254 + $self->margin->[0] + $self->margin->[2]
255 );
256 ▶ } elsif ($self->has_content_left && $self->has_content_right){
Condition0%0/3
$self->has_content_left and $self->has_content_right
!ll&&!rl&&r
000
MC/DC0%0/2
$self->has_content_left and $self->has_content_right
$self->has_content_left $self->has_content_right
Truth table0%0/3
A and B
A= $self->has_content_leftB= $self->has_content_right
ABresult
0X0
100
111
257 0 return $self->content_right - $self->content_left;
258 }
259 0 return;
260 }
261  
262 0 ▶sub content_width{ shift->width(@_) }
Subroutine content_width: not called CC=1 SCAR=6.9
Pod undocumented
263 0 ▶sub content_height{ shift->height(@_) }
Subroutine content_height: not called CC=1 SCAR=6.9
Pod undocumented
264  
265 3 ▶sub _build_padding_width{
Subroutine _build_padding_width: called CC=1 SCAR=0.0
266 3 my ($self) = @_;
267 3 return $self->width + $self->padding->[1] + $self->padding->[3];
268 }
269  
270 3 ▶sub _build_padding_height{
Subroutine _build_padding_height: called CC=1 SCAR=0.0
271 3 my ($self) = @_;
272 3 return $self->height + $self->padding->[0] + $self->padding->[2];
273 }
274  
275 3 ▶sub _build_border_width{
Subroutine _build_border_width: called CC=1 SCAR=0.0
276 3 my ($self) = @_;
277 3 return $self->padding_width + $self->border->[1] + $self->border->[3];
278 }
279  
280 3 ▶sub _build_border_height{
Subroutine _build_border_height: called CC=1 SCAR=0.0
281 3 my ($self) = @_;
282 3 return $self->padding_height + $self->border->[0] + $self->border->[2];
283 }
284  
285 3 ▶sub _build_margin_width{
Subroutine _build_margin_width: called CC=1 SCAR=0.0
286 3 my ($self) = @_;
287 3 return $self->border_width + $self->margin->[1] + $self->margin->[3];
288 }
289  
290 3 ▶sub _build_margin_height{
Subroutine _build_margin_height: called CC=1 SCAR=0.0
291 3 my ($self) = @_;
292 3 return $self->border_height + $self->margin->[0] + $self->margin->[2];
293 }
294  
295  
296 4 1;
297  
298  
299  
300 __END__
« lib/PDF/Boxer/Content/Row.pm ↑ Summary lib/PDF/Boxer/Role/Text.pm »