blib/lib/App/Asciio/Actions/Colors.pm untested

filter: Statementstmt 0.0% 0 / 33 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 47 CC 4 SCAR 20.1
CC
4
Cov
0%
flip_color_scheme
12.0
change_elements_colors
6.0
change_background_color
2.0
CRAP 7.4
1  
2 package App::Asciio::Actions::Colors ;
3  
4 #----------------------------------------------------------------------------------------------
5  
6 sub change_elements_colors
7 {
8 my ($self, $is_background) = @_ ;
9  
10 my ($color) = $self->get_color_from_user([0, 0, 0]) ;
11  
12 $self->create_undo_snapshot() ;
13  
14 for my $element($self->get_selected_elements(1))
15 {
16 $is_background
17 ? $element->set_background_color($color)
18 : $element->set_foreground_color($color) ;
19 }
20  
21 $self->update_display() ;
22 }
23  
24 #----------------------------------------------------------------------------------------------
25  
26 sub change_background_color
27 {
28 my ($self) = @_ ;
29  
30 my ($color) = $self->get_color_from_user([0, 0, 0]) ;
31  
32 $self->create_undo_snapshot() ;
33  
34 delete $self->{CACHE}{GRID} ;
35 $self->{COLORS}{background} = $color ;
36  
37 $self->update_display() ;
38 }
39  
40 #----------------------------------------------------------------------------------------------
41  
42 sub change_grid_color
43 {
44 my ($self) = @_ ;
45  
46 my ($color) = $self->get_color_from_user([0, 0, 0]) ;
47  
48 $self->create_undo_snapshot() ;
49  
50 delete $self->{CACHE}{GRID} ;
51 $self->{COLORS}{grid} = $color ;
52  
53 $self->update_display() ;
54 }
55  
56 #----------------------------------------------------------------------------------------------
57  
58 sub flip_color_scheme
59 {
60 my ($self) = @_ ;
61 $self->invalidate_rendering_cache() ;
62  
63 $self->{COLOR_SCHEME} = 'system' unless exists $self->{COLOR_SCHEME} ;
64  
65 if($self->{COLOR_SCHEME} eq 'system')
66 {
67 $self->{COLOR_SCHEME} = 'night' ;
68 $self->{COLORS} = $self->{COLOR_SCHEMES}{night} ;
69 }
70 else
71 {
72 $self->{COLOR_SCHEME} = 'system' ;
73 $self->{COLORS} = $self->{COLOR_SCHEMES}{system} ;
74 }
75  
76 $self->update_display() ;
77 }
78  
79 #----------------------------------------------------------------------------------------------
80  
81 1 ;
82