XRandR/CurMode.pm

filter: Statementstmt 78.3% 29 / 37 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 70.0% 7 / 10 Podpod 100% 3 / 3 totaltotal 75.0% 39 / 52 CC 2 SCAR 7.4
CC
2
Cov
74%
to_string
6.0
map_reflection_in
2.0
map_reflection_out
2.0
CRAP 2.1
« XRandR/Transform.pm ↑ Summary XRandR/Output.pm »
1 package X11::XRandR::CurMode;
2  
3 # ABSTRACT: Current Mode
4  
5 3 ▶use Types::Standard qw[ InstanceOf ];
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use Types::Common::Numeric qw[ PositiveOrZeroInt ];
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 ▶use X11::XRandR::Types -types;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 3 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 3 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 3 ▶use MooX::StrictConstructor;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 3 our $VERSION = '0.01';
14  
15 3 ▶use overload '""' => \&to_string;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 #pod =attr geometry
18 #pod
19 #pod An instance of L<X11::XRandR::Geometry>.
20 #pod
21 #pod =cut
22  
23 3 has geometry => (
24 is => 'ro',
25 isa => InstanceOf ['X11::XRandR::Geometry'],
26 required => 1
27 );
28  
29 #pod =attr rotation
30 #pod
31 #pod For values, see L<X11::XRandR::Types/Direction>.
32 #pod
33 #pod =cut
34  
35 3 has rotation => (
36 is => 'ro',
37 isa => Direction,
38 required => 1,
39 );
40  
41 #pod =attr reflection
42 #pod
43 #pod For values, see L<X11::XRandR::Types/Reflection>. Optional.
44 #pod
45 #pod =method has_reflection
46 #pod
47 #pod I<Boolean> True if L<reflection> was specified.
48 #pod
49 #pod =cut
50  
51 3 has reflection => (
52 is => 'ro',
53 isa => Reflection,
54 predicate => 1,
55 );
56  
57 #pod =attr id
58 #pod
59 #pod =cut
60  
61 3 has id => (
62 is => 'ro',
63 isa => PositiveOrZeroInt
64 );
65  
66 0 ▶sub to_string {
Subroutine to_string: not called CC=2 SCAR=17.9
Pod documented
67  
68 0 my $self = shift;
69  
70 0 my $string
71 = sprintf( "%s (0x%x) %s", $self->geometry, $self->id, $self->rotation );
72  
73 0 ▶ $string .= ' ' . $self->map_reflection_out( $self->reflection )
Branch: 1 branch
BranchTrueFalseTotal
if $self->reflection ne "normal" 0 0 0
74 if $self->reflection ne 'normal';
75  
76 0 $string;
77 }
78  
79 3 my %MapReflectionIn = (
80 none => 'normal',
81 'X axis' => 'x',
82 'Y axis' => 'y',
83 'X and Y axis' => 'xy',
84 );
85  
86 3 my %MapReflectionOut = (
87 normal => 'none',
88 'x' => 'X axis',
89 'y' => 'Y axis',
90 'xy' => 'X and Y axis',
91 );
92  
93 #pod =method map_reflection_in
94 #pod
95 #pod Map a reflection from C<xrandr>'s nomenclature for the current mode to a L<X11::XRandR::Type/Reflection> value.
96 #pod
97 #pod =cut
98  
99 0 ▶sub map_reflection_in {
Subroutine map_reflection_in: not called CC=1 SCAR=6.9
Pod documented
100 0 my $self = shift;
101 0 return $MapReflectionIn{ $_[0] };
102 }
103  
104 #pod =method map_reflection_out
105 #pod
106 #pod Map a L<X11::XRandR::Type/Reflection> value to C<xrandr>'s nomenclature for the current mode.
107 #pod
108 #pod =cut
109  
110 0 ▶sub map_reflection_out {
Subroutine map_reflection_out: not called CC=1 SCAR=6.9
Pod documented
111 0 my $self = shift;
112 0 return $MapReflectionOut{ $_[0] };
113 }
114  
115 #pod =method to_string
116 #pod
117 #pod Return a string rendition of the object just as B<xrandr> would.
118 #pod
119 #pod =cut
120  
121 3 1;
122  
123 #
124 # This file is part of X11-XRandR
125 #
126 # This software is Copyright (c) 2018 by Diab Jerius.
127 #
128 # This is free software, licensed under:
129 #
130 # The GNU General Public License, Version 3, June 2007
131 #
132  
133 __END__
« XRandR/Transform.pm ↑ Summary XRandR/Output.pm »