Circle/Widget/Entry.pm

filter: Statementstmt 51.7% 30 / 58 Branchbran 25.0% 2 / 8 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 50.0% 6 / 12 Podpod 0.0% 0 / 4 totaltotal 41.7% 38 / 91 CC 9 SCAR 19.0
CC
9
Cov
44%
new
20.0
method_typing
6.0
add
6.0
CRAP 6.7
« Circle/RootObj.pm ↑ Summary Circle/Net.pm »
1 # You may distribute under the terms of the GNU General Public License
2 #
3 # (C) Paul Evans, 2008-2013 -- leonerd@leonerd.org.uk
4  
5 package Circle::Widget::Entry;
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 4 ▶use base qw( Circle::Widget );
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 4 our $VERSION = '0.173320';
12  
13 sub new
14 2 ▶{
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
15 2 my $class = shift;
16 2 my %args = @_;
17  
18 2 my $self = $class->SUPER::new( @_ );
19  
20 2 $self->{on_enter} = $args{on_enter};
21 2 $self->{history} = $args{history};
22  
23 2 $self->set_prop_text( "" );
24 2 $self->set_prop_autoclear( $args{autoclear} );
25  
26 2 return $self;
27 }
28  
29 sub method_enter
30 2 ▶{
Subroutine method_enter: called CC=3 SCAR=11.1
Pod undocumented
31 2 my $self = shift;
32 2 my ( $ctx, $text ) = @_;
33 2 $self->{on_enter}->( $text, $ctx );
34  
35 2 ▶ if( defined( my $history = $self->{history} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $history = $self->{"history"})) 2 0 2
36 2 my $histqueue = $self->get_prop_history;
37  
38 2 my $overcount = @$histqueue + 1 - $history;
39  
40 2 ▶ $self->shift_prop_history( $overcount ) if $overcount > 0;
Branch: 1 branch
BranchTrueFalseTotal
if $overcount > 0 0 2 2
41  
42 2 $self->push_prop_history( $text );
43 }
44 }
45  
46 sub set_on_typing
47 0 ▶{
Subroutine set_on_typing: not called CC=1 SCAR=6.9
Pod undocumented
48 0 my $self = shift;
49 0 my ( $on_typing ) = @_;
50  
51 0 $self->{on_typing} = $on_typing;
52  
53 0 $self->set_prop_want_typing( defined $self->{on_typing} );
54 }
55  
56 sub method_typing
57 0 ▶{
Subroutine method_typing: not called CC=2 SCAR=17.9
Pod undocumented
58 0 my $self = shift;
59 0 my ( $ctx, $typing ) = @_;
60 0 ▶ $self->{on_typing}->( $typing ) if $self->{on_typing};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"on_typing"} 0 0 0
61 }
62  
63 package Circle::Widget::Entry::CompleteGroup;
64  
65 4 ▶use base qw( Tangence::Object );
Subroutine BEGIN: called CC=1 SCAR=0.0
66  
67 sub new
68 0 ▶{
Subroutine new: not called CC=4 SCAR=30.0
69 0 my $class = shift;
70 0 my %args = @_;
71  
72 0 my $self = $class->SUPER::new( @_ );
73  
74 0 ▶ $self->set_prop_only_at_sol( $args{only_at_sol} || 0 );
Condition0%0/2
$args{'only_at_sol'} || 0
l!l
00
MC/DC0%0/1
$args{'only_at_sol'} || 0
$args{'only_at_sol'}
Truth table0%0/2
A
A= $args{'only_at_sol'}
Aresult
11
00
75 0 ▶ $self->set_prop_prefix_sol( $args{prefix_sol} || '' );
Condition0%0/2
$args{'prefix_sol'} || ''
l!l
00
MC/DC0%0/1
$args{'prefix_sol'} || ''
$args{'prefix_sol'}
Truth table0%0/2
A
A= $args{'prefix_sol'}
Aresult
11
00
76 0 ▶ $self->set_prop_suffix_sol( $args{suffix_sol} || '' );
Condition0%0/2
$args{'suffix_sol'} || ''
l!l
00
MC/DC0%0/1
$args{'suffix_sol'} || ''
$args{'suffix_sol'}
Truth table0%0/2
A
A= $args{'suffix_sol'}
Aresult
11
00
77  
78 0 return $self;
79 }
80  
81 sub set
82 0 ▶{
Subroutine set: not called CC=1 SCAR=6.9
83 0 my $self = shift;
84 0 my ( @strings ) = @_;
85  
86 0 $self->set_prop_items( \@strings );
87 }
88  
89 sub add
90 0 ▶{
Subroutine add: not called CC=2 SCAR=17.9
91 0 my $self = shift;
92 0 my ( $str ) = @_;
93  
94 0 ▶ grep { $_ eq $str } @{ $self->get_prop_items } or
Branch: 1 branch
BranchTrueFalseTotal
grep {$_ eq $str;} @{$self->get_prop_items;} or $self->push_prop_items($str) 0 0 0
95 $self->push_prop_items( $str );
96 }
97  
98 sub remove
99 0 ▶{
Subroutine remove: not called CC=2 SCAR=17.9
100 0 my $self = shift;
101 0 my ( $str ) = @_;
102  
103 0 my $items = $self->get_prop_items;
104 0 my @indices = grep { $items->[$_] eq $str } 0 .. $#$items;
105  
106 0 $self->splice_prop_items( $_, 1, () ) for reverse @indices;
107 }
108  
109 4 0x55AA;
« Circle/RootObj.pm ↑ Summary Circle/Net.pm »