blib/lib/Gapp/Types.pm

filter: Statementstmt 61.4% 43 / 70 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 12.5% 2 / 16 Podpod n/a totaltotal 44.5% 45 / 101 CC 8 SCAR 29.1
CC
8
Cov
51%
__ANON__
56.0
__ANON__
6.0
__ANON__
2.0
CRAP 18.3
« blib/lib/Gapp/Form/Context/Node.pm ↑ Summary blib/lib/Gapp/Gtk2/Model/Tree.pm »
1 package Gapp::Types;
2 {
3 1 $Gapp::Types::VERSION = '0.60';
4 }
5  
6 1 ▶use MooseX::Types -declare => [qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
7 Form
8 FormContext
9 FormField
10 FormStash
11 GappAction
12 GappActionOrArrayRef
13 GappCallback
14 GappCellRenderer
15 GappContainer
16 GappContent
17 GappDialog
18 GappDialogImage
19 GappLayout
20 GappLayoutOrUndef
21 GappImage
22 GappMenu
23 GappNoticeImage
24 GappTableMap
25 GappTreeViewColumn
26 GappUIManager
27 GappWidget
28 MaybeGappMenu
29 1 )];
30  
31 1 ▶use MooseX::Types::Moose qw( ArrayRef ClassName CodeRef HashRef Int Object Str );
Subroutine BEGIN: called CC=1 SCAR=0.0
32  
33 # GappAction
34 1 class_type GappAction,
35 { class => 'Gapp::Action' };
36
37 1 subtype GappActionOrArrayRef,
38 as GappAction|ArrayRef;
39  
40 1 subtype GappCallback,
41 as GappAction|ArrayRef|CodeRef;
42  
43 # GappContainer
44 1 class_type GappContainer,
45 { class => 'Gapp::Container' };
46
47 1 subtype GappContent,
48 as ArrayRef;
49  
50 coerce GappContent,
51 from Object,
52 0 ▶ via { [ $_ ] };
Subroutine __ANON__: not called CC=1 SCAR=1.2
53
54 # GappDialog
55 1 class_type GappDialog,
56 { class => 'Gapp::Dialog' };
57
58 # GappImage
59 1 class_type GappImage,
60 { class => 'Gapp::Image' };
61  
62 # GappDialogImage
63 1 subtype GappDialogImage,
64 as GappImage;
65  
66 coerce GappDialogImage,
67 from Str,
68 0 ▶ via {
Subroutine __ANON__: not called CC=1 SCAR=6.9
69 0 Gapp::Image->new(
70 stock => [ $_, 'dialog' ],
71 );
72 1 };
73
74 # GappImage
75 1 class_type GappMenu,
76 { class => 'Gapp::Menu' };
77
78 1 subtype MaybeGappMenu,
79 as GappMenu;
80
81 coerce MaybeGappMenu,
82 from ArrayRef,
83 0 ▶ via { Gapp::Menu->new( content => $_ ) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
84
85 # GappDialogImage
86 1 subtype GappNoticeImage,
87 as GappImage;
88  
89 coerce GappNoticeImage,
90 from Str,
91 0 ▶ via {
Subroutine __ANON__: not called CC=1 SCAR=6.9
92 0 Gapp::Image->new(
93 stock => [ $_, 'dialog' ],
94 );
95 1 };
96  
97 # GappWidget
98 1 class_type GappWidget,
99 { class => 'Gapp::Widget' };
100  
101 # FormField
102 type Form,
103 as GappContainer,
104 0 ▶ where { $_->does('Gapp::Meta::Widget::Native::Trait::Form') };
Subroutine __ANON__: not called CC=1 SCAR=1.2
105  
106 # FormField
107 subtype FormField,
108 as GappWidget,
109 0 ▶ where { $_->does('Gapp::Meta::Widget::Native::Role::FormField') };
Subroutine __ANON__: not called CC=1 SCAR=1.2
110  
111 # FormContext
112 1 class_type FormContext,
113 { class => 'Gapp::Form::Context' };
114
115 # FormContext
116 1 class_type FormStash,
117 { class => 'Gapp::Form::Stash' };
118  
119 # GappCellRenderer
120 1 class_type GappCellRenderer,
121 { class => 'Gapp::CellRenderer' };
122  
123  
124 1 my %RENDERERS = (
125 'text' => [ 'Gtk2::CellRendererText', 'text' ],
126 'markup' => [ 'Gtk2::CellRendererText', 'markup' ],
127 'toggle' => [ 'Gtk2::CellRendererToggle', 'active' ],
128 'pixbuf' => [ 'Gtk2::CellRendererPixbuf', 'pixbuf']
129 );
130  
131 coerce GappCellRenderer,
132 from Str,
133 0 ▶ via {
Subroutine __ANON__: not called CC=2 SCAR=17.9
134 0 ▶ if ( exists $RENDERERS{ $_ } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $RENDERERS{$_}) 0 0 0
135 0 my ( $c, $p ) = ( @{ $RENDERERS{ $_ } } );
136 0 'Gapp::CellRenderer'->new( gclass => $c, property => $p );
137 }
138 1 };
139
140 coerce GappCellRenderer,
141 from HashRef,
142 0 ▶ via { 'Gapp::CellRenderer'->new( %$_ ) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
143
144 coerce GappCellRenderer,
145 from ArrayRef,
146 0 ▶ via { 'Gapp::CellRenderer'->new( gclass => $_->[0], property => $_->[1] ) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
147  
148  
149 # GappTableMap
150 1 class_type GappLayout,
151 { class => 'Gapp::Layout::Object' };
152
153 coerce GappLayout,
154 from Str,
155 0 ▶ via { $_->Layout };
Subroutine __ANON__: not called CC=1 SCAR=1.2
156
157 # GappTableMap
158 1 class_type GappTableMap,
159 { class => 'Gapp::TableMap' };
160
161 coerce GappTableMap,
162 from Str,
163 0 ▶ via { 'Gapp::TableMap'->new( string => $_ ) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
164  
165 # GappTreeViewColumn
166 1 class_type GappTreeViewColumn,
167 { class => 'Gapp::TreeViewColumn' };
168  
169 coerce GappTreeViewColumn,
170 from HashRef,
171 0 ▶ via { 'Gapp::TreeViewColumn'->new( %$_ ) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
172
173 coerce GappTreeViewColumn,
174 from ArrayRef,
175 0 ▶ via {
Subroutine __ANON__: not called CC=7 SCAR=40.3
176 0 my $input = $_;
177 0 my %args;
178 0 ▶ $args{name} = $input->[0] if defined $input->[0];
Branch: 1 branch
BranchTrueFalseTotal
if defined $input->[0] 0 0 0
179 0 ▶ $args{title} = $input->[1] if defined $input->[1];
Branch: 1 branch
BranchTrueFalseTotal
if defined $input->[1] 0 0 0
180 0 ▶ $args{renderer} = $input->[2] || 'text';
Condition0%0/2
$input->[2] || 'text'
l!l
00
MC/DC0%0/1
$input->[2] || 'text'
$input->[2]
Truth table0%0/2
A
A= $input->[2]
Aresult
11
00
181 0 ▶ $args{data_column} = $input->[3] if defined $input->[3] ;
Branch: 1 branch
BranchTrueFalseTotal
if defined $input->[3] 0 0 0
182
183 # determine how to display the content
184 0 ▶ if ( defined $input->[4] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $input->[4]) 0 0 0
185 0 $args{data_func} = $input->[4];
186 }
187
188 0 ▶ %args = (%args, %{ $input->[5] }) if defined $input->[5];
Branch: 1 branch
BranchTrueFalseTotal
if defined $input->[5] 0 0 0
189 0 return 'Gapp::TreeViewColumn'->new( %args );
190 1 };
191  
192 # GappUIManager
193 1 class_type GappUIManager,
194 { class => 'Gapp::UIManager' };
195  
196 coerce GappUIManager,
197 from HashRef,
198 0 ▶ via { 'Gapp::UIManager'->new( %$_ ) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
199  
200  
201  
202  
203 1 1;
« blib/lib/Gapp/Form/Context/Node.pm ↑ Summary blib/lib/Gapp/Gtk2/Model/Tree.pm »