blib/lib/Circle/Widget/Box.pm

filter: Statementstmt 44.8% 13 / 29 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 57.1% 4 / 7 Podpod 0.0% 0 / 3 totaltotal 39.5% 17 / 43 SCAR 16.1
CC
3
Cov
39%
add_spacer
12.0
new
2.0
add
2.0
CRAP 5.0
« blib/lib/Circle/TaggedString.pm ↑ Summary blib/lib/Circle.pm »
1 # You may distribute under the terms of the GNU General Public License
2 #
3 # (C) Paul Evans, 2008-2010 -- leonerd@leonerd.org.uk
4  
5 package Circle::Widget::Box;
6  
7 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 4 ▶use base qw( Circle::Widget );
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 4 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 sub new
15 {
16 0 ▶ my $class = shift;
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
17 0 my %args = @_;
18  
19 0 my $self = $class->SUPER::new( @_ );
20  
21 0 $self->set_prop_orientation( $args{orientation} );
22  
23 0 return $self;
24 }
25  
26 sub add
27 {
28 0 ▶ my $self = shift;
Subroutine add: not called CC=1 SCAR=6.9
Pod undocumented
29 0 my ( $child, %opts ) = @_;
30  
31 0 $opts{child} = $child;
32 0 $self->push_prop_children( \%opts );
33 }
34  
35 sub add_spacer
36 {
37 0 ▶ my $self = shift;
Subroutine add_spacer: not called CC=3 SCAR=24.8
Pod undocumented
38 0 my ( %opts ) = @_;
39  
40 # TODO: For now, only allow one spacer, and it must be in expand mode
41 0 ▶ croak "Already have one spacer, can't add another" if grep { !$_->{child} } @{ $self->get_prop_children };
Branch: 1 branch
BranchTrueFalseTotal
if grep {not $_->{"child"};} @{$self->get_prop_children;} 0 0 0
42 0 ▶ croak "Spacer must be in expand mode" if !$opts{expand};
Branch: 1 branch
BranchTrueFalseTotal
unless $opts{"expand"} 0 0 0
43  
44 0 $self->push_prop_children( \%opts );
45 }
46  
47 4 0x55AA;
« blib/lib/Circle/TaggedString.pm ↑ Summary blib/lib/Circle.pm »