blib/lib/PDF/Make/Builder/Form/Field/Button.pm

filter: Statementstmt 93.3% 28 / 30 Branchbran 75.0% 6 / 8 Conditioncond 40.0% 6 / 15 MC/DCmcdc 11.1% 1 / 9 Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 1 totaltotal 68.5% 48 / 70 CC 10 SCAR 22.6
CC
10
Cov
75%
_create_field
14.7
BEGIN
1.0
BEGIN
1.0
CRAP 9.6
« blib/lib/PDF/Make/Builder/Layout/Row.pm ↑ Summary blib/lib/PDF/Make/Builder/Page/HeaderFooterContext.pm »
1 package PDF::Make::Builder::Form::Field::Button;
2 53 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 53 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 53 ▶use Object::Proto;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 53 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
7 53 Object::Proto::define('PDF::Make::Builder::Form::Field::Button',
8 extends => 'PDF::Make::Builder::Form::Field',
9 'caption:Str',
10 'submit_url:Str',
11 'url:Str',
12 'is_reset:Bool:default(0)',
13 'javascript:Str',
14 );
15 53 Object::Proto::import_accessors('PDF::Make::Builder::Form::Field::Button');
16 }
17  
18 3 ▶sub BUILD {
Subroutine BUILD: called CC=1 SCAR=0.0
Pod undocumented
19 3 my ($self) = @_;
20 3 $self->h(28);
21 3 $self->border_colour('#2c3e50');
22 3 $self->bg_colour('#ecf0f1');
23 }
24  
25 2 ▶sub _draws_own_chrome { 1 }
Subroutine _draws_own_chrome: called CC=1 SCAR=0.0
26  
27 3 ▶sub _create_field {
Subroutine _create_field: called CC=10 SCAR=26.9
28 3 my ($self, $doc, $name, $fx, $fy, $fw, $fh) = @_;
29 3 ▶ my $cap = $self->caption // $self->label // $name;
Condition33%2/6
($self->caption // $self->label) // $name
l!l&&r!l&&!r
300
$self->caption // $self->label
l!l&&r!l&&!r
300
MC/DC0%0/3
($self->caption // $self->label) // $name
$self->caption $self->label $name
Truth table25%1/4
A // B // C
A= $self->captionB= $self->labelC= $name
ABCresult
1XX1
01X1
0011
0000
30 3 my $field = PDF::Make::FieldPtr::button($doc, $name, $fx, $fy, $fw, $fh, $cap);
31  
32 3 my $submit = submit_url $self;
33 3 my $uri = url $self;
34 3 my $rst = is_reset $self;
35 3 my $js = javascript $self;
36  
37 3 ▶ if (defined $uri && length $uri) {
Branch: 4 branches
BranchTrueFalseTotal
if (defined $uri and length $uri) { } 1 2 3
elsif (defined $submit and length $submit) { } 0 2 2
elsif ($rst) { } 1 1 2
elsif (defined $js and length $js) { } 0 2 2
Condition66%2/3
defined $uri and length $uri
!ll&&!rl&&r
201
MC/DC50%1/2
defined $uri and length $uri
defined $uri length $uri
Truth table66%2/3
A and B
A= defined $uriB= length $uri
ABresult
0X0
100
111
38 1 $field->set_uri_action($uri);
39 ▶ } elsif (defined $submit && length $submit) {
Condition33%1/3
defined $submit and length $submit
!ll&&!rl&&r
200
MC/DC0%0/2
defined $submit and length $submit
defined $submit length $submit
Truth table33%1/3
A and B
A= defined $submitB= length $submit
ABresult
0X0
100
111
40 0 $field->set_submit_url($submit);
41 } elsif ($rst) {
42 1 $field->set_reset_action;
43 ▶ } elsif (defined $js && length $js) {
Condition33%1/3
defined $js and length $js
!ll&&!rl&&r
100
MC/DC0%0/2
defined $js and length $js
defined $js length $js
Truth table33%1/3
A and B
A= defined $jsB= length $js
ABresult
0X0
100
111
44 0 $field->set_javascript($js);
45 }
46  
47 3 return $field;
48 }
49  
50 53 1;
51  
52 __END__
« blib/lib/PDF/Make/Builder/Layout/Row.pm ↑ Summary blib/lib/PDF/Make/Builder/Page/HeaderFooterContext.pm »