lib/Gtk2/Ex/MindMapView/Layout/Group.pm

filter: Statementstmt 41.6% 20 / 48 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 42.8% 6 / 14 Podpod 100% 6 / 6 totaltotal 42.1% 32 / 76 CC 8 SCAR 19.9
CC
8
Cov
36%
get
20.0
_zero
12.0
set
6.0
CRAP 7.3
« blib/lib/Gtk2/Ex/MindMapView/Border.pm ↑ Summary lib/Gtk2/Ex/MindMapView/Layout/Cluster.pm »
1 package Gtk2::Ex::MindMapView::Layout::Group;
2  
3 1 our $VERSION = '0.000001';
4  
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 ▶use constant COLUMN_MAX_WIDTH=>400; # pixels
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 ▶use constant PAD_HEIGHT=>10; # pixels
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 ▶use constant PAD_WIDTH=>30; # pixels
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 sub new
16 0 ▶{
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
17 0 my $class = shift(@_);
18  
19 0 my %args = @_;
20  
21 0 my $self = \%args;
22  
23 0 bless $self, $class;
24  
25 0 _zero($self, qw(x y height width));
26  
27 0 return $self;
28 }
29  
30  
31 # my @values = $group->get(qw(x y width height));
32  
33 sub get
34 0 ▶{
Subroutine get: not called CC=4 SCAR=30.0
Pod documented
35 0 my $self = shift(@_);
36  
37 0 ▶ return undef if (scalar @_ == 0);
Branch: 1 branch
BranchTrueFalseTotal
if scalar @_ == 0 0 0 0
38  
39 0 ▶ return _get($self,shift(@_)) if (scalar @_ == 1);
Branch: 1 branch
BranchTrueFalseTotal
if scalar @_ == 1 0 0 0
40  
41 0 my @values = ();
42  
43 0 foreach my $key (@_) { push @values, _get($self,$key); }
44  
45 0 return @values;
46 }
47  
48  
49 # $group->get_horizontal_padding();
50  
51 sub get_horizontal_padding()
52 0 ▶{
Subroutine get_horizontal_padding: not called CC=1 SCAR=6.9
Pod documented
53 0 return PAD_WIDTH;
54 }
55  
56  
57 # $group->get_max_width();
58  
59 sub get_max_width
60 0 ▶{
Subroutine get_max_width: not called CC=1 SCAR=6.9
Pod documented
61 0 return COLUMN_MAX_WIDTH;
62 }
63  
64  
65 # $group->get_vertical_padding();
66  
67 sub get_vertical_padding()
68 0 ▶{
Subroutine get_vertical_padding: not called CC=1 SCAR=6.9
Pod documented
69 0 return PAD_HEIGHT;
70 }
71  
72  
73 # $group->set(x=>0, y=>10, width=>20, height=>30);
74  
75 sub set
76 0 ▶{
Subroutine set: not called CC=2 SCAR=17.9
Pod documented
77 0 my $self = shift(@_);
78  
79 0 my %args = @_;
80  
81 0 foreach my $key (keys %args)
82 {
83 0 $self->{$key} = $args{$key};
84 }
85 }
86  
87  
88 sub _get
89 0 ▶{
Subroutine _get: not called CC=2 SCAR=17.9
90 0 my ($self, $key) = @_;
91  
92 0 my $value = $self->{$key};
93  
94 0 ▶ croak "Undefined value for key $key.\n" if (!defined $value);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 0 0 0
95  
96 0 return $value;
97 }
98  
99  
100 sub _zero
101 0 ▶{
Subroutine _zero: not called CC=3 SCAR=24.8
102 0 my $self = shift(@_);
103  
104 0 foreach my $arg (@_)
105 {
106 0 ▶ if (!defined $self->{$arg}) { $self->{$arg} = 0; }
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{$arg}) 0 0 0
107 }
108 }
109  
110  
111  
112 1 1; # Magic true value required at end of module
113 __END__
« blib/lib/Gtk2/Ex/MindMapView/Border.pm ↑ Summary lib/Gtk2/Ex/MindMapView/Layout/Cluster.pm »