lib/TUI/Drivers/HWMouse.pm

filter: Statementstmt 69.7% 46 / 66 Branchbran n/a Conditioncond 16.6% 4 / 24 MC/DCmcdc 0.0% 0 / 16 Subroutinesub 76.4% 13 / 17 Podpod 0.0% 0 / 8 totaltotal 48.0% 63 / 131 CC 9 SCAR 10.8
CC
9
Cov
56%
setRange
6.0
getEvent
6.0
present
6.0
CRAP 3.0
« lib/TUI/Memory.pm ↑ Summary lib/TUI/App/Background.pm »
1 package TUI::Drivers::HWMouse;
2 # ABSTRACT: defines the class THWMouse
3
4 97 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 97 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6
7 97 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
8 97 our @EXPORT = qw(
9 THWMouse
10 );
11
12 97 ▶use PerlX::Assert::PP;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 97 ▶use Scalar::Util qw( looks_like_number );
Subroutine BEGIN: called CC=1 SCAR=0.0
14 97 ▶use TUI::toolkit::boolean;
Subroutine BEGIN: called CC=1 SCAR=0.0
15
16 97 ▶use TUI::Drivers::HardwareInfo;
Subroutine BEGIN: called CC=1 SCAR=0.0
17
18 sub THWMouse() { __PACKAGE__ }
19
20 # predeclare global variable names
21 97 our $buttonCount = 0;
22 97 our $handlerInstalled = false;
23 97 our $noMouse = false;
24 97 our $mouseRangeX = 0;
25 97 our $mouseRangeY = 0;
26
27 97 ▶INIT {
Subroutine INIT: called CC=1 SCAR=0.0
28 97 THWMouse->resume();
29 }
30
31 97 ▶END {
Subroutine END: called CC=1 SCAR=0.0
32 97 THWMouse->suspend();
33 }
34
35 97 ▶sub show { # void ($class)
Subroutine show: called CC=2 SCAR=7.6
Pod undocumented
36 97 ▶ assert ( $_[0] and !ref $_[0] );
Condition33%1/3
$_[0] && !ref($_[0])
!ll&&!rl&&r
0097
MC/DC0%0/2
$_[0] && !ref($_[0])
$_[0] !ref($_[0])
Truth table33%1/3
A && not(B)
A= $_[0]B= !ref($_[0])
ABresult
0X0
100
111
37 97 THardwareInfo->cursorOn();
38 1 return;
39 }
40
41 134 ▶sub hide { # void ($class)
Subroutine hide: called CC=2 SCAR=7.6
Pod undocumented
42 134 ▶ assert ( $_[0] and !ref $_[0] );
Condition33%1/3
$_[0] && !ref($_[0])
!ll&&!rl&&r
00134
MC/DC0%0/2
$_[0] && !ref($_[0])
$_[0] !ref($_[0])
Truth table33%1/3
A && not(B)
A= $_[0]B= !ref($_[0])
ABresult
0X0
100
111
43 134 THardwareInfo->cursorOff();
44 1 return;
45 }
46
47 0 ▶sub setRange { # void ($class, $rx, $ry)
Subroutine setRange: not called CC=2 SCAR=17.9
Pod undocumented
48 0 my ( $class, $rx, $ry ) = @_;
49 0 ▶ assert ( $class and !ref $class );
Condition0%0/3
$class && !ref($class)
!ll&&!rl&&r
000
MC/DC0%0/2
$class && !ref($class)
$class !ref($class)
Truth table0%0/3
A && not(B)
A= $classB= !ref($class)
ABresult
0X0
100
111
50 0 assert ( looks_like_number $rx );
51 0 assert ( looks_like_number $ry );
52 0 $mouseRangeX = $rx;
53 0 $mouseRangeY = $ry;
54 0 return;
55 }
56
57 0 ▶sub getEvent { # void ($class, \%me)
Subroutine getEvent: not called CC=2 SCAR=17.9
Pod undocumented
58 0 my ( $class, $me ) = @_;
59 0 ▶ assert ( $class and !ref $class );
Condition0%0/3
$class && !ref($class)
!ll&&!rl&&r
000
MC/DC0%0/2
$class && !ref($class)
$class !ref($class)
Truth table0%0/3
A && not(B)
A= $classB= !ref($class)
ABresult
0X0
100
111
60 0 assert ( ref $me );
61 0 $me->{buttons} = 0;
62 0 $me->{where}{x} = 0;
63 0 $me->{where}{y} = 0;
64 0 $me->{eventFlags} = 0;
65 0 return;
66 }
67
68 0 ▶sub present { # $bool ($class)
Subroutine present: not called CC=2 SCAR=17.9
Pod undocumented
69 0 ▶ assert ( $_[0] and !ref $_[0] );
Condition0%0/3
$_[0] && !ref($_[0])
!ll&&!rl&&r
000
MC/DC0%0/2
$_[0] && !ref($_[0])
$_[0] !ref($_[0])
Truth table0%0/3
A && not(B)
A= $_[0]B= !ref($_[0])
ABresult
0X0
100
111
70 0 return $buttonCount != 0;
71 }
72
73 134 ▶sub suspend { # void ($class)
Subroutine suspend: called CC=2 SCAR=7.2
Pod undocumented
74 134 my $class = shift;
75 134 ▶ assert ( $class and !ref $class );
Condition33%1/3
$class && !ref($class)
!ll&&!rl&&r
00134
MC/DC0%0/2
$class && !ref($class)
$class !ref($class)
Truth table33%1/3
A && not(B)
A= $classB= !ref($class)
ABresult
0X0
100
111
76 134 $class->hide();
77 1 $buttonCount = false;
78 1 return;
79 }
80
81 97 ▶sub resume { # void ($class)
Subroutine resume: called CC=2 SCAR=7.2
Pod undocumented
82 97 my $class = shift;
83 97 ▶ assert ( $class and !ref $class );
Condition33%1/3
$class && !ref($class)
!ll&&!rl&&r
0097
MC/DC0%0/2
$class && !ref($class)
$class !ref($class)
Truth table33%1/3
A && not(B)
A= $classB= !ref($class)
ABresult
0X0
100
111
84 97 $buttonCount = THardwareInfo->getButtonCount();
85 97 $class->show();
86 1 return;
87 }
88
89 0 ▶sub inhibit { # void ($class)
Subroutine inhibit: not called CC=2 SCAR=17.9
Pod undocumented
90 0 ▶ assert ( $_[0] and !ref $_[0] );
Condition0%0/3
$_[0] && !ref($_[0])
!ll&&!rl&&r
000
MC/DC0%0/2
$_[0] && !ref($_[0])
$_[0] !ref($_[0])
Truth table0%0/3
A && not(B)
A= $_[0]B= !ref($_[0])
ABresult
0X0
100
111
91 0 $noMouse = true;
92 0 return;
93 }
94
95 97 1
96
97 __END__
« lib/TUI/Memory.pm ↑ Summary lib/TUI/App/Background.pm »