| 1 | package Game::Terminal::Kit::Screen; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 11 | ▶ | use 5.014; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 11 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 11 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 11 | ▶ | use Object::Proto::Sugar -types; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 11 | our $VERSION = '0.02'; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | has out => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | is => 'rw' | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 11 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | has [qw/interactive colour columns rows/] => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | is => 'rw' | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 11 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | has [qw/ascii cursor_hidden/] => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | isa => Bool, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | default => 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 11 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 50 | ▶ | sub BUILD { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BUILD: called CC=7 SCAR=19.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 50 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 50 | ▶ | $self->out(\*STDOUT) unless $self->out; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 50 | ▶ | $self->interactive(-t $self->out ? 1 : 0) unless defined $self->interactive; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 50 | ▶ | $self->colour($self->interactive && !no_colour() ? 1 : 0) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
$self->interactive and not no_colour()
MC/DC100%2/2
$self->interactive and not no_colour()
$self->interactive
not no_colour()
Truth table100%3/3
A and not(B)
A= $self->interactiveB= not no_colour()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | unless defined $self->colour; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 50 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 6 | ▶ | sub no_colour { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
no_colour: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 6 | ▶ | return defined $ENV{NO_COLOR} && length $ENV{NO_COLOR} ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $ENV{"NO_COLOR"} and length $ENV{"NO_COLOR"}
MC/DC100%2/2
defined $ENV{"NO_COLOR"} and length $ENV{"NO_COLOR"}
defined $ENV{"NO_COLOR"}
length $ENV{"NO_COLOR"}
Truth table100%3/3
A and B
A= defined $ENV{"NO_COLOR"}B= length $ENV{"NO_COLOR"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 106 | ▶ | sub _print { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_print: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 106 | my ($self, @text) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 106 | my $out = $self->out; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 106 | print {$out} @text; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 106 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 1 | ▶ | sub flush_on { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
flush_on: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 1 | my $previous = select $self->out; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 1 | $| = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 1 | select $previous; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 1 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 3 | ▶ | sub utf8 { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
utf8: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 3 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 3 | ▶ | return $self if $self->ascii; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 2 | my @layers = eval { PerlIO::get_layers($self->out) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 2 | ▶ | return $self if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 2 | ▶ | return $self if grep { m/\A(?:utf8|encoding)/ } @layers; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 1 | binmode $self->out, ':encoding(UTF-8)'; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 1 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 4 | ▶ | sub say { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
say: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 4 | my ($self, @lines) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 4 | ▶ | @lines = ('') unless @lines; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 4 | ▶ | return $self->_print(map { (defined $_ ? $_ : '') . "\n" } @lines); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 5 | ▶ | sub clear { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clear: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 5 | my ($self, %option) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 5 | ▶ | return $self unless $self->interactive; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 2 | ▶ | return $self->_print($option{scrollback} ? "\e[2J\e[3J\e[H" : "\e[2J\e[H"); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 87 | ▶ | sub show { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
show: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 87 | my ($self, $lines) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 87 | ▶ | return $self->_print("\e[H", (map { "$_\e[K\n" } @{$lines}), "\e[J") | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | if $self->interactive; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 82 | return $self->_print(map { "$_\n" } @{$lines}); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 6 | ▶ | sub rewind { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rewind: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 6 | my ($self, $count) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 6 | ▶ | return $self unless $self->interactive && $count && $count > 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$self->interactive and $count and $count > 0
$self->interactive and $count
MC/DC100%3/3
$self->interactive and $count and $count > 0
$self->interactive
$count
$count > 0
Truth table100%4/4
A and B and C
A= $self->interactiveB= $countC= $count > 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 1 | return $self->_print("\e[${count}A\r"); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 3 | ▶ | sub at { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
at: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 3 | my ($self, $row, $column) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 3 | ▶ | return $self unless $self->interactive; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 1 | return $self->_print("\e[${row};${column}H"); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 8 | ▶ | sub paint { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
paint: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 8 | my ($self, $text, $code) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 8 | ▶ | return $text unless $self->colour && defined $code && length $code; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$self->colour and defined $code and length $code
$self->colour and defined $code
MC/DC100%3/3
$self->colour and defined $code and length $code
$self->colour
defined $code
length $code
Truth table100%4/4
A and B and C
A= $self->colourB= defined $codeC= length $code
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 3 | return "\e[${code}m" . $text . "\e[0m"; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 11 | ▶ | sub hide_cursor { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hide_cursor: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 11 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 11 | ▶ | return $self unless $self->interactive && !$self->cursor_hidden; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->interactive and not $self->cursor_hidden
MC/DC100%2/2
$self->interactive and not $self->cursor_hidden
$self->interactive
not $self->cursor_hidden
Truth table100%3/3
A and not(B)
A= $self->interactiveB= not $self->cursor_hidden
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 5 | $self->cursor_hidden(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 5 | return $self->_print("\e[?25l"); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 8 | ▶ | sub show_cursor { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
show_cursor: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 8 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 8 | ▶ | return $self unless $self->cursor_hidden; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 5 | $self->cursor_hidden(0); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 5 | return $self->_print("\e[?25h"); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 11 | ▶ | sub restore { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
restore: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 11 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 11 | ▶ | return $self unless $self->cursor_hidden; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 4 | $self->show_cursor; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 4 | ▶ | $self->_print("\e[0m") if $self->colour; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 4 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 18 | ▶ | sub measured { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
measured: called CC=11 SCAR=27.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 18 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 18 | ▶ | return ($self->columns, $self->rows || 0) if $self->columns; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$self->rows || 0
MC/DC100%1/1
$self->rows || 0
$self->rows
Truth table100%2/2
A
A= $self->rows
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 11 | ▶ | if ($self->interactive && eval { require Term::ReadKey; 1 }) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->interactive and eval {
do {
require Term::ReadKey;
1
}
}
MC/DC0%0/2
$self->interactive and eval {
do {
require Term::ReadKey;
1
}
}
$self->interactive
eval {
do {
require Term::ReadKey;
1
}
}
Truth table66%2/3
A and B
A= $self->interactiveB= eval {
do {
require Term::ReadKey;
1
}
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | my ($columns, $rows) = eval { Term::ReadKey::GetTerminalSize($self->out) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | ▶ | return ($columns, $rows || 0) if $columns; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$rows || 0
MC/DC0%0/1
$rows || 0
$rows
Truth table0%0/2
A
A= $rows
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | return ($ENV{COLUMNS} + 0, ($ENV{LINES} || 0) + 0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 11 | ▶ | if defined $ENV{COLUMNS} && $ENV{COLUMNS} =~ m/^\d+$/ && $ENV{COLUMNS} > 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition87%7/8
defined $ENV{"COLUMNS"} and $ENV{"COLUMNS"} =~ /^\d+$/u and $ENV{"COLUMNS"} > 0
defined $ENV{"COLUMNS"} and $ENV{"COLUMNS"} =~ /^\d+$/u
$ENV{'LINES'} || 0
MC/DC66%2/3
defined $ENV{"COLUMNS"} and $ENV{"COLUMNS"} =~ /^\d+$/u and $ENV{"COLUMNS"} > 0
defined $ENV{"COLUMNS"}
$ENV{"COLUMNS"} =~ /^\d+$/u
$ENV{"COLUMNS"} > 0
MC/DC100%1/1
$ENV{'LINES'} || 0
$ENV{'LINES'}
Truth table75%3/4
A and B and C
A= defined $ENV{"COLUMNS"}B= $ENV{"COLUMNS"} =~ /^\d+$/uC= $ENV{"COLUMNS"} > 0
Truth table100%2/2
A
A= $ENV{'LINES'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 8 | return (); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 8 | ▶ | sub size { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
size: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 8 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 8 | my ($columns, $rows) = $self->measured; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 8 | ▶ | return ($columns || 80, $rows || 24); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%4/4
$columns || 80
$rows || 24
MC/DC100%1/1
$columns || 80
$columns
MC/DC100%1/1
$rows || 24
$rows
Truth table100%2/2
A
A= $columns
Truth table100%2/2
A
A= $rows
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 7 | ▶ | sub too_small { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
too_small: called CC=8 SCAR=20.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 7 | my ($self, $need_columns, $need_rows) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 7 | my ($columns, $rows) = $self->measured; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 7 | ▶ | return undef unless $columns; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 5 | my $narrow = $columns < $need_columns; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 5 | ▶ | my $short = $need_rows && $rows && $rows < $need_rows; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition83%5/6
$need_rows && $rows && $rows < $need_rows
$need_rows and $rows
MC/DC66%2/3
$need_rows && $rows && $rows < $need_rows
$need_rows
$rows
$rows < $need_rows
Truth table75%3/4
A and B && C
A= $need_rowsB= $rowsC= $rows < $need_rows
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 5 | ▶ | return undef unless $narrow || $short; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$narrow or $short
MC/DC100%2/2
$narrow or $short
$narrow
$short
Truth table100%3/3
A or B
A= $narrowB= $short
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 3 | ▶ | return "This window is $columns columns by $rows lines and $need_columns by $need_rows are needed." | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$need_rows and $rows
MC/DC50%1/2
$need_rows and $rows
$need_rows
$rows
Truth table66%2/3
A and B
A= $need_rowsB= $rows
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | if $need_rows && $rows; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 1 | return "This window is $columns columns wide and $need_columns are needed."; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 11 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||