blib/lib/Graphics/Primitive/Border.pm

filter: Statementstmt 89.1% 66 / 74 Branchbran 78.5% 11 / 14 Conditioncond 66.6% 4 / 6 MC/DCmcdc 33.3% 1 / 3 Subroutinesub 93.7% 15 / 16 Podpod 80.0% 4 / 5 totaltotal 85.5% 101 / 118 CC 10 SCAR 10.1
CC
10
Cov
86%
equal_to
5.9
homogeneous
4.1
BUILD
3.0
CRAP 2.8
« blib/lib/Graphics/Primitive/Oriented.pm ↑ Summary blib/lib/Graphics/Primitive/Container.pm »
1 package Graphics::Primitive::Border;
2 9 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 9 ▶use MooseX::Storage;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 9 with 'MooseX::Clone';
6 9 with Storage (format => 'JSON', io => 'File');
7  
8 9 ▶use Graphics::Color;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 9 ▶use Graphics::Primitive::Brush;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 has 'bottom' => (
12 is => 'rw',
13 isa => 'Graphics::Primitive::Brush',
14 24 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
15 24 Graphics::Primitive::Brush->new
16 },
17 9 traits => [qw(Clone)]
18 );
19 has 'color' => (
20 is => 'rw',
21 isa => 'Graphics::Color',
22 3 ▶ trigger => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
23 3 my ($self, $newval) = @_;
24 3 $self->bottom->color($newval);
25 3 $self->left->color($newval);
26 3 $self->right->color($newval);
27 3 $self->top->color($newval);
28 },
29 9 predicate => 'has_color'
30 );
31 has 'left' => (
32 is => 'rw',
33 isa => 'Graphics::Primitive::Brush',
34 24 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
35 24 Graphics::Primitive::Brush->new
36 },
37 9 traits => [qw(Clone)]
38 );
39 has 'right' => (
40 is => 'rw',
41 isa => 'Graphics::Primitive::Brush',
42 24 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
43 24 Graphics::Primitive::Brush->new
44 },
45 9 traits => [qw(Clone)]
46 );
47 has 'top' => (
48 is => 'rw',
49 isa => 'Graphics::Primitive::Brush',
50 24 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
51 24 Graphics::Primitive::Brush->new
52 },
53 9 traits => [qw(Clone)]
54 );
55 has 'width' => (
56 is => 'rw',
57 isa => 'Int',
58 4 ▶ trigger => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
59 4 my ($self, $newval) = @_;
60 4 $self->bottom->width($newval);
61 4 $self->left->width($newval);
62 4 $self->right->width($newval);
63 4 $self->top->width($newval);
64 },
65 9 predicate => 'has_width'
66 );
67  
68 9 __PACKAGE__->meta->make_immutable;
69  
70 26 ▶sub BUILD {
Subroutine BUILD: called CC=3 SCAR=11.0
Pod undocumented
71 26 my ($self) = @_;
72  
73 26 ▶ if($self->has_width) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->has_width) 1 25 26
74 1 my $w = $self->width;
75 1 $self->bottom->width($w);
76 1 $self->left->width($w);
77 1 $self->right->width($w);
78 1 $self->top->width($w);
79 }
80 26 ▶ if($self->has_color) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->has_color) 1 25 26
81 1 my $c = $self->color;
82 1 $self->bottom->color($c);
83 1 $self->left->color($c);
84 1 $self->right->color($c);
85 1 $self->top->color($c);
86 }
87 }
88  
89 # sub color {
90 # my ($self, $c) = @_;
91 #
92 # $self->bottom->color($c);
93 # $self->left->color($c);
94 # $self->right->color($c);
95 # $self->top->color($c);
96 # }
97  
98 0 ▶sub dash_pattern {
Subroutine dash_pattern: not called CC=1 SCAR=6.9
Pod documented
99 0 my ($self, $d) = @_;
100  
101 0 $self->bottom->dash_pattern($d);
102 0 $self->left->dash_pattern($d);
103 0 $self->right->dash_pattern($d);
104 0 $self->top->dash_pattern($d);
105 }
106  
107 3 ▶sub equal_to {
Subroutine equal_to: called CC=5 SCAR=17.8
Pod documented
108 3 my ($self, $other) = @_;
109  
110 3 ▶ unless($self->top->equal_to($other->top)) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->top->equal_to($other->top)) 0 3 3
111 0 return 0;
112 }
113 3 ▶ unless($self->right->equal_to($other->right)) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->right->equal_to($other->right)) 0 3 3
114 0 return 0;
115 }
116 3 ▶ unless($self->bottom->equal_to($other->bottom)) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->bottom->equal_to($other->bottom)) 0 3 3
117 0 return 0;
118 }
119 3 ▶ unless($self->left->equal_to($other->left)) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->left->equal_to($other->left)) 1 2 3
120 1 return 0;
121 }
122  
123 2 return 1;
124 }
125  
126 2 ▶sub homogeneous {
Subroutine homogeneous: called CC=4 SCAR=14.0
Pod documented
127 2 my ($self) = @_;
128  
129 2 my $b = $self->top;
130 2 ▶ unless($self->bottom->equal_to($b) && $self->left->equal_to($b)
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->bottom->equal_to($b) and $self->left->equal_to($b) and $self->right->equal_to($b)) 1 1 2
Condition66%4/6
$self->bottom->equal_to($b) and $self->left->equal_to($b) and $self->right->equal_to($b)
!ll&&!rl&&r
101
$self->bottom->equal_to($b) and $self->left->equal_to($b)
!ll&&!rl&&r
011
MC/DC33%1/3
$self->bottom->equal_to($b) and $self->left->equal_to($b) and $self->right->equal_to($b)
$self->bottom->equal_to($b) $self->left->equal_to($b) $self->right->equal_to($b)
Truth table50%2/4
A and B and C
A= $self->bottom->equal_to($b)B= $self->left->equal_to($b)C= $self->right->equal_to($b)
ABCresult
0XX0
10X0
1100
1111
131 && $self->right->equal_to($b)) {
132 1 return 0;
133 }
134 1 return 1;
135 }
136  
137 1 ▶sub not_equal_to {
Subroutine not_equal_to: called CC=1 SCAR=0.0
Pod documented
138 1 my ($self, $other) = @_;
139  
140 1 return !$self->equal_to($other);
141 }
142  
143 # sub width {
144 # my ($self, $w) = @_;
145 #
146 # $self->bottom->width($w);
147 # $self->left->width($w);
148 # $self->right->width($w);
149 # $self->top->width($w);
150 # }
151  
152 9 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
153 9 1;
154 __END__
« blib/lib/Graphics/Primitive/Oriented.pm ↑ Summary blib/lib/Graphics/Primitive/Container.pm »