| 1 | package Term::Fabulous::Widget::Table::Borders; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use v5.32; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use feature 'signatures'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | no warnings 'experimental::signatures'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | our $VERSION = '0.05'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use Exporter 'import'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | our @EXPORT_OK = qw(resolve_borders); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use List::Util qw(any first); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use Scalar::Util qw(refaddr); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 1 | ▶ | use Term::Fabulous::Enum::BorderStyle; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 1 | my $HIDDEN = Term::Fabulous::Enum::BorderStyle->Hidden; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 1 | my $BLANK = Term::Fabulous::Enum::BorderStyle->Blank; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 99 | ▶ | sub _is_line ($style) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_line: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 99 | ▶ | return defined $style && refaddr($style) != refaddr($HIDDEN) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $style and builtin::refaddr($style) != builtin::refaddr($HIDDEN)
MC/DC50%1/2
defined $style and builtin::refaddr($style) != builtin::refaddr($HIDDEN)
defined $style
builtin::refaddr($style) != builtin::refaddr($HIDDEN)
Truth table66%2/3
A and B
A= defined $styleB= builtin::refaddr($style) != builtin::refaddr($HIDDEN)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | # Whether a style has joint glyphs, so that its lines join with others. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 118 | ▶ | sub _joins ($style) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_joins: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 118 | ▶ | return defined $style->joints ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | # Whether a frame side is drawn on the background outside the table | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | # (see Term::Fabulous::Role::HasBorderStyle/outer_border_sides). Line | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | # styles are, so that highlights stop at the frame. Block styles (Outer, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | # Inner, Thick, ...) keep the backgrounds their glyphs are made for: a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | # side whose glyph sits on the cell's own background stays inside, so the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | # cells' colors reach the frame; one whose glyph sits on the background | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | # beside the box (location 1 or 2) is outside, and so are the cells of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | # other lines that end on it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 65 | ▶ | sub _drawn_outside ( $style, $side ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_drawn_outside: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 65 | ▶ | return 1 if _joins($style); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 12 | ▶ | my $location | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | = $side eq 'top' ? ( $style->get_top_locations )[1] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | : $side eq 'bottom' ? ( $style->get_bottom_locations )[1] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | : $side eq 'left' ? $style->get_left_locations | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | : $style->get_right_locations; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 12 | ▶ | return $location == 1 || $location == 2 ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$location == 1 or $location == 2
MC/DC50%1/2
$location == 1 or $location == 2
$location == 1
$location == 2
Truth table66%2/3
A or B
A= $location == 1B= $location == 2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | # The first style the levels name, from the most specific: a level is an | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | # array of candidates, the last one winning within the level (the cell | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | # below, or to the right). Hidden ends the search: there is no line. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 134 | ▶ | sub _first_style (@levels) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_first_style: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 134 | foreach my $level (@levels) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 512 | ▶ | my $style = first { defined } reverse @$level; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 512 | ▶ | return _is_line($style) ? $style : undef if defined $style; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 35 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | # Works out the lines of a table. Takes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | # columns => the number of grid columns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | # header => how many of the lines are header lines (they come first) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | # gutter => whether a scrollbar column follows the last grid column | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | # table => { border_top, border_right, border_bottom, border_left, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | # column_lines, row_lines, header_line } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | # column_styles => [ per column { border_left, border_right, row_lines } ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | # lines => [ per line { spanning, ledge, style => { border_top, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | # border_right, border_bottom, border_left, column_lines }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | # cells => [ per cell { border_top, border_right, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | # border_bottom, border_left } ] } ] (a spanning line has | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | # one cell; a ledge is the first or the last line, holds | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | # nothing and has no line between itself and its neighbour, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | # so it draws the frame's top or bottom and nothing else) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | # and returns { lines => per line, per cell { sides => { top, right, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | # bottom, left } (a BorderStyle per drawn side, Blank where a line passes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | # elsewhere but not here), corners => { top_left, ... } (the glyph of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | # every drawn corner that does not keep the glyph of its style), outer => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | # [ the frame sides drawn outside ] }, gutter => the same for the strips | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | # of the scrollbar column, { header, body, footer }, or undef }. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 10 | ▶ | sub resolve_borders (%args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
resolve_borders: called CC=31 SCAR=34.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 10 | my ( $columns, $lines ) = @args{qw(columns lines)}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 10 | ▶ | my $header_lines = $args{header} // 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args{"header"} // 0
MC/DC100%1/1
$args{"header"} // 0
$args{"header"}
Truth table100%2/2
A
A= $args{"header"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 10 | ▶ | my $gutter = $args{gutter} // 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args{"gutter"} // 0
MC/DC100%1/1
$args{"gutter"} // 0
$args{"gutter"}
Truth table100%2/2
A
A= $args{"gutter"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 10 | ▶ | my $table = $args{table} // {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args{"table"} // {}
MC/DC0%0/1
$args{"table"} // {}
$args{"table"}
Truth table50%1/2
A
A= $args{"table"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 10 | ▶ | my $column_style = $args{column_styles} // []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args{"column_styles"} // []
MC/DC100%1/1
$args{"column_styles"} // []
$args{"column_styles"}
Truth table100%2/2
A
A= $args{"column_styles"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 10 | my $last_line = $#$lines; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 10 | my $line_count = scalar @$lines; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 10 | my @ledges = grep { $lines->[$_]{ledge} } 0 .. $last_line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 10 | ▶ | die "Term::Fabulous::Widget::Table::Borders: a ledge must be the first or the last line" if grep { $_ != 0 && $_ != $last_line } @ledges; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$_ != 0 && $_ != $last_line
MC/DC100%2/2
$_ != 0 && $_ != $last_line
$_ != 0
$_ != $last_line
Truth table100%3/3
A && B
A= $_ != 0B= $_ != $last_line
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 184 | ▶ | my $cell_style = sub ( $line, $column ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 184 | ▶ | my $cells = $lines->[$line]{cells} // []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$lines->[$line]{"cells"} // []
MC/DC100%1/1
$lines->[$line]{"cells"} // []
$lines->[$line]{"cells"}
Truth table100%2/2
A
A= $lines->[$line]{"cells"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 184 | ▶ | return ( $lines->[$line]{spanning} ? $cells->[0] : $cells->[$column] ) // {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
($lines->[$line]{"spanning"} ? $cells->[0] : $cells->[$column]) // {}
MC/DC100%1/1
($lines->[$line]{"spanning"} ? $cells->[0] : $cells->[$column]) // {}
($lines->[$line]{"spanning"} ? $cells->[0] : $cells->[$column])
Truth table100%2/2
A
A= ($lines->[$line]{"spanning"} ? $cells->[0] : $cells->[$column])
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 9 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 9 | ▶ | my $row_style = sub ($line) { $lines->[$line]{style} // {} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Condition100%2/2
$lines->[$line]{"style"} // {}
MC/DC100%1/1
$lines->[$line]{"style"} // {}
$lines->[$line]{"style"}
Truth table100%2/2
A
A= $lines->[$line]{"style"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 9 | ▶ | my $is_ledge = sub ($line) { $line >= 0 && $line < $line_count && $lines->[$line]{ledge} ? 1 : 0 }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=14.9
Branch: 1 branch
Condition50%3/6
$line >= 0 and $line < $line_count and $lines->[$line]{"ledge"}
$line >= 0 and $line < $line_count
MC/DC33%1/3
$line >= 0 and $line < $line_count and $lines->[$line]{"ledge"}
$line >= 0
$line < $line_count
$lines->[$line]{"ledge"}
Truth table50%2/4
A and B and C
A= $line >= 0B= $line < $line_countC= $lines->[$line]{"ledge"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | # The horizontal segment above line $boundary ($line_count: below the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | # last line) in a column ($columns: in the scrollbar column, which has | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | # no cells and no column style). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 71 | ▶ | my $horizontal = sub ( $boundary, $column ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=16 SCAR=27.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 71 | my ( $above, $below ) = ( $boundary - 1, $boundary ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 71 | ▶ | my $inner = $boundary > 0 && $boundary < $line_count; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$boundary > 0 && $boundary < $line_count
MC/DC100%2/2
$boundary > 0 && $boundary < $line_count
$boundary > 0
$boundary < $line_count
Truth table100%3/3
A && B
A= $boundary > 0B= $boundary < $line_count
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 71 | ▶ | return undef if $inner && ( $is_ledge->($above) || $is_ledge->($below) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$inner and &$is_ledge($above) || &$is_ledge($below)
&$is_ledge($above) or &$is_ledge($below)
MC/DC100%3/3
$inner and &$is_ledge($above) || &$is_ledge($below)
$inner
&$is_ledge($above)
&$is_ledge($below)
Truth table100%4/4
A and B or C
A= $innerB= &$is_ledge($above)C= &$is_ledge($below)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 66 | ▶ | my @cells = ( ( $above >= 0 ? $cell_style->( $above, $column )->{border_bottom} : undef ), ( $below < $line_count ? $cell_style->( $below, $column )->{border_top} : undef ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 66 | ▶ | my @rows = ( ( $above >= 0 ? $row_style->($above)->{border_bottom} : undef ), ( $below < $line_count ? $row_style->($below)->{border_top} : undef ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 66 | ▶ | my @columns = $inner && $boundary != $header_lines ? ( ( $column_style->[$column] // {} )->{row_lines} ) : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%5/5
$inner and $boundary != $header_lines
$column_style->[$column] // {}
MC/DC100%2/2
$inner and $boundary != $header_lines
$inner
$boundary != $header_lines
MC/DC100%1/1
$column_style->[$column] // {}
$column_style->[$column]
Truth table100%3/3
A and B
A= $innerB= $boundary != $header_lines
Truth table100%2/2
A
A= $column_style->[$column]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | my $table_line | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | = $boundary == 0 ? $table->{border_top} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | : $boundary == $line_count ? $table->{border_bottom} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | : $boundary == $header_lines ? $table->{header_line} // $table->{row_lines} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 66 | ▶ | : $table->{row_lines}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition33%1/3
$table->{"header_line"} // $table->{"row_lines"}
MC/DC0%0/2
$table->{"header_line"} // $table->{"row_lines"}
$table->{"header_line"}
$table->{"row_lines"}
Truth table33%1/3
A // B
A= $table->{"header_line"}B= $table->{"row_lines"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 66 | return _first_style( \@cells, \@rows, \@columns, [$table_line] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 9 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | # The vertical segment of a line left of grid column $boundary | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | # ($columns: right of the last column, which is no line when the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | # scrollbar column follows; the strips draw the frame there). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 72 | ▶ | my $vertical = sub ( $line, $boundary ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=16 SCAR=27.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 72 | ▶ | return undef if $gutter && $boundary == $columns; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$gutter and $boundary == $columns
MC/DC100%2/2
$gutter and $boundary == $columns
$gutter
$boundary == $columns
Truth table100%3/3
A and B
A= $gutterB= $boundary == $columns
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 68 | my $spanning = $lines->[$line]{spanning}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 68 | ▶ | my $outer = $boundary == 0 || $boundary == $columns; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$boundary == 0 || $boundary == $columns
MC/DC100%2/2
$boundary == 0 || $boundary == $columns
$boundary == 0
$boundary == $columns
Truth table100%3/3
A || B
A= $boundary == 0B= $boundary == $columns
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 68 | ▶ | return undef if $spanning && !$outer; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$spanning and not $outer
MC/DC100%2/2
$spanning and not $outer
$spanning
not $outer
Truth table100%3/3
A and not(B)
A= $spanningB= not $outer
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | my @cells = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | ( $boundary > 0 ? $cell_style->( $line, $boundary - 1 )->{border_right} : undef ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 67 | ▶ | ( $boundary < $columns ? $cell_style->( $line, $boundary )->{border_left} : undef ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 67 | my $row = $row_style->($line); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | my @rows | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | = $boundary == 0 ? ( $row->{border_left} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | : $boundary == $columns ? ( $row->{border_right} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 67 | ▶ | : ( $row->{column_lines} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | my @column_levels = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | ( $boundary > 0 ? ( $column_style->[ $boundary - 1 ] // {} )->{border_right} : undef ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 67 | ▶ | ( $boundary < $columns ? ( $column_style->[$boundary] // {} )->{border_left} : undef ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%4/4
$$column_style[$boundary - 1] // {}
$column_style->[$boundary] // {}
MC/DC100%1/1
$$column_style[$boundary - 1] // {}
$$column_style[$boundary - 1]
MC/DC100%1/1
$column_style->[$boundary] // {}
$column_style->[$boundary]
Truth table100%2/2
A
A= $$column_style[$boundary - 1]
Truth table100%2/2
A
A= $column_style->[$boundary]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 67 | ▶ | my $table_line = $boundary == 0 ? $table->{border_left} : $boundary == $columns ? $table->{border_right} : $table->{column_lines}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 67 | return _first_style( \@cells, \@rows, \@column_levels, [$table_line] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 9 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 9 | my ( @h, @v, @h_gutter ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 9 | foreach my $boundary ( 0 .. $line_count ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 33 | $h[$boundary] = [ map { $horizontal->( $boundary, $_ ) } 0 .. $columns - 1 ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 33 | ▶ | $h_gutter[$boundary] = $gutter ? $horizontal->( $boundary, $columns ) : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 9 | foreach my $line ( 0 .. $last_line ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 24 | $v[$line] = [ map { $vertical->( $line, $_ ) } 0 .. $columns ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | my @row_line_exists = map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 9 | my $boundary = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 33 | ▶ | ( any { defined } @{ $h[$boundary] }, $h_gutter[$boundary] ) ? 1 : 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | } 0 .. $line_count; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | my @column_line_exists = map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 9 | my $boundary = $_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 27 | ▶ | ( any { defined $v[$_][$boundary] } 0 .. $last_line ) ? 1 : 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | } 0 .. $columns; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | # Who draws a horizontal boundary: the line below it, except that a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | # boundary above a spanning line is drawn by the (non-spanning) line | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | # above it, the last boundary by the last line, and the boundary below | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | # the header by the header, which does not scroll. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 30 | ▶ | my $drawn_as_bottom = sub ($boundary) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 30 | ▶ | return 1 if $boundary == $line_count; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 23 | ▶ | return 0 if $boundary == 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 16 | ▶ | return 1 if $boundary == $header_lines; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 10 | ▶ | return $lines->[$boundary]{spanning} && !$lines->[ $boundary - 1 ]{spanning} ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$lines->[$boundary]{"spanning"} and not $$lines[$boundary - 1]{"spanning"}
MC/DC50%1/2
$lines->[$boundary]{"spanning"} and not $$lines[$boundary - 1]{"spanning"}
$lines->[$boundary]{"spanning"}
not $$lines[$boundary - 1]{"spanning"}
Truth table66%2/3
A and not(B)
A= $lines->[$boundary]{"spanning"}B= not $$lines[$boundary - 1]{"spanning"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 9 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 116 | ▶ | my $vertical_arm = sub ( $line, $boundary ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 116 | ▶ | return undef if $line < 0 || $line > $last_line; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$line < 0 or $line > $last_line
MC/DC100%2/2
$line < 0 or $line > $last_line
$line < 0
$line > $last_line
Truth table100%3/3
A or B
A= $line < 0B= $line > $last_line
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 80 | return $v[$line][$boundary]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 9 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 116 | ▶ | my $horizontal_arm = sub ( $boundary, $column ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 116 | ▶ | return undef if $column < 0 || $column >= $columns; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$column < 0 or $column >= $columns
MC/DC100%2/2
$column < 0 or $column >= $columns
$column < 0
$column >= $columns
Truth table100%3/3
A or B
A= $column < 0B= $column >= $columns
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 76 | return $h[$boundary][$column]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 9 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | # The glyph of a point of the outer frame when the frame's style has no | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | # joints (Outer, Inner, Thick, ...): the frame runs on with its straight | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | # edge glyph where an inner line meets it, and keeps its own corner | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | # glyphs at the table's corners (undef: no glyph of the table's own). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | # Returns ( 1, $glyph ) for such a point, () for any other. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 61 | ▶ | my $frame_point = sub ( $boundary, $grid_line, $arms ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=15 SCAR=27.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 61 | my $on_top = $boundary == 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 61 | my $on_bottom = $boundary == $line_count; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 61 | ▶ | my $on_side = $grid_line == 0 || $grid_line == $columns; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$grid_line == 0 || $grid_line == $columns
MC/DC100%2/2
$grid_line == 0 || $grid_line == $columns
$grid_line == 0
$grid_line == $columns
Truth table100%3/3
A || B
A= $grid_line == 0B= $grid_line == $columns
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | my $edge | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | = $on_top || $on_bottom ? $arms->{left} // $arms->{right} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | : $on_side ? $arms->{up} // $arms->{down} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 61 | ▶ | : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%6/9
$on_top or $on_bottom
$arms->{"left"} // $arms->{"right"}
$arms->{"up"} // $arms->{"down"}
MC/DC100%2/2
$on_top or $on_bottom
$on_top
$on_bottom
MC/DC0%0/2
$arms->{"left"} // $arms->{"right"}
$arms->{"left"}
$arms->{"right"}
MC/DC0%0/2
$arms->{"up"} // $arms->{"down"}
$arms->{"up"}
$arms->{"down"}
Truth table100%3/3
A or B
A= $on_topB= $on_bottom
Truth table66%2/3
A // B
A= $arms->{"left"}B= $arms->{"right"}
Truth table33%1/3
A // B
A= $arms->{"up"}B= $arms->{"down"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 61 | ▶ | return () unless defined $edge && !_joins($edge); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $edge and not _joins($edge)
MC/DC100%2/2
defined $edge and not _joins($edge)
defined $edge
not _joins($edge)
Truth table100%3/3
A and not(B)
A= defined $edgeB= not _joins($edge)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 12 | ▶ | return ( 1, undef ) if ( $on_top || $on_bottom ) && $on_side; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$on_top || $on_bottom and $on_side
$on_top or $on_bottom
MC/DC100%3/3
$on_top || $on_bottom and $on_side
$on_top
$on_bottom
$on_side
Truth table100%5/5
A or B and C
A= $on_topB= $on_bottomC= $on_side
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 4 | ▶ | return ( 1, ( $edge->get_top_glyphs )[1] ) if $on_top; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 3 | ▶ | return ( 1, ( $edge->get_bottom_glyphs )[1] ) if $on_bottom; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 2 | ▶ | return ( 1, ( $grid_line == 0 ? $edge->get_left_glyphs : $edge->get_right_glyphs ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 9 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 58 | ▶ | my $corner = sub ( $boundary, $grid_line ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 58 | my %arms = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | up => $vertical_arm->( $boundary - 1, $grid_line ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | down => $vertical_arm->( $boundary, $grid_line ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | left => $horizontal_arm->( $boundary, $grid_line - 1 ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | right => $horizontal_arm->( $boundary, $grid_line ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 58 | my ( $on_frame, $frame_glyph ) = $frame_point->( $boundary, $grid_line, \%arms ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 58 | ▶ | return $frame_glyph if $on_frame; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 46 | ▶ | return Term::Fabulous::Enum::BorderStyle->junction(%arms) // ' '; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
"Term::Fabulous::Enum::BorderStyle"->junction(%arms) // " "
MC/DC0%0/1
"Term::Fabulous::Enum::BorderStyle"->junction(%arms) // " "
"Term::Fabulous::Enum::BorderStyle"->junction(%arms)
Truth table50%1/2
A
A= "Term::Fabulous::Enum::BorderStyle"->junction(%arms)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 9 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 114 | ▶ | my $side_style = sub ( $exists, $style ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 114 | ▶ | return undef unless $exists; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 96 | ▶ | return $style // $BLANK; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$style // $BLANK
MC/DC0%0/2
$style // $BLANK
$style
$BLANK
Truth table66%2/3
A // B
A= $styleB= $BLANK
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 9 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | # The strips of the scrollbar column, beside the header lines, the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | # body and the last line: each draws the frame's right side, in the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | # table's style, and the horizontal lines that run on beside it (the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | # top and the line below the header, the bottom). The side the body | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | # strip shares with the header and footer strips is one unbroken | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | # line, so its ends are arms of their corners. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 1 | ▶ | my $strips = sub () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=8 SCAR=23.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 1 | my $right = _first_style( [ $table->{border_right} ] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 1 | ▶ | my $side = sub ($boundary) { $side_style->( $row_line_exists[$boundary], $h_gutter[$boundary] ) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 3 | ▶ | my $corner = sub ( $boundary, %arms ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 3 | my ( $on_frame, $frame_glyph ) = $frame_point->( $boundary, $columns, \%arms ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 3 | ▶ | return $frame_glyph if $on_frame; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 3 | ▶ | return Term::Fabulous::Enum::BorderStyle->junction(%arms) // ' '; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
"Term::Fabulous::Enum::BorderStyle"->junction(%arms) // " "
MC/DC0%0/1
"Term::Fabulous::Enum::BorderStyle"->junction(%arms) // " "
"Term::Fabulous::Enum::BorderStyle"->junction(%arms)
Truth table50%1/2
A
A= "Term::Fabulous::Enum::BorderStyle"->junction(%arms)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 1 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 3 | ▶ | my $strip = sub ( $sides, $corners, @frame_sides ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 3 | my %drawn = map { $_ => $sides->{$_} } grep { defined $sides->{$_} } keys %$sides; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 3 | my %corners = map { $_ => $corners->{$_} } grep { defined $corners->{$_} } keys %$corners; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 3 | ▶ | my @outer = grep { defined $drawn{$_} && _drawn_outside( $drawn{$_}, $_ ) } @frame_sides; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
defined $drawn{$_} && _drawn_outside($drawn{$_}, $_)
MC/DC0%0/2
defined $drawn{$_} && _drawn_outside($drawn{$_}, $_)
defined $drawn{$_}
_drawn_outside($drawn{$_}, $_)
Truth table33%1/3
A && B
A= defined $drawn{$_}B= _drawn_outside($drawn{$_}, $_)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 3 | return { sides => \%drawn, corners => \%corners, outer => \@outer }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 1 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 1 | ▶ | my %header = ( top => $side->(0), bottom => ( $header_lines ? $side->($header_lines) : undef ), right => $right ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 1 | my %footer = ( bottom => $side->($line_count), right => $right ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | return { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | header => $strip->( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | \%header, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | top_right => ( $header{top} && $header{right} ? $corner->( 0, left => $h_gutter[0], down => $right ) : undef ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | bottom_right => ( $header{bottom} && $header{right} ? $corner->( $header_lines, left => $h_gutter[$header_lines], up => $right, down => $right ) : undef ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | qw(top right) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | body => $strip->( { right => $right }, {}, qw(right) ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | footer => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 1 | ▶ | $strip->( \%footer, { bottom_right => ( $footer{bottom} && $footer{right} ? $corner->( $line_count, left => $h_gutter[$line_count], up => $right ) : undef ) }, qw(bottom right) ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition33%3/9
$header{"top"} and $header{"right"}
$header{"bottom"} and $header{"right"}
$footer{"bottom"} and $footer{"right"}
MC/DC0%0/2
$header{"top"} and $header{"right"}
$header{"top"}
$header{"right"}
MC/DC0%0/2
$header{"bottom"} and $header{"right"}
$header{"bottom"}
$header{"right"}
MC/DC0%0/2
$footer{"bottom"} and $footer{"right"}
$footer{"bottom"}
$footer{"right"}
Truth table33%1/3
A and B
A= $header{"top"}B= $header{"right"}
Truth table33%1/3
A and B
A= $header{"bottom"}B= $header{"right"}
Truth table33%1/3
A and B
A= $footer{"bottom"}B= $footer{"right"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 9 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 9 | my @result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 9 | foreach my $line ( 0 .. $last_line ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 24 | my $spanning = $lines->[$line]{spanning}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 24 | ▶ | my @cell_columns = $spanning ? ( [ 0, $columns - 1 ] ) : map { [ $_, $_ ] } 0 .. $columns - 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 24 | ▶ | my $top_drawn = $row_line_exists[$line] && !$drawn_as_bottom->($line); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$row_line_exists[$line] && !&$drawn_as_bottom($line)
MC/DC100%2/2
$row_line_exists[$line] && !&$drawn_as_bottom($line)
$row_line_exists[$line]
!&$drawn_as_bottom($line)
Truth table100%3/3
A && not(B)
A= $row_line_exists[$line]B= !&$drawn_as_bottom($line)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 24 | ▶ | my $bottom_drawn = $row_line_exists[ $line + 1 ] && $drawn_as_bottom->( $line + 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$row_line_exists[$line + 1] && &$drawn_as_bottom($line + 1)
MC/DC100%2/2
$row_line_exists[$line + 1] && &$drawn_as_bottom($line + 1)
$row_line_exists[$line + 1]
&$drawn_as_bottom($line + 1)
Truth table100%3/3
A && B
A= $row_line_exists[$line + 1]B= &$drawn_as_bottom($line + 1)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 24 | my @cells; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 24 | foreach my $span (@cell_columns) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 47 | my ( $first, $last ) = @$span; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | my %sides = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | left => $side_style->( $column_line_exists[$first], $v[$line][$first] ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | right => ( $last == $columns - 1 ? $side_style->( $column_line_exists[$columns], $v[$line][$columns] ) : undef ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 20 | ▶ | top => ( $top_drawn ? $side_style->( 1, first { defined } @{ $h[$line] }[ $first .. $last ] ) : undef ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 47 | ▶ | bottom => ( $bottom_drawn ? $side_style->( 1, first { defined } @{ $h[ $line + 1 ] }[ $first .. $last ] ) : undef ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 47 | my %corners; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 47 | ▶ | $corners{top_left} = $corner->( $line, $first ) if $sides{top} && $sides{left}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$sides{"top"} and $sides{"left"}
MC/DC50%1/2
$sides{"top"} and $sides{"left"}
$sides{"top"}
$sides{"left"}
Truth table66%2/3
A and B
A= $sides{"top"}B= $sides{"left"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 47 | ▶ | $corners{top_right} = $corner->( $line, $columns ) if $sides{top} && $sides{right}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$sides{"top"} and $sides{"right"}
MC/DC100%2/2
$sides{"top"} and $sides{"right"}
$sides{"top"}
$sides{"right"}
Truth table100%3/3
A and B
A= $sides{"top"}B= $sides{"right"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 47 | ▶ | $corners{bottom_left} = $corner->( $line + 1, $first ) if $sides{bottom} && $sides{left}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$sides{"bottom"} and $sides{"left"}
MC/DC50%1/2
$sides{"bottom"} and $sides{"left"}
$sides{"bottom"}
$sides{"left"}
Truth table66%2/3
A and B
A= $sides{"bottom"}B= $sides{"left"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 47 | ▶ | $corners{bottom_right} = $corner->( $line + 1, $columns ) if $sides{bottom} && $sides{right}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$sides{"bottom"} and $sides{"right"}
MC/DC100%2/2
$sides{"bottom"} and $sides{"right"}
$sides{"bottom"}
$sides{"right"}
Truth table100%3/3
A and B
A= $sides{"bottom"}B= $sides{"right"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 47 | delete @corners{ grep { !defined $corners{$_} } keys %corners }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 47 | my %on_frame = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | left => $first == 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | right => $last == $columns - 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | top => $line == 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | bottom => $line == $last_line, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 47 | ▶ | my @outer = grep { defined $sides{$_} && $on_frame{$_} && _drawn_outside( $sides{$_}, $_ ) } qw(left right top bottom); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%6/6
defined $sides{$_} && $on_frame{$_} && _drawn_outside($sides{$_}, $_)
defined $sides{$_} and $on_frame{$_}
MC/DC100%3/3
defined $sides{$_} && $on_frame{$_} && _drawn_outside($sides{$_}, $_)
defined $sides{$_}
$on_frame{$_}
_drawn_outside($sides{$_}, $_)
Truth table100%4/4
A and B && C
A= defined $sides{$_}B= $on_frame{$_}C= _drawn_outside($sides{$_}, $_)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 47 | push @cells, { sides => { map { $_ => $sides{$_} } grep { defined $sides{$_} } keys %sides }, corners => \%corners, outer => \@outer }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 24 | push @result, \@cells; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 9 | ▶ | return { lines => \@result, gutter => $gutter ? $strips->() : undef }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||