blib/lib/Zuzu/Module/GUI/Objects.pm

filter: Statementstmt 24.3% 436 / 1790 Branchbran 9.0% 83 / 918 Conditioncond 5.4% 29 / 530 MC/DCmcdc 0.6% 2 / 299 Subroutinesub 22.0% 59 / 268 Podpod 0.0% 0 / 1 totaltotal 16.0% 609 / 3806 CC 698 SCAR 64.6
CC
698
Cov
17%
_refresh_native
5700.0
_render_widget
2652.0
_adopt_child
506.0
CRAP 640.7
↑ Summary blib/lib/Zuzu/Module/String/Encode.pm »
1 package Zuzu::Module::GUI::Objects;
2  
3 3 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 3 our $VERSION = '0.007002';
6  
7 3 ▶use File::Spec;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 ▶use Scalar::Util qw( blessed refaddr );
Subroutine BEGIN: called CC=1 SCAR=0.0
9 3 ▶use Time::HiRes qw( time );
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 3 ▶use Zuzu::Value::Array;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 3 ▶use Zuzu::Value::Dict;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 3 ▶use Zuzu::Value::Function;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 3 ▶use Zuzu::Weak qw( slot_value store_value );
Subroutine BEGIN: called CC=1 SCAR=0.0
15 3 ▶use Zuzu::Util::NativeHelpers qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
16 native_class
17 native_function
18 native_object
19 perl_to_zuzu
20 zuzu_bool
21 zuzu_to_perl
22 3 );
23  
24 0 ▶sub _runtime_error {
Subroutine _runtime_error: not called CC=1 SCAR=6.9
25 0 my ( $code, $message ) = @_;
26  
27 0 die "$code: $message";
28 }
29  
30 0 ▶sub _class_name {
Subroutine _class_name: not called CC=5 SCAR=34.0
31 0 my ( $object ) = @_;
32  
33 0 ▶ return '' if !blessed($object) or !$object->isa('Zuzu::Value::Object');
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($object) and $object->isa("Zuzu::Value::Object") 0 0 0
Condition0%0/3
builtin::blessed($object) and $object->isa("Zuzu::Value::Object")
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::blessed($object) and $object->isa("Zuzu::Value::Object")
builtin::blessed($object) $object->isa("Zuzu::Value::Object")
Truth table0%0/3
A and B
A= builtin::blessed($object)B= $object->isa("Zuzu::Value::Object")
ABresult
0X0
100
111
34 0 ▶ return '' if !defined $object->class;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $object->class 0 0 0
35 0 ▶ return $object->class->name // '';
Condition0%0/2
$object->class->name // ""
l!l
00
MC/DC0%0/1
$object->class->name // ""
$object->class->name
Truth table0%0/2
A
A= $object->class->name
Aresult
11
00
36 }
37  
38 0 ▶sub _is_menu_kind {
Subroutine _is_menu_kind: not called CC=1 SCAR=6.9
39 0 my ( $object ) = @_;
40  
41 0 my $kind = _class_name($object);
42 0 return $kind eq 'Menu' or $kind eq 'MenuItem';
43 }
44  
45 2 ▶sub _is_widget {
Subroutine _is_widget: called CC=6 SCAR=19.9
46 2 my ( $object ) = @_;
47  
48 2 ▶ return 0 if !blessed($object) or !$object->isa('Zuzu::Value::Object');
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($object) and $object->isa("Zuzu::Value::Object") 0 2 2
Condition33%1/3
builtin::blessed($object) and $object->isa("Zuzu::Value::Object")
!ll&&!rl&&r
002
MC/DC0%0/2
builtin::blessed($object) and $object->isa("Zuzu::Value::Object")
builtin::blessed($object) $object->isa("Zuzu::Value::Object")
Truth table33%1/3
A and B
A= builtin::blessed($object)B= $object->isa("Zuzu::Value::Object")
ABresult
0X0
100
111
49 2 my $class = $object->class;
50 2 ▶ while ($class) {
Branch: 1 branch
BranchTrueFalseTotal
if ($class) 4 0 4
51 4 ▶ return 1 if ( $class->name // '' ) eq 'Widget';
Branch: 1 branch
BranchTrueFalseTotal
if ($class->name // "") eq "Widget" 2 2 4
Condition50%1/2
$class->name // ""
l!l
40
MC/DC0%0/1
$class->name // ""
$class->name
Truth table50%1/2
A
A= $class->name
Aresult
11
00
52 2 $class = $class->parent;
53 }
54  
55 0 return 0;
56 }
57  
58 0 ▶sub _is_function {
Subroutine _is_function: not called CC=2 SCAR=17.9
59 0 my ( $value ) = @_;
60  
61 0 ▶ return blessed($value) && $value->isa('Zuzu::Value::Function');
Condition0%0/3
builtin::blessed($value) && $value->isa('Zuzu::Value::Function')
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::blessed($value) && $value->isa('Zuzu::Value::Function')
builtin::blessed($value) $value->isa('Zuzu::Value::Function')
Truth table0%0/3
A && B
A= builtin::blessed($value)B= $value->isa('Zuzu::Value::Function')
ABresult
0X0
100
111
62 }
63  
64 4 ▶sub _zarray {
Subroutine _zarray: called CC=1 SCAR=0.0
65 4 my ( @items ) = @_;
66  
67 4 return Zuzu::Value::Array->new( items => \@items );
68 }
69  
70 11 ▶sub _zdict {
Subroutine _zdict: called CC=1 SCAR=0.0
71 11 my ( %map ) = @_;
72  
73 11 return Zuzu::Value::Dict->new( map => \%map );
74 }
75  
76 0 ▶sub _copy_array {
Subroutine _copy_array: not called CC=1 SCAR=6.9
77 0 my ( $array ) = @_;
78  
79 0 return _zarray( @{ $array->items } );
80 }
81  
82 2 ▶sub _default_slots {
Subroutine _default_slots: called CC=3 SCAR=12.0
83 2 my ( %args ) = @_;
84  
85 return {
86 _id => $args{id},
87 _parent => undef,
88 _children => _zarray(),
89 _visible => exists $args{visible} ? $args{visible} : 1,
90 _enabled => exists $args{enabled} ? $args{enabled} : 1,
91 _width => $args{width},
92 _height => $args{height},
93 _minwidth => $args{minwidth},
94 _minheight => $args{minheight},
95 _maxwidth => $args{maxwidth},
96 _maxheight => $args{maxheight},
97 _classes => _zarray(),
98 _style => _zdict(),
99 _meta => _zdict(),
100 _listeners => {},
101 _listener_seq => 0,
102 _widget_type => $args{widget_type},
103 2 ▶ };
Branch: 2 branches
BranchTrueFalseTotal
exists $args{'visible'} ? : 2 0 2
exists $args{'enabled'} ? : 2 0 2
104 }
105  
106 2 ▶sub _validate_props {
Subroutine _validate_props: called CC=4 SCAR=15.2
107 2 my ( $class_name, $named, $allowed ) = @_;
108  
109 2 ▶ for my $key ( sort keys %{ $named // {} } ) {
Condition50%1/2
$named // {}
l!l
20
MC/DC0%0/1
$named // {}
$named
Truth table50%1/2
A
A= $named
Aresult
11
00
110 28 ▶ next if $allowed->{$key};
Branch: 1 branch
BranchTrueFalseTotal
if $allowed->{$key} 28 0 28
111 0 _runtime_error(
112 'GUI_PROP_UNKNOWN',
113 "$class_name does not accept property '$key'",
114 );
115 }
116 }
117  
118 6 ▶sub _bool_prop {
Subroutine _bool_prop: called CC=3 SCAR=11.1
119 6 my ( $named, $name, $default ) = @_;
120  
121 6 ▶ return $default if !exists $named->{$name};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $named->{$name} 0 6 6
122 6 ▶ return zuzu_bool( $named->{$name}, $default ) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
zuzu_bool($named->{$name}, $default) ? : 4 2 6
123 }
124  
125 4 ▶sub _string_prop {
Subroutine _string_prop: called CC=3 SCAR=11.0
126 4 my ( $named, $name, $default ) = @_;
127  
128 4 ▶ return $default if !exists $named->{$name};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $named->{$name} 0 4 4
129 4 ▶ return undef if !defined $named->{$name};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $named->{$name} 2 2 4
130 2 return "$named->{$name}";
131 }
132  
133 4 ▶sub _number_prop {
Subroutine _number_prop: called CC=3 SCAR=11.7
134 4 my ( $named, $name, $default ) = @_;
135  
136 4 ▶ return $default if !exists $named->{$name};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $named->{$name} 0 4 4
137 4 ▶ return 0 + ( $named->{$name} // 0 );
Condition50%1/2
$named->{$name} // 0
l!l
40
MC/DC0%0/1
$named->{$name} // 0
$named->{$name}
Truth table50%1/2
A
A= $named->{$name}
Aresult
11
00
138 }
139  
140 12 ▶sub _optional_number_prop {
Subroutine _optional_number_prop: called CC=3 SCAR=11.0
141 12 my ( $named, $name ) = @_;
142  
143 12 ▶ return undef if !exists $named->{$name};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $named->{$name} 0 12 12
144 12 ▶ return undef if !defined $named->{$name};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $named->{$name} 8 4 12
145 4 return 0 + $named->{$name};
146 }
147  
148 0 ▶sub _weekday_prop {
Subroutine _weekday_prop: not called CC=4 SCAR=30.0
149 0 my ( $named, $name, $default ) = @_;
150  
151 0 my $value = _number_prop( $named, $name, $default );
152 0 ▶ _runtime_error(
Branch: 1 branch
BranchTrueFalseTotal
if $value < 0 or $value > 6 or int $value != $value 0 0 0
Condition0%0/6
$value < 0 or $value > 6 or int $value != $value
l!l&&r!l&&!r
000
$value < 0 or $value > 6
l!l&&r!l&&!r
000
MC/DC0%0/3
$value < 0 or $value > 6 or int $value != $value
$value < 0 $value > 6 int $value != $value
Truth table0%0/4
A or B or C
A= $value < 0B= $value > 6C= int $value != $value
ABCresult
1XX1
01X1
0011
0000
153 'GUI_PROP_TYPE',
154 "$name property expects an integer from 0 to 6",
155 ) if $value < 0 or $value > 6 or int($value) != $value;
156 0 return int($value);
157 }
158  
159 0 ▶sub _is_leap_year {
Subroutine _is_leap_year: not called CC=4 SCAR=30.0
160 0 my ( $year ) = @_;
161  
162 0 ▶ return 1 if $year % 400 == 0;
Branch: 1 branch
BranchTrueFalseTotal
if $year % 400 == 0 0 0 0
163 0 ▶ return 0 if $year % 100 == 0;
Branch: 1 branch
BranchTrueFalseTotal
if $year % 100 == 0 0 0 0
164 0 ▶ return $year % 4 == 0 ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$year % 4 == 0 ? : 0 0 0
165 }
166  
167 0 ▶sub _days_in_month {
Subroutine _days_in_month: not called CC=14 SCAR=53.5
168 0 my ( $year, $month ) = @_;
169  
170 0 ▶ return 31 if $month == 1 or $month == 3 or $month == 5
Branch: 1 branch
BranchTrueFalseTotal
if $month == 1 or $month == 3 or $month == 5 or $month == 7 or $month == 8 or $month == 10 or $month == 12 0 0 0
Condition0%0/18
$month == 1 or $month == 3 or $month == 5 or $month == 7 or $month == 8 or $month == 10 or $month == 12
l!l&&r!l&&!r
000
$month == 1 or $month == 3 or $month == 5 or $month == 7 or $month == 8 or $month == 10
l!l&&r!l&&!r
000
$month == 1 or $month == 3 or $month == 5 or $month == 7 or $month == 8
l!l&&r!l&&!r
000
$month == 1 or $month == 3 or $month == 5 or $month == 7
l!l&&r!l&&!r
000
$month == 1 or $month == 3 or $month == 5
l!l&&r!l&&!r
000
$month == 1 or $month == 3
l!l&&r!l&&!r
000
MC/DC0%0/7
$month == 1 or $month == 3 or $month == 5 or $month == 7 or $month == 8 or $month == 10 or $month == 12
$month == 1 $month == 3 $month == 5 $month == 7 $month == 8 $month == 10 $month == 12
Truth table0%0/8
A or B or C or D or E or F or G
A= $month == 1B= $month == 3C= $month == 5D= $month == 7E= $month == 8F= $month == 10G= $month == 12
ABCDEFGresult
1XXXXXX1
01XXXXX1
001XXXX1
0001XXX1
00001XX1
000001X1
00000011
00000000
171 or $month == 7 or $month == 8 or $month == 10 or $month == 12;
172 0 ▶ return 30 if $month == 4 or $month == 6 or $month == 9 or $month == 11;
Branch: 1 branch
BranchTrueFalseTotal
if $month == 4 or $month == 6 or $month == 9 or $month == 11 0 0 0
Condition0%0/9
$month == 4 or $month == 6 or $month == 9 or $month == 11
l!l&&r!l&&!r
000
$month == 4 or $month == 6 or $month == 9
l!l&&r!l&&!r
000
$month == 4 or $month == 6
l!l&&r!l&&!r
000
MC/DC0%0/4
$month == 4 or $month == 6 or $month == 9 or $month == 11
$month == 4 $month == 6 $month == 9 $month == 11
Truth table0%0/5
A or B or C or D
A= $month == 4B= $month == 6C= $month == 9D= $month == 11
ABCDresult
1XXX1
01XX1
001X1
00011
00000
173 0 ▶ return _is_leap_year($year) ? 29 : 28 if $month == 2;
Branch: 2 branches
BranchTrueFalseTotal
if $month == 2 0 0 0
_is_leap_year($year) ? : 0 0 0
174 0 return 0;
175 }
176  
177 0 ▶sub _today_date {
Subroutine _today_date: not called CC=1 SCAR=6.9
178 0 my @date = localtime(time);
179 0 return sprintf '%04d-%02d-%02d', $date[5] + 1900, $date[4] + 1, $date[3];
180 }
181  
182 0 ▶sub _validate_date {
Subroutine _validate_date: not called CC=8 SCAR=42.8
183 0 my ( $value, $prop ) = @_;
184  
185 0 ▶ return undef if !defined $value;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 0 0 0
186 0 $value = "$value";
187 0 ▶ return undef if $value eq '';
Branch: 1 branch
BranchTrueFalseTotal
if $value eq "" 0 0 0
188 0 ▶ _runtime_error(
Branch: 1 branch
BranchTrueFalseTotal
unless $value =~ /\A([0-9]{4})-([0-9]{2})-([0-9]{2})\z/ 0 0 0
189 'GUI_PROP_TYPE',
190 "$prop property expects a date in YYYY-MM-DD format",
191 ) if $value !~ /\A([0-9]{4})-([0-9]{2})-([0-9]{2})\z/;
192  
193 0 my ( $year, $month, $day ) = ( 0 + $1, 0 + $2, 0 + $3 );
194 0 ▶ _runtime_error(
Branch: 1 branch
BranchTrueFalseTotal
if $month < 1 or $month > 12 or $day < 1 or $day > _days_in_month($year, $month) 0 0 0
Condition0%0/9
$month < 1 or $month > 12 or $day < 1 or $day > _days_in_month($year, $month)
l!l&&r!l&&!r
000
$month < 1 or $month > 12 or $day < 1
l!l&&r!l&&!r
000
$month < 1 or $month > 12
l!l&&r!l&&!r
000
MC/DC0%0/4
$month < 1 or $month > 12 or $day < 1 or $day > _days_in_month($year, $month)
$month < 1 $month > 12 $day < 1 $day > _days_in_month($year, $month)
Truth table0%0/5
A or B or C or D
A= $month < 1B= $month > 12C= $day < 1D= $day > _days_in_month($year, $month)
ABCDresult
1XXX1
01XX1
001X1
00011
00000
195 'GUI_PROP_TYPE',
196 "$prop property expects a valid calendar date",
197 ) if $month < 1 or $month > 12
198 or $day < 1
199 or $day > _days_in_month( $year, $month );
200  
201 0 return $value;
202 }
203  
204 0 ▶sub _date_prop {
Subroutine _date_prop: not called CC=2 SCAR=17.9
205 0 my ( $named, $name, $default ) = @_;
206  
207 0 ▶ return $default if !exists $named->{$name};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $named->{$name} 0 0 0
208 0 return _validate_date( $named->{$name}, $name );
209 }
210  
211 0 ▶sub _date_parts {
Subroutine _date_parts: not called CC=2 SCAR=17.9
212 0 my ( $value ) = @_;
213  
214 0 ▶ $value = _validate_date( $value, 'value' ) // _today_date();
Condition0%0/3
_validate_date($value, "value") // _today_date()
l!l&&r!l&&!r
000
MC/DC0%0/2
_validate_date($value, "value") // _today_date()
_validate_date($value, "value") _today_date()
Truth table0%0/3
A // B
A= _validate_date($value, "value")B= _today_date()
ABresult
1X1
011
000
215 0 $value =~ /\A([0-9]{4})-([0-9]{2})-([0-9]{2})\z/;
216 0 return ( 0 + $1, 0 + $2, 0 + $3 );
217 }
218  
219 0 ▶sub _date_from_parts {
Subroutine _date_from_parts: not called CC=1 SCAR=6.9
220 0 my ( $year, $month, $day ) = @_;
221  
222 0 return sprintf '%04d-%02d-%02d', $year, $month, $day;
223 }
224  
225 0 ▶sub _check_date_range {
Subroutine _check_date_range: not called CC=1 SCAR=6.9
226 0 my ( $widget, $value ) = @_;
227  
228 0 return _check_date_range_slots( $widget->slots, $value );
229 }
230  
231 0 ▶sub _check_date_range_slots {
Subroutine _check_date_range_slots: not called CC=9 SCAR=45.0
232 0 my ( $slots, $value ) = @_;
233  
234 0 my $min = $slots->{_min};
235 0 my $max = $slots->{_max};
236 0 ▶ _runtime_error( 'GUI_PROP_TYPE', 'DatePicker min is after max' )
Branch: 1 branch
BranchTrueFalseTotal
if defined $min and defined $max and $min gt $max 0 0 0
Condition0%0/6
defined $min and defined $max and $min gt $max
!ll&&!rl&&r
000
defined $min and defined $max
!ll&&!rl&&r
000
MC/DC0%0/3
defined $min and defined $max and $min gt $max
defined $min defined $max $min gt $max
Truth table0%0/4
A and B and C
A= defined $minB= defined $maxC= $min gt $max
ABCresult
0XX0
10X0
1100
1111
237 if defined $min and defined $max and $min gt $max;
238 0 ▶ return if !defined $value;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 0 0 0
239 0 ▶ _runtime_error( 'GUI_PROP_TYPE', 'value is before DatePicker min' )
Branch: 1 branch
BranchTrueFalseTotal
if defined $min and $value lt $min 0 0 0
Condition0%0/3
defined $min and $value lt $min
!ll&&!rl&&r
000
MC/DC0%0/2
defined $min and $value lt $min
defined $min $value lt $min
Truth table0%0/3
A and B
A= defined $minB= $value lt $min
ABresult
0X0
100
111
240 if defined $min and $value lt $min;
241 0 ▶ _runtime_error( 'GUI_PROP_TYPE', 'value is after DatePicker max' )
Branch: 1 branch
BranchTrueFalseTotal
if defined $max and $value gt $max 0 0 0
Condition0%0/3
defined $max and $value gt $max
!ll&&!rl&&r
000
MC/DC0%0/2
defined $max and $value gt $max
defined $max $value gt $max
Truth table0%0/3
A and B
A= defined $maxB= $value gt $max
ABresult
0X0
100
111
242 if defined $max and $value gt $max;
243 0 return;
244 }
245  
246 0 ▶sub _array_prop {
Subroutine _array_prop: not called CC=5 SCAR=34.0
247 0 my ( $named, $name, $default ) = @_;
248  
249 0 ▶ return $default if !exists $named->{$name};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $named->{$name} 0 0 0
250 _runtime_error( 'GUI_PROP_TYPE', "$name property expects an Array" )
251 if defined $named->{$name}
252 and ( !blessed( $named->{$name} )
253 0 ▶ or !$named->{$name}->isa('Zuzu::Value::Array') );
Branch: 1 branch
BranchTrueFalseTotal
if defined $named->{$name} and not builtin::blessed($named->{$name}) && $named->{$name}->isa("Zuzu::Value::Array") 0 0 0
Condition0%0/6
defined $named->{$name} and not builtin::blessed($named->{$name}) && $named->{$name}->isa("Zuzu::Value::Array")
!ll&&!rl&&r
000
builtin::blessed($named->{$name}) && $named->{$name}->isa('Zuzu::Value::Array')
!ll&&!rl&&r
000
MC/DC0%0/3
defined $named->{$name} and not builtin::blessed($named->{$name}) && $named->{$name}->isa("Zuzu::Value::Array")
defined $named->{$name} builtin::blessed($named->{$name}) $named->{$name}->isa('Zuzu::Value::Array')
Truth table0%0/4
A and not(B && C)
A= defined $named->{$name}B= builtin::blessed($named->{$name})C= $named->{$name}->isa('Zuzu::Value::Array')
ABCresult
0XX0
1110
10X1
1101
254 0 return $named->{$name};
255 }
256  
257 0 ▶sub _enum_prop {
Subroutine _enum_prop: not called CC=3 SCAR=24.8
258 0 my ( $class_name, $named, $name, $default, @allowed ) = @_;
259  
260 0 my $value = _string_prop( $named, $name, $default );
261 0 my %allowed = map { $_ => 1 } @allowed;
262 _runtime_error(
263 'GUI_PROP_TYPE',
264 "$class_name property '$name' must be one of: " . join( ', ', @allowed ),
265 0 ▶ ) if defined $value and !$allowed{$value};
Branch: 1 branch
BranchTrueFalseTotal
if defined $value and not $allowed{$value} 0 0 0
Condition0%0/3
defined $value and not $allowed{$value}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $value and not $allowed{$value}
defined $value not $allowed{$value}
Truth table0%0/3
A and not(B)
A= defined $valueB= not $allowed{$value}
ABresult
0X0
100
111
266  
267 0 return $value;
268 }
269  
270 2 ▶sub _native_widget {
Subroutine _native_widget: called CC=1 SCAR=0.0
271 2 my ( $class, $slots ) = @_;
272  
273 2 return native_object(
274 class => $class,
275 slots => $slots,
276 );
277 }
278  
279 6 ▶sub _slot {
Subroutine _slot: called CC=3 SCAR=12.5
280 6 my ( $object, $name ) = @_;
281  
282 6 ▶ return undef if !blessed($object) or !$object->isa('Zuzu::Value::Object');
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($object) and $object->isa("Zuzu::Value::Object") 0 6 6
Condition33%1/3
builtin::blessed($object) and $object->isa("Zuzu::Value::Object")
!ll&&!rl&&r
006
MC/DC0%0/2
builtin::blessed($object) and $object->isa("Zuzu::Value::Object")
builtin::blessed($object) $object->isa("Zuzu::Value::Object")
Truth table33%1/3
A and B
A= builtin::blessed($object)B= $object->isa("Zuzu::Value::Object")
ABresult
0X0
100
111
283 6 return slot_value( \$object->slots->{$name} );
284 }
285  
286 12 ▶sub _set_slot {
Subroutine _set_slot: called CC=5 SCAR=18.1
287 12 my ( $object, $name, $value, $weak ) = @_;
288  
289 12 ▶ return if !blessed($object) or !$object->isa('Zuzu::Value::Object');
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($object) and $object->isa("Zuzu::Value::Object") 0 12 12
Condition33%1/3
builtin::blessed($object) and $object->isa("Zuzu::Value::Object")
!ll&&!rl&&r
0012
MC/DC0%0/2
builtin::blessed($object) and $object->isa("Zuzu::Value::Object")
builtin::blessed($object) $object->isa("Zuzu::Value::Object")
Truth table33%1/3
A and B
A= builtin::blessed($object)B= $object->isa("Zuzu::Value::Object")
ABresult
0X0
100
111
290 12 ▶ $object->weak->{$name} = $weak ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$weak ? : 12 0 12
291 12 ▶ store_value( \$object->slots->{$name}, $value, $weak ? 1 : 0 );
Branch: 1 branch
BranchTrueFalseTotal
$weak ? : 12 0 12
292 12 return $value;
293 }
294  
295 6 ▶sub _parent {
Subroutine _parent: called CC=1 SCAR=0.0
296 6 my ( $widget ) = @_;
297  
298 6 return _slot( $widget, '_parent' );
299 }
300  
301 0 ▶sub _set_parent {
Subroutine _set_parent: not called CC=1 SCAR=6.9
302 0 my ( $child, $parent ) = @_;
303  
304 0 _set_slot( $child, '_parent', $parent, 1 );
305 0 return;
306 }
307  
308 0 ▶sub _remove_child_ref {
Subroutine _remove_child_ref: not called CC=1 SCAR=6.9
309 0 my ( $parent, $child ) = @_;
310  
311 0 my @kept = grep { $_ != $child } @{ $parent->slots->{_children}->items };
312 0 $parent->slots->{_children}->items( \@kept );
313 0 return;
314 }
315  
316 0 ▶sub _adopt_child {
Subroutine _adopt_child: not called CC=22 SCAR=62.3
317 0 my ( $parent, $child ) = @_;
318  
319 0 ▶ _runtime_error( 'GUI_PROP_TYPE', 'add_child expects a Widget' )
Branch: 1 branch
BranchTrueFalseTotal
unless _is_widget($child) 0 0 0
320 if !_is_widget($child);
321  
322 0 my $parent_kind = _class_name($parent);
323 0 my $child_kind = _class_name($child);
324 0 ▶ _runtime_error( 'GUI_PROP_TYPE', 'Menu widgets can only be Window children' )
Branch: 1 branch
BranchTrueFalseTotal
if $child_kind eq "Menu" and $parent_kind ne "Window" 0 0 0
Condition0%0/3
$child_kind eq "Menu" and $parent_kind ne "Window"
!ll&&!rl&&r
000
MC/DC0%0/2
$child_kind eq "Menu" and $parent_kind ne "Window"
$child_kind eq "Menu" $parent_kind ne "Window"
Truth table0%0/3
A and B
A= $child_kind eq "Menu"B= $parent_kind ne "Window"
ABresult
0X0
100
111
325 if $child_kind eq 'Menu' and $parent_kind ne 'Window';
326 0 ▶ _runtime_error( 'GUI_PROP_TYPE', 'MenuItem widgets can only be Menu children' )
Branch: 1 branch
BranchTrueFalseTotal
if $child_kind eq "MenuItem" and $parent_kind ne "Menu" 0 0 0
Condition0%0/3
$child_kind eq "MenuItem" and $parent_kind ne "Menu"
!ll&&!rl&&r
000
MC/DC0%0/2
$child_kind eq "MenuItem" and $parent_kind ne "Menu"
$child_kind eq "MenuItem" $parent_kind ne "Menu"
Truth table0%0/3
A and B
A= $child_kind eq "MenuItem"B= $parent_kind ne "Menu"
ABresult
0X0
100
111
327 if $child_kind eq 'MenuItem' and $parent_kind ne 'Menu';
328 0 ▶ _runtime_error(
Branch: 1 branch
BranchTrueFalseTotal
if $parent_kind eq "Menu" and $child_kind ne "MenuItem" 0 0 0
Condition0%0/3
$parent_kind eq "Menu" and $child_kind ne "MenuItem"
!ll&&!rl&&r
000
MC/DC0%0/2
$parent_kind eq "Menu" and $child_kind ne "MenuItem"
$parent_kind eq "Menu" $child_kind ne "MenuItem"
Truth table0%0/3
A and B
A= $parent_kind eq "Menu"B= $child_kind ne "MenuItem"
ABresult
0X0
100
111
329 'GUI_PROP_TYPE',
330 'Menu widgets can only contain MenuItem children',
331 )
332 if $parent_kind eq 'Menu' and $child_kind ne 'MenuItem';
333 0 ▶ _runtime_error( 'GUI_PROP_TYPE', 'MenuItem widgets cannot have children' )
Branch: 1 branch
BranchTrueFalseTotal
if $parent_kind eq "MenuItem" 0 0 0
334 if $parent_kind eq 'MenuItem';
335  
336 0 my $old_parent = _parent($child);
337 0 ▶ _remove_child_ref( $old_parent, $child )
Branch: 1 branch
BranchTrueFalseTotal
if defined $old_parent and $old_parent != $parent 0 0 0
Condition0%0/3
defined $old_parent and $old_parent != $parent
!ll&&!rl&&r
000
MC/DC0%0/2
defined $old_parent and $old_parent != $parent
defined $old_parent $old_parent != $parent
Truth table0%0/3
A and B
A= defined $old_parentB= $old_parent != $parent
ABresult
0X0
100
111
338 if defined $old_parent and $old_parent != $parent;
339  
340 0 my $children = $parent->slots->{_children}->items;
341 0 ▶ push @{ $children }, $child if !grep { $_ == $child } @{ $children };
Branch: 1 branch
BranchTrueFalseTotal
unless grep {$_ == $child;} @{$children;} 0 0 0
342 0 _set_parent( $child, $parent );
343 0 ▶ if ( $parent_kind eq 'RadioGroup' and $child_kind eq 'Radio' ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($parent_kind eq 'RadioGroup' and $child_kind eq 'Radio') { } 0 0 0
elsif ($parent_kind eq 'Tabs' and $child_kind eq 'Tab') { } 0 0 0
elsif ($child_kind eq 'Radio' and $child->slots->{'_checked'}) { } 0 0 0
Condition0%0/3
$parent_kind eq "RadioGroup" and $child_kind eq "Radio"
!ll&&!rl&&r
000
MC/DC0%0/2
$parent_kind eq "RadioGroup" and $child_kind eq "Radio"
$parent_kind eq "RadioGroup" $child_kind eq "Radio"
Truth table0%0/3
A and B
A= $parent_kind eq "RadioGroup"B= $child_kind eq "Radio"
ABresult
0X0
100
111
344 0 ▶ if ( defined $parent->slots->{_value} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $parent->slots->{'_value'}) { } 0 0 0
elsif ($child->slots->{'_checked'}) { } 0 0 0
345 0 _sync_radio_group_value( $parent, $parent->slots->{_value} );
346 }
347 elsif ( $child->slots->{_checked} ) {
348 0 _sync_radio_group_value( $parent, $child->slots->{_value} );
349 }
350 }
351 ▶ elsif ( $parent_kind eq 'Tabs' and $child_kind eq 'Tab' ) {
Condition0%0/3
$parent_kind eq "Tabs" and $child_kind eq "Tab"
!ll&&!rl&&r
000
MC/DC0%0/2
$parent_kind eq "Tabs" and $child_kind eq "Tab"
$parent_kind eq "Tabs" $child_kind eq "Tab"
Truth table0%0/3
A and B
A= $parent_kind eq "Tabs"B= $child_kind eq "Tab"
ABresult
0X0
100
111
352 0 ▶ if ( defined $parent->slots->{_selected} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $parent->slots->{'_selected'}) { } 0 0 0
elsif ($child->slots->{'_selected'}) { } 0 0 0
353 0 _sync_tabs_selected( $parent, $parent->slots->{_selected} );
354 }
355 elsif ( $child->slots->{_selected} ) {
356 0 _sync_tabs_selected( $parent, $child->slots->{_value} );
357 }
358 }
359 ▶ elsif ( $child_kind eq 'Radio' and $child->slots->{_checked} ) {
Condition0%0/3
$child_kind eq "Radio" and $child->slots->{"_checked"}
!ll&&!rl&&r
000
MC/DC0%0/2
$child_kind eq "Radio" and $child->slots->{"_checked"}
$child_kind eq "Radio" $child->slots->{"_checked"}
Truth table0%0/3
A and B
A= $child_kind eq "Radio"B= $child->slots->{"_checked"}
ABresult
0X0
100
111
360 0 _set_radio_checked( $child, 1 );
361 }
362 0 return;
363 }
364  
365 0 ▶sub _install_children {
Subroutine _install_children: not called CC=5 SCAR=34.0
366 0 my ( $parent, $children ) = @_;
367  
368 0 ▶ return if !defined $children;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $children 0 0 0
369 0 ▶ _runtime_error( 'GUI_PROP_TYPE', 'children property expects an Array' )
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($children) and $children->isa("Zuzu::Value::Array") 0 0 0
Condition0%0/3
builtin::blessed($children) and $children->isa("Zuzu::Value::Array")
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::blessed($children) and $children->isa("Zuzu::Value::Array")
builtin::blessed($children) $children->isa("Zuzu::Value::Array")
Truth table0%0/3
A and B
A= builtin::blessed($children)B= $children->isa("Zuzu::Value::Array")
ABresult
0X0
100
111
370 if !blessed($children) or !$children->isa('Zuzu::Value::Array');
371  
372 0 for my $child ( @{ $children->items } ) {
373 0 _adopt_child( $parent, $child );
374 }
375 0 return;
376 }
377  
378 0 ▶sub _remove_class {
Subroutine _remove_class: not called CC=2 SCAR=17.9
379 0 my ( $self, $class_name ) = @_;
380  
381 0 ▶ $class_name = defined $class_name ? "$class_name" : '';
Branch: 1 branch
BranchTrueFalseTotal
defined $class_name ? : 0 0 0
382 0 my @kept = grep { $_ ne $class_name } @{ $self->slots->{_classes}->items };
383 0 $self->slots->{_classes}->items( \@kept );
384 0 return;
385 }
386  
387 6 ▶sub _make_event {
Subroutine _make_event: called CC=2 SCAR=7.0
388 6 my ( $event_class, $name, $target, $data ) = @_;
389  
390 6 ▶ my $event = native_object(
Branch: 1 branch
BranchTrueFalseTotal
defined $name ? : 6 0 6
391 class => $event_class,
392 slots => {
393 name => defined $name ? "$name" : '',
394 target => undef,
395 current_target => undef,
396 timestamp => time(),
397 data => $data,
398 cancelled => 0,
399 propagation_stopped => 0,
400 default_prevented => 0,
401 phase => '',
402 },
403 );
404 6 _set_slot( $event, 'target', $target, 1 );
405 6 _set_slot( $event, 'current_target', undef, 1 );
406 6 return $event;
407 }
408  
409 0 ▶sub _call_handler {
Subroutine _call_handler: not called CC=6 SCAR=37.4
410 0 my ( $runtime, $handler, $event ) = @_;
411  
412 0 ▶ my $params = $handler->params // [];
Condition0%0/2
$handler->params // []
l!l
00
MC/DC0%0/1
$handler->params // []
$handler->params
Truth table0%0/2
A
A= $handler->params
Aresult
11
00
413 0 my $vararg = $handler->vararg;
414 0 ▶ my @args = ( !@{ $params } and !defined $vararg ) ? () : ($event);
Branch: 1 branch
BranchTrueFalseTotal
!(@{$params;} || defined $vararg) ? : 0 0 0
Condition0%0/3
@{$params;} || defined $vararg
l!l&&r!l&&!r
000
MC/DC0%0/2
@{$params;} || defined $vararg
@{$params;} defined $vararg
Truth table0%0/3
A || B
A= @{$params;}B= defined $vararg
ABresult
1X1
011
000
415  
416 return $runtime->_call_function(
417 $handler,
418 \@args,
419 {},
420 [],
421 $runtime->{_native_call_file} // '<runtime>',
422 0 ▶ $runtime->{_native_call_line} // 0,
Condition0%0/4
$runtime->{"_native_call_file"} // "<runtime>"
l!l
00
$runtime->{"_native_call_line"} // 0
l!l
00
MC/DC0%0/1
$runtime->{"_native_call_file"} // "<runtime>"
$runtime->{"_native_call_file"}
MC/DC0%0/1
$runtime->{"_native_call_line"} // 0
$runtime->{"_native_call_line"}
Truth table0%0/2
A
A= $runtime->{"_native_call_file"}
Aresult
11
00
Truth table0%0/2
A
A= $runtime->{"_native_call_line"}
Aresult
11
00
423 );
424 }
425  
426 6 ▶sub _dispatch_at {
Subroutine _dispatch_at: called CC=12 SCAR=46.5
427 6 my ( $runtime, $widget, $event, $name, $phase, $errors ) = @_;
428  
429 6 ▶ my $listeners = $widget->slots->{_listeners}{$name} // [];
Condition50%1/2
$widget->slots->{"_listeners"}{$name} // []
l!l
06
MC/DC0%0/1
$widget->slots->{"_listeners"}{$name} // []
$widget->slots->{"_listeners"}{$name}
Truth table50%1/2
A
A= $widget->slots->{"_listeners"}{$name}
Aresult
11
00
430 6 ▶ return if !@{ $listeners };
Branch: 1 branch
BranchTrueFalseTotal
unless @{$listeners;} 6 0 6
431  
432 0 _set_slot( $event, 'current_target', $widget, 1 );
433 0 $event->slots->{phase} = $phase;
434  
435 0 my @remaining;
436 0 for my $listener ( @{ $listeners } ) {
437 0 ▶ if ( $phase eq 'capture' and !$listener->{capture} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($phase eq "capture" and not $listener->{"capture"}) 0 0 0
Condition0%0/3
$phase eq "capture" and not $listener->{"capture"}
!ll&&!rl&&r
000
MC/DC0%0/2
$phase eq "capture" and not $listener->{"capture"}
$phase eq "capture" not $listener->{"capture"}
Truth table0%0/3
A and not(B)
A= $phase eq "capture"B= not $listener->{"capture"}
ABresult
0X0
100
111
438 0 push @remaining, $listener;
439 0 next;
440 }
441 0 ▶ if ( !$listener->{once_done} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($listener->{"once_done"}) 0 0 0
442 eval {
443 0 _call_handler( $runtime, $listener->{handler}, $event );
444 0 1;
445 0 ▶ } or do {
Branch: 1 branch
BranchTrueFalseTotal
eval { do { _call_handler($runtime, $listener->{"handler"}, $event); 1 } } or do { push @{$errors;}, $@ || "unknown handler error" } 0 0 0
446 0 ▶ push @{ $errors }, $@ || 'unknown handler error';
Condition0%0/2
$@ || 'unknown handler error'
l!l
00
MC/DC0%0/1
$@ || 'unknown handler error'
$@
Truth table0%0/2
A
A= $@
Aresult
11
00
447 };
448 }
449 0 ▶ $listener->{once_done} = 1 if $listener->{once};
Branch: 1 branch
BranchTrueFalseTotal
if $listener->{"once"} 0 0 0
450 0 ▶ push @remaining, $listener if !$listener->{once_done};
Branch: 1 branch
BranchTrueFalseTotal
unless $listener->{"once_done"} 0 0 0
451 0 ▶ last if $event->slots->{propagation_stopped};
Branch: 1 branch
BranchTrueFalseTotal
if $event->slots->{"propagation_stopped"} 0 0 0
452 }
453  
454 0 $widget->slots->{_listeners}{$name} = \@remaining;
455 0 return;
456 }
457  
458 6 ▶sub _dispatch_event {
Subroutine _dispatch_event: called CC=8 SCAR=25.7
459 6 my ( $runtime, $source, $event ) = @_;
460  
461 6 my $name = $event->slots->{name};
462 6 my @path;
463 6 my $node = $source;
464 6 ▶ while ( defined $node ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $node) 6 6 12
465 6 push @path, $node;
466 6 $node = _parent($node);
467 }
468  
469 6 my @errors;
470 6 ▶ for ( my $i = $#path; $i > 0; $i-- ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i > 0) 0 6 6
471 0 _dispatch_at( $runtime, $path[$i], $event, $name, 'capture', \@errors );
472 0 ▶ last if $event->slots->{propagation_stopped};
Branch: 1 branch
BranchTrueFalseTotal
if $event->slots->{"propagation_stopped"} 0 0 0
473 }
474  
475 6 ▶ if ( !$event->slots->{propagation_stopped} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($event->slots->{"propagation_stopped"}) 6 0 6
476 6 _dispatch_at( $runtime, $source, $event, $name, 'target', \@errors );
477 }
478  
479 6 ▶ for ( my $i = 1; $i <= $#path; $i++ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#path) 0 6 6
480 0 ▶ last if $event->slots->{propagation_stopped};
Branch: 1 branch
BranchTrueFalseTotal
if $event->slots->{"propagation_stopped"} 0 0 0
481 0 _dispatch_at( $runtime, $path[$i], $event, $name, 'bubble', \@errors );
482 }
483  
484 6 ▶ if (@errors) {
Branch: 1 branch
BranchTrueFalseTotal
if (@errors) 0 6 6
485 0 my $message = join '; ', map { "$_" } @errors;
486 0 _runtime_error( 'GUI_EVENT_HANDLER', $message );
487 }
488  
489 6 return $event;
490 }
491  
492 0 ▶sub _owner_window {
Subroutine _owner_window: not called CC=4 SCAR=30.0
493 0 my ($widget) = @_;
494  
495 0 ▶ while ( defined $widget and _is_widget($widget) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $widget and _is_widget($widget)) 0 0 0
Condition0%0/3
defined $widget and _is_widget($widget)
!ll&&!rl&&r
000
MC/DC0%0/2
defined $widget and _is_widget($widget)
defined $widget _is_widget($widget)
Truth table0%0/3
A and B
A= defined $widgetB= _is_widget($widget)
ABresult
0X0
100
111
496 0 ▶ return $widget if _class_name($widget) eq 'Window';
Branch: 1 branch
BranchTrueFalseTotal
if _class_name($widget) eq "Window" 0 0 0
497 0 $widget = _parent($widget);
498 }
499  
500 0 return undef;
501 }
502  
503 0 ▶sub _find_by_id {
Subroutine _find_by_id: not called CC=6 SCAR=37.4
504 0 my ( $widget, $id ) = @_;
505  
506 return $widget if defined $widget->slots->{_id}
507 and defined $id
508 0 ▶ and $widget->slots->{_id} eq "$id";
Branch: 1 branch
BranchTrueFalseTotal
if defined $widget->slots->{"_id"} and defined $id and $widget->slots->{"_id"} eq "$id" 0 0 0
Condition0%0/6
defined $widget->slots->{"_id"} and defined $id and $widget->slots->{"_id"} eq "$id"
!ll&&!rl&&r
000
defined $widget->slots->{"_id"} and defined $id
!ll&&!rl&&r
000
MC/DC0%0/3
defined $widget->slots->{"_id"} and defined $id and $widget->slots->{"_id"} eq "$id"
defined $widget->slots->{"_id"} defined $id $widget->slots->{"_id"} eq "$id"
Truth table0%0/4
A and B and C
A= defined $widget->slots->{"_id"}B= defined $idC= $widget->slots->{"_id"} eq "$id"
ABCresult
0XX0
10X0
1100
1111
509  
510 0 for my $child ( @{ $widget->slots->{_children}->items } ) {
511 0 my $found = _find_by_id( $child, $id );
512 0 ▶ return $found if defined $found;
Branch: 1 branch
BranchTrueFalseTotal
if defined $found 0 0 0
513 }
514  
515 0 return undef;
516 }
517  
518 0 ▶sub _listener_token {
Subroutine _listener_token: not called CC=1 SCAR=6.9
519 0 my ( $class, $widget, $event, $id ) = @_;
520  
521 0 my $token = native_object(
522 class => $class,
523 slots => {
524 _widget => undef,
525 _event => $event,
526 _id => $id,
527 },
528 );
529 0 _set_slot( $token, '_widget', $widget, 1 );
530 0 return $token;
531 }
532  
533 7 ▶sub _add_widget_methods {
Subroutine _add_widget_methods: called CC=4 SCAR=26.4
534 7 my ( $runtime, $widget_class, $event_class, $listener_token_class ) = @_;
535  
536 $widget_class->methods->{id} = native_function(
537 name => 'id',
538 0 ▶ native => sub { return $_[0]->slots->{_id}; },
Subroutine __ANON__: not called CC=1 SCAR=6.9
539 7 );
540 $widget_class->methods->{set_id} = native_function(
541 name => 'set_id',
542 0 ▶ native => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
543 0 my ( $self, $id ) = @_;
544 0 ▶ $self->slots->{_id} = defined $id ? "$id" : undef;
Branch: 1 branch
BranchTrueFalseTotal
defined $id ? : 0 0 0
545 0 return $self;
546 },
547 7 );
548 $widget_class->methods->{parent} = native_function(
549 name => 'parent',
550 0 ▶ native => sub { return _parent( $_[0] ); },
Subroutine __ANON__: not called CC=1 SCAR=6.9
551 7 );
552 $widget_class->methods->{children} = native_function(
553 name => 'children',
554 0 ▶ native => sub { return _copy_array( $_[0]->slots->{_children} ); },
Subroutine __ANON__: not called CC=1 SCAR=6.9
555 7 );
556 $widget_class->methods->{add_child} = native_function(
557 name => 'add_child',
558 0 ▶ native => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
559 0 my ( $self, $child ) = @_;
560 0 _adopt_child( $self, $child );
561 0 return $self;
562 },
563 7 );
564 $widget_class->methods->{remove_child} = native_function(
565 name => 'remove_child',
566 0 ▶ native => sub {
Subroutine __ANON__: not called CC=4 SCAR=30.0
567 0 my ( $self, $child ) = @_;
568 0 ▶ return $self if !_is_widget($child);
Branch: 1 branch
BranchTrueFalseTotal
unless _is_widget($child) 0 0 0
569 0 _remove_child_ref( $self, $child );
570 0 ▶ _set_parent( $child, undef )
Branch: 1 branch
BranchTrueFalseTotal
if defined _parent($child) and _parent($child) == $self 0 0 0
Condition0%0/3
defined _parent($child) and _parent($child) == $self
!ll&&!rl&&r
000
MC/DC0%0/2
defined _parent($child) and _parent($child) == $self
defined _parent($child) _parent($child) == $self
Truth table0%0/3
A and B
A= defined _parent($child)B= _parent($child) == $self
ABresult
0X0
100
111
571 if defined _parent($child)
572 and _parent($child) == $self;
573 0 return $self;
574 },
575 7 );
576 $widget_class->methods->{enabled} = native_function(
577 name => 'enabled',
578 0 ▶ native => sub { return $_[0]->slots->{_enabled} ? 1 : 0; },
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
$_[0]->slots->{'_enabled'} ? : 0 0 0
579 7 );
580 $widget_class->methods->{set_enabled} = native_function(
581 name => 'set_enabled',
582 0 ▶ native => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
583 0 my ( $self, $enabled ) = @_;
584 0 ▶ $self->slots->{_enabled} = zuzu_bool( $enabled, 1 ) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
zuzu_bool($enabled, 1) ? : 0 0 0
585 0 return $self;
586 },
587 7 );
588 $widget_class->methods->{visible} = native_function(
589 name => 'visible',
590 0 ▶ native => sub { return $_[0]->slots->{_visible} ? 1 : 0; },
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
$_[0]->slots->{'_visible'} ? : 0 0 0
591 7 );
592 $widget_class->methods->{set_visible} = native_function(
593 name => 'set_visible',
594 0 ▶ native => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
595 0 my ( $self, $visible ) = @_;
596 0 ▶ $self->slots->{_visible} = zuzu_bool( $visible, 1 ) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
zuzu_bool($visible, 1) ? : 0 0 0
597 0 return $self;
598 },
599 7 );
600 7 for my $method_name ( qw(
601 width height minwidth minheight maxwidth maxheight
602 ) ) {
603 42 my $slot = '_' . $method_name;
604 $widget_class->methods->{$method_name} = native_function(
605 name => $method_name,
606 0 ▶ native => sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
607 0 my ( $self, @args ) = @_;
608 0 ▶ if (@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) 0 0 0
609 0 ▶ $self->slots->{$slot} = defined $args[0]
Branch: 1 branch
BranchTrueFalseTotal
defined $args[0] ? : 0 0 0
610 ? 0 + $args[0]
611 : undef;
612 0 _refresh_native($self);
613 0 return $self;
614 }
615 0 return $self->slots->{$slot};
616 },
617 42 );
618 }
619 $widget_class->methods->{classes} = native_function(
620 name => 'classes',
621 0 ▶ native => sub { return _copy_array( $_[0]->slots->{_classes} ); },
Subroutine __ANON__: not called CC=1 SCAR=6.9
622 7 );
623 $widget_class->methods->{add_class} = native_function(
624 name => 'add_class',
625 0 ▶ native => sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
626 0 my ( $self, $class_name ) = @_;
627 0 ▶ $class_name = defined $class_name ? "$class_name" : '';
Branch: 1 branch
BranchTrueFalseTotal
defined $class_name ? : 0 0 0
628 0 my $items = $self->slots->{_classes}->items;
629 0 ▶ push @{ $items }, $class_name if !grep { $_ eq $class_name } @{ $items };
Branch: 1 branch
BranchTrueFalseTotal
unless grep {$_ eq $class_name;} @{$items;} 0 0 0
630 0 return $self;
631 },
632 7 );
633 $widget_class->methods->{remove_class} = native_function(
634 name => 'remove_class',
635 0 ▶ native => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
636 0 my ( $self, $class_name ) = @_;
637 0 _remove_class( $self, $class_name );
638 0 return $self;
639 },
640 7 );
641 7 for my $method_name ( qw( style meta ) ) {
642 14 my $slot = '_' . $method_name;
643 $widget_class->methods->{$method_name} = native_function(
644 name => $method_name,
645 0 ▶ native => sub {
Subroutine __ANON__: not called CC=4 SCAR=30.0
646 0 my ( $self, $key, @rest ) = @_;
647 0 ▶ $key = defined $key ? "$key" : '';
Branch: 1 branch
BranchTrueFalseTotal
defined $key ? : 0 0 0
648 0 my $map = $self->slots->{$slot}->map;
649 0 ▶ if (@rest) {
Branch: 1 branch
BranchTrueFalseTotal
if (@rest) 0 0 0
650 0 $map->{$key} = $rest[0];
651 0 return $self;
652 }
653 0 ▶ return exists $map->{$key} ? $map->{$key} : undef;
Branch: 1 branch
BranchTrueFalseTotal
exists $map->{$key} ? : 0 0 0
654 },
655 14 );
656 }
657  
658 $widget_class->methods->{on} = native_function(
659 name => 'on',
660 0 ▶ native => sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
661 0 my ( $self, $name, $handler ) = @_;
662 0 ▶ _runtime_error( 'GUI_EVENT_HANDLER', 'on expects a Function handler' )
Branch: 1 branch
BranchTrueFalseTotal
unless _is_function($handler) 0 0 0
663 if !_is_function($handler);
664 0 ▶ $name = defined $name ? "$name" : '';
Branch: 1 branch
BranchTrueFalseTotal
defined $name ? : 0 0 0
665 0 my $id = ++$self->slots->{_listener_seq};
666 0 push @{ $self->slots->{_listeners}{$name} }, {
667 id => $id,
668 handler => $handler,
669 once => 0,
670 once_done => 0,
671 capture => 0,
672 };
673 0 return _listener_token( $listener_token_class, $self, $name, $id );
674 },
675 7 );
676 $widget_class->methods->{once} = native_function(
677 name => 'once',
678 0 ▶ native => sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
679 0 my ( $self, $name, $handler ) = @_;
680 0 ▶ _runtime_error( 'GUI_EVENT_HANDLER', 'once expects a Function handler' )
Branch: 1 branch
BranchTrueFalseTotal
unless _is_function($handler) 0 0 0
681 if !_is_function($handler);
682 0 ▶ $name = defined $name ? "$name" : '';
Branch: 1 branch
BranchTrueFalseTotal
defined $name ? : 0 0 0
683 0 my $id = ++$self->slots->{_listener_seq};
684 0 push @{ $self->slots->{_listeners}{$name} }, {
685 id => $id,
686 handler => $handler,
687 once => 1,
688 once_done => 0,
689 capture => 0,
690 };
691 0 return _listener_token( $listener_token_class, $self, $name, $id );
692 },
693 7 );
694 $widget_class->methods->{off} = native_function(
695 name => 'off',
696 0 ▶ native => sub {
Subroutine __ANON__: not called CC=7 SCAR=40.3
697 0 my ( $self, $token ) = @_;
698 0 ▶ return 0 if !blessed($token) or !$token->isa('Zuzu::Value::Object');
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($token) and $token->isa("Zuzu::Value::Object") 0 0 0
Condition0%0/3
builtin::blessed($token) and $token->isa("Zuzu::Value::Object")
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::blessed($token) and $token->isa("Zuzu::Value::Object")
builtin::blessed($token) $token->isa("Zuzu::Value::Object")
Truth table0%0/3
A and B
A= builtin::blessed($token)B= $token->isa("Zuzu::Value::Object")
ABresult
0X0
100
111
699 0 ▶ return 0 if ( _slot( $token, '_widget' ) // undef ) != $self;
Branch: 1 branch
BranchTrueFalseTotal
if (_slot($token, "_widget") // undef) != $self 0 0 0
Condition0%0/2
_slot($token, "_widget") // undef
l!l
00
MC/DC0%0/1
_slot($token, "_widget") // undef
_slot($token, "_widget")
Truth table0%0/2
A
A= _slot($token, "_widget")
Aresult
11
00
700 0 my $name = $token->slots->{_event};
701 0 my $id = $token->slots->{_id};
702 0 ▶ my $listeners = $self->slots->{_listeners}{$name} // [];
Condition0%0/2
$self->slots->{"_listeners"}{$name} // []
l!l
00
MC/DC0%0/1
$self->slots->{"_listeners"}{$name} // []
$self->slots->{"_listeners"}{$name}
Truth table0%0/2
A
A= $self->slots->{"_listeners"}{$name}
Aresult
11
00
703 0 my $before = scalar @{ $listeners };
704 0 my @kept = grep { $_->{id} != $id } @{ $listeners };
705 0 $self->slots->{_listeners}{$name} = \@kept;
706 0 ▶ return scalar(@kept) == $before ? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
scalar @kept == $before ? : 0 0 0
707 },
708 7 );
709 $widget_class->methods->{emit} = native_function(
710 name => 'emit',
711 0 ▶ native => sub {
Subroutine __ANON__: not called CC=7 SCAR=40.3
712 0 my ( $self, $name, $payload ) = @_;
713 0 ▶ $name = defined $name ? "$name" : '';
Branch: 1 branch
BranchTrueFalseTotal
defined $name ? : 0 0 0
714 0 my $event;
715 0 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::blessed($payload) and $payload->isa('Zuzu::Value::Object') and _class_name($payload) eq 'Event') { } 0 0 0
Condition0%0/6
builtin::blessed($payload) and $payload->isa("Zuzu::Value::Object") and _class_name($payload) eq "Event"
!ll&&!rl&&r
000
builtin::blessed($payload) and $payload->isa("Zuzu::Value::Object")
!ll&&!rl&&r
000
MC/DC0%0/3
builtin::blessed($payload) and $payload->isa("Zuzu::Value::Object") and _class_name($payload) eq "Event"
builtin::blessed($payload) $payload->isa("Zuzu::Value::Object") _class_name($payload) eq "Event"
Truth table0%0/4
A and B and C
A= builtin::blessed($payload)B= $payload->isa("Zuzu::Value::Object")C= _class_name($payload) eq "Event"
ABCresult
0XX0
10X0
1100
1111
716 blessed($payload)
717 and $payload->isa('Zuzu::Value::Object')
718 and _class_name($payload) eq 'Event'
719 ) {
720 0 $event = $payload;
721 0 ▶ $event->slots->{name} = $name if !defined $event->slots->{name};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $event->slots->{"name"} 0 0 0
722 0 ▶ _set_slot( $event, 'target', $self, 1 )
Branch: 1 branch
BranchTrueFalseTotal
unless defined _slot($event, "target") 0 0 0
723 if !defined _slot( $event, 'target' );
724 }
725 else {
726 0 $event = _make_event( $event_class, $name, $self, $payload );
727 }
728 0 return _dispatch_event( $runtime, $self, $event );
729 },
730 7 );
731 $widget_class->methods->{find_by_id} = native_function(
732 name => 'find_by_id',
733 0 ▶ native => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
734 0 my ( $self, $id ) = @_;
735 0 return _find_by_id( $self, $id );
736 },
737 7 );
738  
739 7 for my $event_name ( qw(
740 activate blur change click close_request closed collapse enter
741 expand focus input open resize select submit
742 ) ) {
743 $widget_class->methods->{$event_name} = native_function(
744 name => $event_name,
745 0 ▶ native => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
746 0 my ( $self, @args ) = @_;
747 0 ▶ if (@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) 0 0 0
748 0 my $on = $runtime->_lookup_method(
749 $self->class,
750 'on',
751 0,
752 );
753 0 return $on->{_native}->(
754 $self,
755 $event_name,
756 $args[0],
757 );
758 }
759 0 my $emit = $runtime->_lookup_method(
760 $self->class,
761 'emit',
762 0,
763 );
764 0 return $emit->{_native}->(
765 $self,
766 $event_name,
767 );
768 },
769 105 );
770 }
771 }
772  
773 7 ▶sub _add_event_methods {
Subroutine _add_event_methods: called CC=2 SCAR=11.3
774 7 my ( $event_class ) = @_;
775  
776 7 for my $method_name ( qw(
777 name target current_target phase timestamp data cancelled
778 propagation_stopped default_prevented
779 ) ) {
780 $event_class->methods->{$method_name} = native_function(
781 name => $method_name,
782 0 ▶ native => sub { return _slot( $_[0], $method_name ); },
Subroutine __ANON__: not called CC=1 SCAR=6.9
783 63 );
784 }
785 $event_class->methods->{window} = native_function(
786 name => 'window',
787 0 ▶ native => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
788 0 my ($self) = @_;
789 0 return _owner_window( _slot( $self, 'target' ) );
790 },
791 7 );
792 $event_class->methods->{stop_propagation} = native_function(
793 name => 'stop_propagation',
794 0 ▶ native => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
795 0 my ( $self ) = @_;
796 0 $self->slots->{propagation_stopped} = 1;
797 0 $self->slots->{cancelled} = 1;
798 0 return $self;
799 },
800 7 );
801 $event_class->methods->{prevent_default} = native_function(
802 name => 'prevent_default',
803 0 ▶ native => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
804 0 my ( $self ) = @_;
805 0 $self->slots->{default_prevented} = 1;
806 0 $self->slots->{cancelled} = 1;
807 0 return $self;
808 },
809 7 );
810 }
811  
812 175 ▶sub _widget_constructor {
Subroutine _widget_constructor: called CC=1 SCAR=1.2
813 175 my ( $class_name, $widget_type, $extra_allowed, $slot_builder ) = @_;
814  
815 2 ▶ return sub {
Subroutine __ANON__: called CC=28 SCAR=49.1
816 2 my ( $runtime, $klass, $positional, $named ) = @_;
817 2 my %allowed = map { $_ => 1 } qw(
818 id visible enabled classes style meta children disabled
819 width height minwidth minheight maxwidth maxheight
820 );
821 2 ▶ $allowed{$_} = 1 for @{ $extra_allowed // [] };
Condition50%1/2
$extra_allowed // []
l!l
20
MC/DC0%0/1
$extra_allowed // []
$extra_allowed
Truth table50%1/2
A
A= $extra_allowed
Aresult
11
00
822 2 _validate_props( $class_name, $named, \%allowed );
823  
824 my $enabled = exists $named->{disabled}
825 2 ▶ ? ( zuzu_bool( $named->{disabled}, 0 ) ? 0 : 1 )
Branch: 2 branches
BranchTrueFalseTotal
exists $named->{'disabled'} ? : 2 0 2
zuzu_bool($named->{'disabled'}, 0) ? : 0 2 2
826 : _bool_prop( $named, 'enabled', 1 );
827 2 my $slots = _default_slots(
828 id => _string_prop( $named, 'id', undef ),
829 visible => _bool_prop( $named, 'visible', 1 ),
830 enabled => $enabled,
831 width => _optional_number_prop( $named, 'width' ),
832 height => _optional_number_prop( $named, 'height' ),
833 minwidth => _optional_number_prop( $named, 'minwidth' ),
834 minheight => _optional_number_prop( $named, 'minheight' ),
835 maxwidth => _optional_number_prop( $named, 'maxwidth' ),
836 maxheight => _optional_number_prop( $named, 'maxheight' ),
837 widget_type => $widget_type,
838 );
839 2 ▶ $slot_builder->( $slots, $named ) if $slot_builder;
Branch: 1 branch
BranchTrueFalseTotal
if $slot_builder 2 0 2
840  
841 2 my $object = _native_widget( $klass, $slots );
842 2 ▶ if ( exists $named->{classes} and blessed($named->{classes})
Branch: 1 branch
BranchTrueFalseTotal
if (exists $named->{"classes"} and builtin::blessed($named->{"classes"}) and $named->{"classes"}->isa("Zuzu::Value::Array")) 0 2 2
Condition33%2/6
exists $named->{"classes"} and builtin::blessed($named->{"classes"}) and $named->{"classes"}->isa("Zuzu::Value::Array")
!ll&&!rl&&r
200
exists $named->{"classes"} and builtin::blessed($named->{"classes"})
!ll&&!rl&&r
200
MC/DC0%0/3
exists $named->{"classes"} and builtin::blessed($named->{"classes"}) and $named->{"classes"}->isa("Zuzu::Value::Array")
exists $named->{"classes"} builtin::blessed($named->{"classes"}) $named->{"classes"}->isa("Zuzu::Value::Array")
Truth table25%1/4
A and B and C
A= exists $named->{"classes"}B= builtin::blessed($named->{"classes"})C= $named->{"classes"}->isa("Zuzu::Value::Array")
ABCresult
0XX0
10X0
1100
1111
843 and $named->{classes}->isa('Zuzu::Value::Array') ) {
844 0 $object->slots->{_classes} = _copy_array( $named->{classes} );
845 }
846 2 ▶ if ( exists $named->{style} and blessed($named->{style})
Branch: 1 branch
BranchTrueFalseTotal
if (exists $named->{"style"} and builtin::blessed($named->{"style"}) and $named->{"style"}->isa("Zuzu::Value::Dict")) 0 2 2
Condition33%2/6
exists $named->{"style"} and builtin::blessed($named->{"style"}) and $named->{"style"}->isa("Zuzu::Value::Dict")
!ll&&!rl&&r
200
exists $named->{"style"} and builtin::blessed($named->{"style"})
!ll&&!rl&&r
200
MC/DC0%0/3
exists $named->{"style"} and builtin::blessed($named->{"style"}) and $named->{"style"}->isa("Zuzu::Value::Dict")
exists $named->{"style"} builtin::blessed($named->{"style"}) $named->{"style"}->isa("Zuzu::Value::Dict")
Truth table25%1/4
A and B and C
A= exists $named->{"style"}B= builtin::blessed($named->{"style"})C= $named->{"style"}->isa("Zuzu::Value::Dict")
ABCresult
0XX0
10X0
1100
1111
847 and $named->{style}->isa('Zuzu::Value::Dict') ) {
848 0 $object->slots->{_style} = $named->{style};
849 }
850 2 ▶ if ( exists $named->{meta} and blessed($named->{meta})
Branch: 1 branch
BranchTrueFalseTotal
if (exists $named->{"meta"} and builtin::blessed($named->{"meta"}) and $named->{"meta"}->isa("Zuzu::Value::Dict")) 0 2 2
Condition33%2/6
exists $named->{"meta"} and builtin::blessed($named->{"meta"}) and $named->{"meta"}->isa("Zuzu::Value::Dict")
!ll&&!rl&&r
200
exists $named->{"meta"} and builtin::blessed($named->{"meta"})
!ll&&!rl&&r
200
MC/DC0%0/3
exists $named->{"meta"} and builtin::blessed($named->{"meta"}) and $named->{"meta"}->isa("Zuzu::Value::Dict")
exists $named->{"meta"} builtin::blessed($named->{"meta"}) $named->{"meta"}->isa("Zuzu::Value::Dict")
Truth table25%1/4
A and B and C
A= exists $named->{"meta"}B= builtin::blessed($named->{"meta"})C= $named->{"meta"}->isa("Zuzu::Value::Dict")
ABCresult
0XX0
10X0
1100
1111
851 and $named->{meta}->isa('Zuzu::Value::Dict') ) {
852 0 $object->slots->{_meta} = $named->{meta};
853 }
854  
855 2 ▶ my @children = @{ $positional // [] };
Condition50%1/2
$positional // []
l!l
20
MC/DC0%0/1
$positional // []
$positional
Truth table50%1/2
A
A= $positional
Aresult
11
00
856 2 push @children, @{ $named->{children}->items }
857 if exists $named->{children}
858 and blessed($named->{children})
859 2 ▶ and $named->{children}->isa('Zuzu::Value::Array');
Branch: 1 branch
BranchTrueFalseTotal
if exists $named->{"children"} and builtin::blessed($named->{"children"}) and $named->{"children"}->isa("Zuzu::Value::Array") 2 0 2
Condition33%2/6
exists $named->{"children"} and builtin::blessed($named->{"children"}) and $named->{"children"}->isa("Zuzu::Value::Array")
!ll&&!rl&&r
002
exists $named->{"children"} and builtin::blessed($named->{"children"})
!ll&&!rl&&r
002
MC/DC0%0/3
exists $named->{"children"} and builtin::blessed($named->{"children"}) and $named->{"children"}->isa("Zuzu::Value::Array")
exists $named->{"children"} builtin::blessed($named->{"children"}) $named->{"children"}->isa("Zuzu::Value::Array")
Truth table25%1/4
A and B and C
A= exists $named->{"children"}B= builtin::blessed($named->{"children"})C= $named->{"children"}->isa("Zuzu::Value::Array")
ABCresult
0XX0
10X0
1100
1111
860 2 ▶ _install_children( $object, _zarray(@children) ) if @children;
Branch: 1 branch
BranchTrueFalseTotal
if @children 0 2 2
861 2 ▶ if ( exists $slots->{_content} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $slots->{"_content"}) 2 0 2
862 2 my $content = $named->{content};
863 2 ▶ if ( !defined $content and @children ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $content and @children) 0 2 2
Condition33%1/3
not defined $content and @children
!ll&&!rl&&r
020
MC/DC0%0/2
not defined $content and @children
not defined $content @children
Truth table33%1/3
not(A) and B
A= not defined $contentB= @children
ABresult
0X0
100
111
864 0 for my $child (@children) {
865 0 ▶ next if _is_menu_kind($child);
Branch: 1 branch
BranchTrueFalseTotal
if _is_menu_kind($child) 0 0 0
866 0 $content = $child;
867 0 last;
868 }
869 }
870 2 ▶ if ( defined $content ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $content) 0 2 2
871 0 ▶ _runtime_error(
Branch: 1 branch
BranchTrueFalseTotal
if not _is_widget($content) or _is_menu_kind($content) 0 0 0
Condition0%0/3
not _is_widget($content) or _is_menu_kind($content)
l!l&&r!l&&!r
000
MC/DC0%0/2
not _is_widget($content) or _is_menu_kind($content)
not _is_widget($content) _is_menu_kind($content)
Truth table0%0/3
not(A) or B
A= not _is_widget($content)B= _is_menu_kind($content)
ABresult
1X1
011
000
872 'GUI_PROP_TYPE',
873 'content property expects a non-menu Widget or null',
874 ) if !_is_widget($content) or _is_menu_kind($content);
875 0 $object->slots->{_content} = $content;
876 0 _adopt_child( $object, $content );
877 }
878 }
879  
880 2 return $object;
881 175 };
882 }
883  
884 133 ▶sub _add_text_methods {
Subroutine _add_text_methods: called CC=1 SCAR=4.7
885 133 my ( $class, $slot, $getter, $setter ) = @_;
886  
887 $class->methods->{$getter} = native_function(
888 name => $getter,
889 0 ▶ native => sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
890 0 my ( $self, @args ) = @_;
891 0 ▶ if (@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) 0 0 0
892 0 ▶ $self->slots->{$slot} = defined $args[0] ? "$args[0]" : '';
Branch: 1 branch
BranchTrueFalseTotal
defined $args[0] ? : 0 0 0
893 0 _refresh_native($self);
894 0 return $self;
895 }
896 0 return $self->slots->{$slot};
897 },
898 133 );
899 $class->methods->{$setter} = native_function(
900 name => $setter,
901 0 ▶ native => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
902 0 my ( $self, $value ) = @_;
903 0 ▶ $self->slots->{$slot} = defined $value ? "$value" : '';
Branch: 1 branch
BranchTrueFalseTotal
defined $value ? : 0 0 0
904 0 _refresh_native($self);
905 0 return $self;
906 },
907 133 );
908 }
909  
910 140 ▶sub _add_bool_method {
Subroutine _add_bool_method: called CC=1 SCAR=4.9
911 140 my ( $class, $slot, $method ) = @_;
912  
913 $class->methods->{$method} = native_function(
914 name => $method,
915 0 ▶ native => sub {
Subroutine __ANON__: not called CC=4 SCAR=30.0
916 0 my ( $self, @args ) = @_;
917 0 ▶ if (@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) 0 0 0
918 0 ▶ $self->slots->{$slot} = zuzu_bool( $args[0], 0 ) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
zuzu_bool($args[0], 0) ? : 0 0 0
919 0 _refresh_native($self);
920 0 return $self;
921 }
922 0 ▶ return $self->slots->{$slot} ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$self->slots->{$slot} ? : 0 0 0
923 },
924 140 );
925 }
926  
927 49 ▶sub _add_number_method {
Subroutine _add_number_method: called CC=1 SCAR=4.6
928 49 my ( $class, $slot, $method ) = @_;
929  
930 $class->methods->{$method} = native_function(
931 name => $method,
932 0 ▶ native => sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
933 0 my ( $self, @args ) = @_;
934 0 ▶ if (@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) 0 0 0
935 0 ▶ $self->slots->{$slot} = 0 + ( $args[0] // 0 );
Condition0%0/2
$args[0] // 0
l!l
00
MC/DC0%0/1
$args[0] // 0
$args[0]
Truth table0%0/2
A
A= $args[0]
Aresult
11
00
936 0 _refresh_native($self);
937 0 return $self;
938 }
939 0 return $self->slots->{$slot};
940 },
941 49 );
942 }
943  
944 49 ▶sub _add_getter {
Subroutine _add_getter: called CC=1 SCAR=0.4
945 49 my ( $class, $slot, $method ) = @_;
946  
947 $class->methods->{$method} = native_function(
948 name => $method,
949 0 ▶ native => sub { return $_[0]->slots->{$slot}; },
Subroutine __ANON__: not called CC=1 SCAR=6.9
950 49 );
951 }
952  
953 0 ▶sub _nearest_radio_group {
Subroutine _nearest_radio_group: not called CC=3 SCAR=24.8
954 0 my ( $radio ) = @_;
955  
956 0 my $node = _parent($radio);
957 0 ▶ while ( defined $node ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $node) 0 0 0
958 0 ▶ return $node if _class_name($node) eq 'RadioGroup';
Branch: 1 branch
BranchTrueFalseTotal
if _class_name($node) eq "RadioGroup" 0 0 0
959 0 $node = _parent($node);
960 }
961  
962 0 return undef;
963 }
964  
965 0 ▶sub _find_root {
Subroutine _find_root: not called CC=2 SCAR=17.9
966 0 my ( $widget ) = @_;
967  
968 0 my $node = $widget;
969 0 ▶ while ( defined _parent($node) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined _parent($node)) 0 0 0
970 0 $node = _parent($node);
971 }
972 0 return $node;
973 }
974  
975 0 ▶sub _walk_widgets {
Subroutine _walk_widgets: not called CC=2 SCAR=17.9
976 0 my ( $widget, $callback ) = @_;
977  
978 0 $callback->($widget);
979 0 for my $child ( @{ $widget->slots->{_children}->items } ) {
980 0 _walk_widgets( $child, $callback );
981 }
982 0 return;
983 }
984  
985 0 ▶sub _sync_radio_group_value {
Subroutine _sync_radio_group_value: not called CC=7 SCAR=40.3
986 0 my ( $group, $value ) = @_;
987  
988 0 ▶ $group->slots->{_value} = defined $value ? "$value" : undef;
Branch: 1 branch
BranchTrueFalseTotal
defined $value ? : 0 0 0
989 0 for my $child ( @{ $group->slots->{_children}->items } ) {
990 0 ▶ next if _class_name($child) ne 'Radio';
Branch: 1 branch
BranchTrueFalseTotal
if _class_name($child) ne "Radio" 0 0 0
991 0 my $child_value = $child->slots->{_value};
992 $child->slots->{_checked} = (
993 0 ▶ defined $value
Branch: 1 branch
BranchTrueFalseTotal
defined $value && defined $child_value && "$child_value" eq "$value" ? : 0 0 0
Condition0%0/6
defined $value and defined $child_value and "$child_value" eq "$value"
!ll&&!rl&&r
000
defined $value and defined $child_value
!ll&&!rl&&r
000
MC/DC0%0/3
defined $value and defined $child_value and "$child_value" eq "$value"
defined $value defined $child_value "$child_value" eq "$value"
Truth table0%0/4
A and B and C
A= defined $valueB= defined $child_valueC= "$child_value" eq "$value"
ABCresult
0XX0
10X0
1100
1111
994 and defined $child_value
995 and "$child_value" eq "$value"
996 ) ? 1 : 0;
997 0 _refresh_native($child);
998 }
999 0 return;
1000 }
1001  
1002 0 ▶sub _set_radio_checked {
Subroutine _set_radio_checked: not called CC=6 SCAR=37.4
1003 0 my ( $radio, $checked ) = @_;
1004  
1005 0 ▶ $radio->slots->{_checked} = $checked ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$checked ? : 0 0 0
1006 0 ▶ return if !$checked;
Branch: 1 branch
BranchTrueFalseTotal
unless $checked 0 0 0
1007  
1008 0 my $group = _nearest_radio_group($radio);
1009 0 ▶ if ($group) {
Branch: 1 branch
BranchTrueFalseTotal
if ($group) 0 0 0
1010 0 _sync_radio_group_value( $group, $radio->slots->{_value} );
1011 0 return;
1012 }
1013  
1014 0 my $group_name = $radio->slots->{_group};
1015 0 ▶ return if !defined $group_name or $group_name eq '';
Branch: 1 branch
BranchTrueFalseTotal
if not defined $group_name or $group_name eq "" 0 0 0
Condition0%0/3
not defined $group_name or $group_name eq ""
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $group_name or $group_name eq ""
not defined $group_name $group_name eq ""
Truth table0%0/3
not(A) or B
A= not defined $group_nameB= $group_name eq ""
ABresult
1X1
011
000
1016  
1017 0 my $root = _find_root($radio);
1018 _walk_widgets(
1019 $root,
1020 0 ▶ sub {
Subroutine __ANON__: not called CC=5 SCAR=34.0
1021 0 my ( $candidate ) = @_;
1022 0 ▶ return if $candidate == $radio;
Branch: 1 branch
BranchTrueFalseTotal
if $candidate == $radio 0 0 0
1023 0 ▶ return if _class_name($candidate) ne 'Radio';
Branch: 1 branch
BranchTrueFalseTotal
if _class_name($candidate) ne "Radio" 0 0 0
1024 0 ▶ return if !defined $candidate->slots->{_group};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $candidate->slots->{"_group"} 0 0 0
1025 0 ▶ return if $candidate->slots->{_group} ne $group_name;
Branch: 1 branch
BranchTrueFalseTotal
if $candidate->slots->{"_group"} ne $group_name 0 0 0
1026 0 $candidate->slots->{_checked} = 0;
1027 0 _refresh_native($candidate);
1028 },
1029 0 );
1030 0 return;
1031 }
1032  
1033 0 ▶sub _nearest_tabs {
Subroutine _nearest_tabs: not called CC=3 SCAR=24.8
1034 0 my ( $tab ) = @_;
1035  
1036 0 my $node = _parent($tab);
1037 0 ▶ while ( defined $node ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $node) 0 0 0
1038 0 ▶ return $node if _class_name($node) eq 'Tabs';
Branch: 1 branch
BranchTrueFalseTotal
if _class_name($node) eq "Tabs" 0 0 0
1039 0 $node = _parent($node);
1040 }
1041  
1042 0 return undef;
1043 }
1044  
1045 0 ▶sub _sync_tabs_selected {
Subroutine _sync_tabs_selected: not called CC=7 SCAR=40.3
1046 0 my ( $tabs, $selected ) = @_;
1047  
1048 0 ▶ $tabs->slots->{_selected} = defined $selected ? "$selected" : undef;
Branch: 1 branch
BranchTrueFalseTotal
defined $selected ? : 0 0 0
1049 0 for my $child ( @{ $tabs->slots->{_children}->items } ) {
1050 0 ▶ next if _class_name($child) ne 'Tab';
Branch: 1 branch
BranchTrueFalseTotal
if _class_name($child) ne "Tab" 0 0 0
1051 0 my $child_value = $child->slots->{_value};
1052 $child->slots->{_selected} = (
1053 0 ▶ defined $selected
Branch: 1 branch
BranchTrueFalseTotal
defined $selected && defined $child_value && "$child_value" eq "$selected" ? : 0 0 0
Condition0%0/6
defined $selected and defined $child_value and "$child_value" eq "$selected"
!ll&&!rl&&r
000
defined $selected and defined $child_value
!ll&&!rl&&r
000
MC/DC0%0/3
defined $selected and defined $child_value and "$child_value" eq "$selected"
defined $selected defined $child_value "$child_value" eq "$selected"
Truth table0%0/4
A and B and C
A= defined $selectedB= defined $child_valueC= "$child_value" eq "$selected"
ABCresult
0XX0
10X0
1100
1111
1054 and defined $child_value
1055 and "$child_value" eq "$selected"
1056 ) ? 1 : 0;
1057 0 _refresh_native($child);
1058 }
1059 0 _refresh_native($tabs);
1060 0 return;
1061 }
1062  
1063 0 ▶sub _set_tab_selected {
Subroutine _set_tab_selected: not called CC=4 SCAR=30.0
1064 0 my ( $tab, $selected ) = @_;
1065  
1066 0 ▶ $tab->slots->{_selected} = $selected ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$selected ? : 0 0 0
1067 0 ▶ return if !$selected;
Branch: 1 branch
BranchTrueFalseTotal
unless $selected 0 0 0
1068  
1069 0 my $tabs = _nearest_tabs($tab);
1070 0 ▶ _sync_tabs_selected( $tabs, $tab->slots->{_value} ) if $tabs;
Branch: 1 branch
BranchTrueFalseTotal
if $tabs 0 0 0
1071 0 return;
1072 }
1073  
1074 0 ▶sub _path_key {
Subroutine _path_key: not called CC=2 SCAR=17.9
1075 0 my ( $path ) = @_;
1076  
1077 0 ▶ return join '/', @{ $path // [] };
Condition0%0/2
$path // []
l!l
00
MC/DC0%0/1
$path // []
$path
Truth table0%0/2
A
A= $path
Aresult
11
00
1078 }
1079  
1080 0 ▶sub _mark_tree_expanded {
Subroutine _mark_tree_expanded: not called CC=4 SCAR=30.0
1081 0 my ( $items, $prefix, $expanded ) = @_;
1082  
1083 0 ▶ for ( my $i = 0; $i < @{ $items->items }; $i++ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < @{$items->items;}) 0 0 0
1084 0 my $item = $items->items->[$i];
1085 0 ▶ my @path = ( @{ $prefix // [] }, $i );
Condition0%0/2
$prefix // []
l!l
00
MC/DC0%0/1
$prefix // []
$prefix
Truth table0%0/2
A
A= $prefix
Aresult
11
00
1086 0 my $children = _tree_children($item);
1087 0 ▶ next if !@{ $children->items };
Branch: 1 branch
BranchTrueFalseTotal
unless @{$children->items;} 0 0 0
1088 0 $expanded->{ _path_key(\@path) } = [@path];
1089 0 _mark_tree_expanded( $children, \@path, $expanded );
1090 }
1091 0 return;
1092 }
1093  
1094 0 ▶sub _item_label {
Subroutine _item_label: not called CC=5 SCAR=34.0
1095 0 my ( $item ) = @_;
1096  
1097 0 ▶ if ( blessed($item) and $item->isa('Zuzu::Value::Dict') ) {
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::blessed($item) and $item->isa("Zuzu::Value::Dict")) 0 0 0
Condition0%0/3
builtin::blessed($item) and $item->isa("Zuzu::Value::Dict")
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::blessed($item) and $item->isa("Zuzu::Value::Dict")
builtin::blessed($item) $item->isa("Zuzu::Value::Dict")
Truth table0%0/3
A and B
A= builtin::blessed($item)B= $item->isa("Zuzu::Value::Dict")
ABresult
0X0
100
111
1098 0 my $label = $item->map->{label};
1099 0 my $value = $item->map->{value};
1100 0 ▶ return defined $label ? "$label" : "$value";
Branch: 1 branch
BranchTrueFalseTotal
defined $label ? : 0 0 0
1101 }
1102  
1103 0 ▶ return defined $item ? "$item" : '';
Branch: 1 branch
BranchTrueFalseTotal
defined $item ? : 0 0 0
1104 }
1105  
1106 0 ▶sub _item_at_index {
Subroutine _item_at_index: not called CC=2 SCAR=17.9
1107 0 my ( $widget, $index ) = @_;
1108  
1109 0 ▶ return undef if !defined $index;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $index 0 0 0
1110 0 return $widget->slots->{_items}->items->[$index];
1111 }
1112  
1113 0 ▶sub _path_indexes {
Subroutine _path_indexes: not called CC=5 SCAR=34.0
1114 0 my ( $path ) = @_;
1115  
1116 0 ▶ return [] if !defined $path;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $path 0 0 0
1117 0 ▶ _runtime_error( 'GUI_PROP_TYPE', 'selected_path expects an Array' )
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($path) and $path->isa("Zuzu::Value::Array") 0 0 0
Condition0%0/3
builtin::blessed($path) and $path->isa("Zuzu::Value::Array")
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::blessed($path) and $path->isa("Zuzu::Value::Array")
builtin::blessed($path) $path->isa("Zuzu::Value::Array")
Truth table0%0/3
A and B
A= builtin::blessed($path)B= $path->isa("Zuzu::Value::Array")
ABresult
0X0
100
111
1118 if !blessed($path) or !$path->isa('Zuzu::Value::Array');
1119 0 ▶ return [ map { 0 + ( $_ // 0 ) } @{ $path->items } ];
Condition0%0/2
$_ // 0
l!l
00
MC/DC0%0/1
$_ // 0
$_
Truth table0%0/2
A
A= $_
Aresult
11
00
1120 }
1121  
1122 0 ▶sub _tree_children {
Subroutine _tree_children: not called CC=5 SCAR=34.0
1123 0 my ( $item ) = @_;
1124  
1125 0 ▶ return _zarray() if !blessed($item) or !$item->isa('Zuzu::Value::Dict');
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($item) and $item->isa("Zuzu::Value::Dict") 0 0 0
Condition0%0/3
builtin::blessed($item) and $item->isa("Zuzu::Value::Dict")
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::blessed($item) and $item->isa("Zuzu::Value::Dict")
builtin::blessed($item) $item->isa("Zuzu::Value::Dict")
Truth table0%0/3
A and B
A= builtin::blessed($item)B= $item->isa("Zuzu::Value::Dict")
ABresult
0X0
100
111
1126 0 my $children = $item->map->{children};
1127 0 ▶ return $children
Branch: 1 branch
BranchTrueFalseTotal
if builtin::blessed($children) and $children->isa("Zuzu::Value::Array") 0 0 0
Condition0%0/3
builtin::blessed($children) and $children->isa("Zuzu::Value::Array")
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::blessed($children) and $children->isa("Zuzu::Value::Array")
builtin::blessed($children) $children->isa("Zuzu::Value::Array")
Truth table0%0/3
A and B
A= builtin::blessed($children)B= $children->isa("Zuzu::Value::Array")
ABresult
0X0
100
111
1128 if blessed($children) and $children->isa('Zuzu::Value::Array');
1129 0 return _zarray();
1130 }
1131  
1132 0 ▶sub _tree_item_at_path {
Subroutine _tree_item_at_path: not called CC=5 SCAR=34.0
1133 0 my ( $tree, $path ) = @_;
1134  
1135 0 my $items = $tree->slots->{_items};
1136 0 my $item;
1137 0 ▶ for my $index ( @{ $path // [] } ) {
Condition0%0/2
$path // []
l!l
00
MC/DC0%0/1
$path // []
$path
Truth table0%0/2
A
A= $path
Aresult
11
00
1138 0 ▶ return undef if $index < 0 or $index >= @{ $items->items };
Branch: 1 branch
BranchTrueFalseTotal
if $index < 0 or $index >= @{$items->items;} 0 0 0
Condition0%0/3
$index < 0 or $index >= @{$items->items;}
l!l&&r!l&&!r
000
MC/DC0%0/2
$index < 0 or $index >= @{$items->items;}
$index < 0 $index >= @{$items->items;}
Truth table0%0/3
A or B
A= $index < 0B= $index >= @{$items->items;}
ABresult
1X1
011
000
1139 0 $item = $items->items->[$index];
1140 0 $items = _tree_children($item);
1141 }
1142  
1143 0 return $item;
1144 }
1145  
1146 0 ▶sub _flatten_tree_items {
Subroutine _flatten_tree_items: not called CC=5 SCAR=34.0
1147 0 my ( $items, $depth, $prefix, $labels, $paths, $expanded ) = @_;
1148  
1149 0 ▶ for ( my $i = 0; $i < @{ $items->items }; $i++ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < @{$items->items;}) 0 0 0
1150 0 my $item = $items->items->[$i];
1151 0 ▶ my @path = ( @{ $prefix // [] }, $i );
Condition0%0/2
$prefix // []
l!l
00
MC/DC0%0/1
$prefix // []
$prefix
Truth table0%0/2
A
A= $prefix
Aresult
11
00
1152 0 my $key = _path_key(\@path);
1153 0 push @{ $paths }, \@path;
1154 0 push @{ $labels }, ( ' ' x $depth ) . _item_label($item);
1155 0 ▶ next if defined $expanded and !exists $expanded->{$key};
Branch: 1 branch
BranchTrueFalseTotal
if defined $expanded and not exists $expanded->{$key} 0 0 0
Condition0%0/3
defined $expanded and not exists $expanded->{$key}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $expanded and not exists $expanded->{$key}
defined $expanded not exists $expanded->{$key}
Truth table0%0/3
A and not(B)
A= defined $expandedB= not exists $expanded->{$key}
ABresult
0X0
100
111
1156 0 _flatten_tree_items(
1157 _tree_children($item),
1158 $depth + 1,
1159 \@path,
1160 $labels,
1161 $paths,
1162 $expanded,
1163 );
1164 }
1165 0 return;
1166 }
1167  
1168 3 my $PRIMA_READY = 0;
1169 3 my $PRIMA_FONT;
1170  
1171 0 ▶sub _prima_std_bitmap_warning {
Subroutine _prima_std_bitmap_warning: not called CC=3 SCAR=24.8
1172 0 my ( $message ) = @_;
1173  
1174 return (
1175 0 ▶ $message =~ /\AFailed to load standard bitmap '.*?sysimage\.gif':/
Branch: 1 branch
BranchTrueFalseTotal
$message =~ /\AFailed to load standard bitmap '.*?sysimage\.gif':/ && $message =~ /Did you compile Prima with GIF support\?/ ? : 0 0 0
Condition0%0/3
$message =~ /\AFailed to load standard bitmap '.*?sysimage\.gif':/ and $message =~ /Did you compile Prima with GIF support\?/
!ll&&!rl&&r
000
MC/DC0%0/2
$message =~ /\AFailed to load standard bitmap '.*?sysimage\.gif':/ and $message =~ /Did you compile Prima with GIF support\?/
$message =~ /\AFailed to load standard bitmap '.*?sysimage\.gif':/ $message =~ /Did you compile Prima with GIF support\?/
Truth table0%0/3
A and B
A= $message =~ /\AFailed to load standard bitmap '.*?sysimage\.gif':/B= $message =~ /Did you compile Prima with GIF support\?/
ABresult
0X0
100
111
1176 and $message =~ /Did you compile Prima with GIF support\?/
1177 ) ? 1 : 0;
1178 }
1179  
1180 2 ▶sub _without_prima_bitmap_warning {
Subroutine _without_prima_bitmap_warning: called CC=3 SCAR=16.4
1181 2 my ( $code ) = @_;
1182  
1183 2 my $previous = $SIG{__WARN__};
1184 0 ▶ local $SIG{__WARN__} = sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
1185 0 my $message = join '', @_;
1186 0 ▶ return if _prima_std_bitmap_warning($message);
Branch: 1 branch
BranchTrueFalseTotal
if _prima_std_bitmap_warning($message) 0 0 0
1187 0 ▶ return $previous->(@_) if $previous;
Branch: 1 branch
BranchTrueFalseTotal
if $previous 0 0 0
1188 0 CORE::warn(@_);
1189 2 };
1190  
1191 2 ▶ if ( wantarray ) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) 0 2 2
1192 0 return $code->();
1193 }
1194 2 ▶ if ( defined wantarray ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined wantarray) 2 0 2
1195 2 return scalar $code->();
1196 }
1197 0 $code->();
1198 0 return;
1199 }
1200  
1201 4 ▶sub _prima_application_ready {
Subroutine _prima_application_ready: called CC=4 SCAR=14.2
1202 4 ▶ return 0 if !defined $::application or !ref($::application);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $main::application and ref $main::application 1 3 4
Condition66%2/3
defined $main::application and ref $main::application
!ll&&!rl&&r
103
MC/DC50%1/2
defined $main::application and ref $main::application
defined $main::application ref $main::application
Truth table66%2/3
A and B
A= defined $main::applicationB= ref $main::application
ABresult
0X0
100
111
1203 3 ▶ return eval { $::application->alive } ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
eval { do { $main::application->alive } } ? : 3 0 3
1204 }
1205  
1206 2 ▶sub _ensure_prima_application {
Subroutine _ensure_prima_application: called CC=4 SCAR=15.2
1207 2 ▶ return 1 if _prima_application_ready();
Branch: 1 branch
BranchTrueFalseTotal
if _prima_application_ready() 1 1 2
1208  
1209 _without_prima_bitmap_warning(
1210 1 ▶ sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
1211 1 eval {
1212 1 undef $::application;
1213 1 $::application = Prima::Application->create(
1214 name => 'Zuzu',
1215 );
1216 1 1;
1217 };
1218 }
1219 1 ▶ ) or do {
Branch: 1 branch
BranchTrueFalseTotal
_without_prima_bitmap_warning(sub { eval { do { undef $main::application; $main::application = "Prima::Application"->create("name", "Zuzu"); 1 } }; } ) or do { my $error = $@ || "unknown Prima application error"; _runtime_error("GUI_BACKEND", "Could not initialize Prima application: $error") } 1 0 1
1220 0 ▶ my $error = $@ || 'unknown Prima application error';
Condition0%0/2
$@ || 'unknown Prima application error'
l!l
00
MC/DC0%0/1
$@ || 'unknown Prima application error'
$@
Truth table0%0/2
A
A= $@
Aresult
11
00
1221 0 _runtime_error(
1222 'GUI_BACKEND',
1223 "Could not initialize Prima application: $error",
1224 );
1225 };
1226  
1227 1 return 1;
1228 }
1229  
1230 2 ▶sub _load_prima_backend {
Subroutine _load_prima_backend: called CC=4 SCAR=14.8
1231 2 ▶ return _ensure_prima_application() if $PRIMA_READY;
Branch: 1 branch
BranchTrueFalseTotal
if $PRIMA_READY 1 1 2
1232  
1233 _without_prima_bitmap_warning(
1234 1 ▶ sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
1235 1 ▶ eval q{
Subroutine BEGIN: called CC=1 SCAR=0.0
1236 use Prima qw(
1237 Application
1238 Buttons
1239 ComboBox
1240 Drawable::Markup
1241 Edit
1242 InputLine
1243 Label
1244 Lists
1245 Menus
1246 Outlines
1247 Dialog::FileDialog
1248 Sliders
1249 Widget::Date
1250 );
1251 1;
1252 };
1253 }
1254 1 ▶ ) or do {
Branch: 1 branch
BranchTrueFalseTotal
_without_prima_bitmap_warning(sub { eval "\n\t\t\t\tuse Prima qw(\n\t\t\t\t\tApplication\n\t\t\t\t\tButtons\n\t\t\t\t\tComboBox\n\t\t\t\t\tDrawable::Markup\n\t\t\t\t\tEdit\n\t\t\t\t\tInputLine\n\t\t\t\t\tLabel\n\t\t\t\t\tLists\n\t\t\t\t\tMenus\n\t\t\t\t\tOutlines\n\t\t\t\t\tDialog::FileDialog\n\t\t\t\t\tSliders\n\t\t\t\t\tWidget::Date\n\t\t\t\t);\n\t\t\t\t1;\n\t\t\t"; } ) or do { my $error = $@ || "unknown Prima load error"; _runtime_error("GUI_BACKEND", "Could not initialize Prima GUI backend: $error") } 1 0 1
1255 0 ▶ my $error = $@ || 'unknown Prima load error';
Condition0%0/2
$@ || 'unknown Prima load error'
l!l
00
MC/DC0%0/1
$@ || 'unknown Prima load error'
$@
Truth table0%0/2
A
A= $@
Aresult
11
00
1256 0 _runtime_error(
1257 'GUI_BACKEND',
1258 "Could not initialize Prima GUI backend: $error",
1259 );
1260 };
1261  
1262 1 $PRIMA_READY = 1;
1263 1 _ensure_prima_application();
1264 1 return 1;
1265 }
1266  
1267 0 ▶sub _dialog_props {
Subroutine _dialog_props: not called CC=5 SCAR=34.0
1268 0 my ( $value ) = @_;
1269  
1270 0 ▶ return {} if !defined $value;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 0 0 0
1271 0 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::blessed($value) and $value->isa("Zuzu::Value::PairList") || $value->isa("Zuzu::Value::Dict")) 0 0 0
Condition0%0/6
builtin::blessed($value) and $value->isa("Zuzu::Value::PairList") || $value->isa("Zuzu::Value::Dict")
!ll&&!rl&&r
000
$value->isa("Zuzu::Value::PairList") or $value->isa("Zuzu::Value::Dict")
l!l&&r!l&&!r
000
MC/DC0%0/3
builtin::blessed($value) and $value->isa("Zuzu::Value::PairList") || $value->isa("Zuzu::Value::Dict")
builtin::blessed($value) $value->isa("Zuzu::Value::PairList") $value->isa("Zuzu::Value::Dict")
Truth table0%0/4
A and B or C
A= builtin::blessed($value)B= $value->isa("Zuzu::Value::PairList")C= $value->isa("Zuzu::Value::Dict")
ABCresult
0XX0
1000
11X1
1011
1272 blessed($value)
1273 and (
1274 $value->isa('Zuzu::Value::PairList')
1275 or $value->isa('Zuzu::Value::Dict')
1276 )
1277 ) {
1278 0 return zuzu_to_perl($value);
1279 }
1280 0 return {};
1281 }
1282  
1283 0 ▶sub _dialog_bool {
Subroutine _dialog_bool: not called CC=3 SCAR=24.8
1284 0 my ( $props, $key, $default ) = @_;
1285  
1286 0 ▶ return $default if !exists $props->{$key};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $props->{$key} 0 0 0
1287 0 ▶ return $props->{$key} ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$props->{$key} ? : 0 0 0
1288 }
1289  
1290 0 ▶sub _dialog_string {
Subroutine _dialog_string: not called CC=3 SCAR=24.8
1291 0 my ( $props, $key, $default ) = @_;
1292  
1293 0 ▶ return $default if !exists $props->{$key};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $props->{$key} 0 0 0
1294 0 ▶ return undef if !defined $props->{$key};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $props->{$key} 0 0 0
1295 0 return "$props->{$key}";
1296 }
1297  
1298 0 ▶sub _dialog_filter {
Subroutine _dialog_filter: not called CC=13 SCAR=52.0
1299 0 my ( $props ) = @_;
1300  
1301 0 ▶ return [[ 'All files' => '*' ]] if !exists $props->{filter};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $props->{"filter"} 0 0 0
1302 0 my $filter = $props->{filter};
1303 0 ▶ return [[ 'All files' => '*' ]] if ref($filter) ne 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
if ref $filter ne "ARRAY" 0 0 0
1304  
1305 0 my @out;
1306 0 for my $entry (@$filter) {
1307 0 ▶ if ( ref($entry) eq 'ARRAY' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $entry eq "ARRAY") 0 0 0
1308 0 my ( $label, $mask ) = @$entry;
1309 0 ▶ push @out, [ defined $label ? "$label" : '', defined $mask ? "$mask" : '*' ];
Branch: 2 branches
BranchTrueFalseTotal
defined $label ? : 0 0 0
defined $mask ? : 0 0 0
1310 0 next;
1311 }
1312 0 ▶ if ( ref($entry) eq 'HASH' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $entry eq "HASH") 0 0 0
1313 0 ▶ my $label = $entry->{label} // $entry->{name} // '';
Condition0%0/5
($entry->{"label"} // $entry->{"name"}) // ""
l!l
00
$entry->{"label"} // $entry->{"name"}
l!l&&r!l&&!r
000
MC/DC0%0/2
($entry->{"label"} // $entry->{"name"}) // ""
$entry->{"label"} $entry->{"name"}
Truth table0%0/3
A // B
A= $entry->{"label"}B= $entry->{"name"}
ABresult
1X1
011
000
1314 0 ▶ my $mask = $entry->{mask} // $entry->{pattern} // '*';
Condition0%0/5
($entry->{"mask"} // $entry->{"pattern"}) // "*"
l!l
00
$entry->{"mask"} // $entry->{"pattern"}
l!l&&r!l&&!r
000
MC/DC0%0/2
($entry->{"mask"} // $entry->{"pattern"}) // "*"
$entry->{"mask"} $entry->{"pattern"}
Truth table0%0/3
A // B
A= $entry->{"mask"}B= $entry->{"pattern"}
ABresult
1X1
011
000
1315 0 push @out, [ "$label", "$mask" ];
1316 }
1317 }
1318  
1319 0 ▶ return @out ? \@out : [[ 'All files' => '*' ]];
Branch: 1 branch
BranchTrueFalseTotal
@out ? : 0 0 0
1320 }
1321  
1322 0 ▶sub _native_file_dialog_profile {
Subroutine _native_file_dialog_profile: not called CC=6 SCAR=37.4
1323 0 my ( $props, $kind ) = @_;
1324  
1325 0 ▶ my $title = _dialog_string(
Branch: 1 branch
BranchTrueFalseTotal
$kind eq 'save' ? : 0 0 0
1326 $props,
1327 'title',
1328 $kind eq 'save' ? 'Save File' : 'Open File',
1329 );
1330 0 my %profile = (
1331 system => _dialog_bool( $props, 'system', 0 ),
1332 text => $title,
1333 fileName => _dialog_string( $props, 'value', '' ),
1334 filter => _dialog_filter($props),
1335 showDotFiles => _dialog_bool(
1336 $props,
1337 'show_dot_files',
1338 _dialog_bool( $props, 'show_hidden', 0 ),
1339 ),
1340 );
1341 0 ▶ $profile{directory} = "$props->{directory}" if defined $props->{directory};
Branch: 1 branch
BranchTrueFalseTotal
if defined $props->{"directory"} 0 0 0
1342 0 ▶ $profile{defaultExt} = "$props->{default_ext}" if defined $props->{default_ext};
Branch: 1 branch
BranchTrueFalseTotal
if defined $props->{"default_ext"} 0 0 0
1343 0 $profile{pathMustExist} = _dialog_bool( $props, 'path_must_exist', 1 );
1344  
1345 0 ▶ if ( $kind eq 'open' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($kind eq 'open') { } 0 0 0
1346 0 $profile{multiSelect} = _dialog_bool( $props, 'multiple', 0 );
1347 0 $profile{fileMustExist} = _dialog_bool( $props, 'file_must_exist', 1 );
1348 0 $profile{createPrompt} = _dialog_bool( $props, 'create_prompt', 0 );
1349 }
1350 else {
1351 0 $profile{fileMustExist} = _dialog_bool( $props, 'file_must_exist', 0 );
1352 0 $profile{overwritePrompt} = _dialog_bool( $props, 'overwrite_prompt', 1 );
1353 0 $profile{noTestFileCreate} = _dialog_bool( $props, 'no_test_file_create', 0 );
1354 }
1355 0 ▶ $profile{font} = _prima_font() if !$profile{system};
Branch: 1 branch
BranchTrueFalseTotal
unless $profile{"system"} 0 0 0
1356  
1357 0 return %profile;
1358 }
1359  
1360 0 ▶sub _apply_prima_font {
Subroutine _apply_prima_font: not called CC=10 SCAR=47.0
1361 0 my ( $object, $seen ) = @_;
1362  
1363 0 ▶ return if !defined $object or !ref($object);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $object and ref $object 0 0 0
Condition0%0/3
defined $object and ref $object
!ll&&!rl&&r
000
MC/DC0%0/2
defined $object and ref $object
defined $object ref $object
Truth table0%0/3
A and B
A= defined $objectB= ref $object
ABresult
0X0
100
111
1364 0 ▶ $seen //= {};
Condition0%0/2
$seen //= {}
l!l
00
MC/DC0%0/1
$seen //= {}
$seen
Truth table0%0/2
A
A= $seen
Aresult
11
00
1365 0 ▶ my $id = refaddr($object) // 0;
Condition0%0/2
builtin::refaddr($object) // 0
l!l
00
MC/DC0%0/1
builtin::refaddr($object) // 0
builtin::refaddr($object)
Truth table0%0/2
A
A= builtin::refaddr($object)
Aresult
11
00
1366 0 ▶ return if $id and $seen->{$id}++;
Branch: 1 branch
BranchTrueFalseTotal
if $id and $seen->{$id}++ 0 0 0
Condition0%0/3
$id and $seen->{$id}++
!ll&&!rl&&r
000
MC/DC0%0/2
$id and $seen->{$id}++
$id $seen->{$id}++
Truth table0%0/3
A and B
A= $idB= $seen->{$id}++
ABresult
0X0
100
111
1367  
1368 0 my $font = _prima_font();
1369 0 ▶ eval { $object->font($font) if $object->can('font'); 1 };
Branch: 1 branch
BranchTrueFalseTotal
if $object->can("font") 0 0 0
1370  
1371 0 ▶ if ( $object->can('get_widgets') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($object->can("get_widgets")) 0 0 0
1372 0 for my $child ( eval { $object->get_widgets } ) {
1373 0 _apply_prima_font( $child, $seen );
1374 }
1375 }
1376 0 return $object;
1377 }
1378  
1379 0 ▶sub _native_file_open {
Subroutine _native_file_open: not called CC=4 SCAR=30.0
1380 0 my ( $props_value ) = @_;
1381  
1382 0 my $props = _dialog_props($props_value);
1383 0 _load_prima_backend();
1384 0 my %profile = _native_file_dialog_profile( $props, 'open' );
1385 my $dialog = _without_prima_bitmap_warning(
1386 0 ▶ sub { Prima::Dialog::OpenDialog->new(%profile) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
1387 0 );
1388 0 _apply_prima_font($dialog);
1389 0 ▶ if ( $profile{multiSelect} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($profile{"multiSelect"}) 0 0 0
1390 0 ▶ my @files = _without_prima_bitmap_warning( sub { $dialog->execute } );
Subroutine __ANON__: not called CC=1 SCAR=6.9
1391 0 ▶ return @files ? perl_to_zuzu( \@files ) : undef;
Branch: 1 branch
BranchTrueFalseTotal
@files ? : 0 0 0
1392 }
1393 0 ▶ my $file = _without_prima_bitmap_warning( sub { $dialog->execute } );
Subroutine __ANON__: not called CC=1 SCAR=6.9
1394 0 ▶ return defined $file ? "$file" : undef;
Branch: 1 branch
BranchTrueFalseTotal
defined $file ? : 0 0 0
1395 }
1396  
1397 0 ▶sub _native_file_save {
Subroutine _native_file_save: not called CC=2 SCAR=17.9
1398 0 my ( $props_value ) = @_;
1399  
1400 0 my $props = _dialog_props($props_value);
1401 0 _load_prima_backend();
1402 0 my %profile = _native_file_dialog_profile( $props, 'save' );
1403 my $dialog = _without_prima_bitmap_warning(
1404 0 ▶ sub { Prima::Dialog::SaveDialog->new(%profile) }
Subroutine __ANON__: not called CC=1 SCAR=6.9
1405 0 );
1406 0 _apply_prima_font($dialog);
1407 0 ▶ my $file = _without_prima_bitmap_warning( sub { $dialog->execute } );
Subroutine __ANON__: not called CC=1 SCAR=6.9
1408 0 ▶ return defined $file ? "$file" : undef;
Branch: 1 branch
BranchTrueFalseTotal
defined $file ? : 0 0 0
1409 }
1410  
1411 0 ▶sub _native_directory_open {
Subroutine _native_directory_open: not called CC=2 SCAR=17.9
1412 0 my ( $props_value ) = @_;
1413  
1414 0 my $props = _dialog_props($props_value);
1415 0 _load_prima_backend();
1416 my $dialog = _without_prima_bitmap_warning(
1417 0 ▶ sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
1418 0 Prima::Dialog::ChDirDialog->new(
1419 font => _prima_font(),
1420 text => _dialog_string( $props, 'title', 'Open Directory' ),
1421 directory => _dialog_string( $props, 'value', '.' ),
1422 showDotDirs => _dialog_bool(
1423 $props,
1424 'show_dot_dirs',
1425 _dialog_bool( $props, 'show_hidden', 0 ),
1426 ),
1427 );
1428 }
1429 0 );
1430 0 _apply_prima_font($dialog);
1431 my $accepted = _without_prima_bitmap_warning(
1432 0 ▶ sub { $dialog->execute != mb::Cancel }
Subroutine __ANON__: not called CC=1 SCAR=6.9
1433 0 );
1434 0 ▶ return $accepted ? $dialog->directory : undef;
Branch: 1 branch
BranchTrueFalseTotal
$accepted ? : 0 0 0
1435 }
1436  
1437 0 ▶sub _native_colour_picker {
Subroutine _native_colour_picker: not called CC=1 SCAR=6.9
1438 0 my ( $props_value ) = @_;
1439  
1440 # std/gui/dialogue already provides a validated pure-widget colour
1441 # picker. Keep the Perl native hook as an unsupported backend hook so
1442 # callers can fall back without changing the shared API.
1443 0 return undef;
1444 }
1445  
1446 0 ▶sub _native_alert {
Subroutine _native_alert: not called CC=1 SCAR=6.9
1447 0 return 0;
1448 }
1449  
1450 0 ▶sub _native_confirm {
Subroutine _native_confirm: not called CC=1 SCAR=6.9
1451 0 return undef;
1452 }
1453  
1454 0 ▶sub _native_prompt {
Subroutine _native_prompt: not called CC=1 SCAR=6.9
1455 0 return undef;
1456 }
1457  
1458 0 ▶sub _native_directory_save {
Subroutine _native_directory_save: not called CC=1 SCAR=6.9
1459 0 my ( $props_value ) = @_;
1460  
1461 # Prima's available native directory dialog is an existing-directory
1462 # chooser. Return undef so std/gui/dialogue can use its save-directory
1463 # fallback on this backend.
1464 0 return undef;
1465 }
1466  
1467 9 ▶sub _prima_font {
Subroutine _prima_font: called CC=7 SCAR=23.7
1468 9 ▶ return { %{ $PRIMA_FONT } } if defined $PRIMA_FONT;
Branch: 1 branch
BranchTrueFalseTotal
if defined $PRIMA_FONT 6 3 9
1469  
1470 3 my @preferred = (
1471 'DejaVu Sans',
1472 'Liberation Sans',
1473 'FreeSans',
1474 'Helvetica',
1475 'helvetica',
1476 'fixed',
1477 );
1478 3 my %available;
1479 3 eval {
1480 3 for my $font ( @{ $::application->fonts( '', 'iso8859-1' ) } ) {
1481 0 ▶ my $name = $font->{name} // '';
Condition0%0/2
$font->{"name"} // ""
l!l
00
MC/DC0%0/1
$font->{"name"} // ""
$font->{"name"}
Truth table0%0/2
A
A= $font->{"name"}
Aresult
11
00
1482 0 ▶ $available{ lc $name } = $name if $name ne '';
Branch: 1 branch
BranchTrueFalseTotal
if $name ne "" 0 0 0
1483 }
1484 0 1;
1485 };
1486  
1487 3 for my $name (@preferred) {
1488 18 ▶ next if !exists $available{ lc $name };
Branch: 1 branch
BranchTrueFalseTotal
unless exists $available{lc $name} 18 0 18
1489 $PRIMA_FONT = {
1490 0 name => $available{ lc $name },
1491 size => 10,
1492 encoding => 'iso8859-1',
1493 };
1494 0 return { %{ $PRIMA_FONT } };
1495 }
1496  
1497 $PRIMA_FONT = {
1498 3 name => 'DejaVu Sans',
1499 size => 10,
1500 encoding => 'iso8859-1',
1501 };
1502 3 return { %{ $PRIMA_FONT } };
1503 }
1504  
1505 7 ▶sub _prima_font_size_pixels {
Subroutine _prima_font_size_pixels: called CC=4 SCAR=17.3
1506 7 my ( $font ) = @_;
1507  
1508 7 my $height = eval {
1509 7 ▶ if ($PRIMA_READY) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PRIMA_READY) { } 0 7 7
1510 0 my $probe = Prima::Widget->new( font => $font );
1511 0 my $metrics = $probe->font;
1512 0 $probe->destroy;
1513 0 $metrics->{height};
1514 }
1515 else {
1516 7 undef;
1517 }
1518 };
1519  
1520 7 ▶ return 0 + $height if defined $height and $height =~ /^\d+$/;
Branch: 1 branch
BranchTrueFalseTotal
if defined $height and $height =~ /^\d+$/ 0 7 7
Condition33%1/3
defined $height and $height =~ /^\d+$/
!ll&&!rl&&r
700
MC/DC0%0/2
defined $height and $height =~ /^\d+$/
defined $height $height =~ /^\d+$/
Truth table33%1/3
A and B
A= defined $heightB= $height =~ /^\d+$/
ABresult
0X0
100
111
1521 7 return 16;
1522 }
1523  
1524 0 ▶sub _prima_groupbox_content_pady {
Subroutine _prima_groupbox_content_pady: not called CC=1 SCAR=6.9
1525 0 my $height = _prima_font_size_pixels( _prima_font() );
1526 0 return int( $height * 1.5 ) + 6;
1527 }
1528  
1529 7 ▶sub _backend_meta {
Subroutine _backend_meta: called CC=1 SCAR=0.0
1530 7 my $font = _prima_font();
1531  
1532 return _zdict(
1533 backend => 'Prima',
1534 font_size_pixels => _prima_font_size_pixels($font),
1535 font_name => $font->{name},
1536 font_point_size => $font->{size},
1537 7 );
1538 }
1539  
1540 6 ▶sub _has_native {
Subroutine _has_native: called CC=6 SCAR=19.9
1541 6 my ( $widget ) = @_;
1542  
1543 6 my $native = $widget->slots->{_native};
1544 6 ▶ return 0 if !defined $native or !ref($native);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $native and ref $native 4 2 6
Condition66%2/3
defined $native and ref $native
!ll&&!rl&&r
402
MC/DC50%1/2
defined $native and ref $native
defined $native ref $native
Truth table66%2/3
A and B
A= defined $nativeB= ref $native
ABresult
0X0
100
111
1545 2 ▶ return eval { $native->alive } ? 1 : 0
Branch: 2 branches
BranchTrueFalseTotal
if builtin::blessed($native) and $native->can("alive") 2 0 2
eval { do { $native->alive } } ? : 2 0 2
Condition33%1/3
builtin::blessed($native) and $native->can("alive")
!ll&&!rl&&r
002
MC/DC0%0/2
builtin::blessed($native) and $native->can("alive")
builtin::blessed($native) $native->can("alive")
Truth table33%1/3
A and B
A= builtin::blessed($native)B= $native->can("alive")
ABresult
0X0
100
111
1546 if blessed($native) and $native->can('alive');
1547 0 return 1;
1548 }
1549  
1550 0 ▶sub _native_text {
Subroutine _native_text: not called CC=13 SCAR=52.0
1551 0 my ( $widget ) = @_;
1552  
1553 0 ▶ my $kind = $widget->slots->{_widget_type} // '';
Condition0%0/2
$widget->slots->{"_widget_type"} // ""
l!l
00
MC/DC0%0/1
$widget->slots->{"_widget_type"} // ""
$widget->slots->{"_widget_type"}
Truth table0%0/2
A
A= $widget->slots->{"_widget_type"}
Aresult
11
00
1554 0 ▶ return $widget->slots->{_title} if $kind eq 'Window';
Branch: 1 branch
BranchTrueFalseTotal
if $kind eq "Window" 0 0 0
1555 0 ▶ return $widget->slots->{_label} if $kind eq 'Frame';
Branch: 1 branch
BranchTrueFalseTotal
if $kind eq "Frame" 0 0 0
1556 0 ▶ return $widget->slots->{_text} if $kind eq 'Label';
Branch: 1 branch
BranchTrueFalseTotal
if $kind eq "Label" 0 0 0
1557 0 ▶ return $widget->slots->{_value} if $kind eq 'Text';
Branch: 1 branch
BranchTrueFalseTotal
if $kind eq "Text" 0 0 0
1558 0 ▶ return $widget->slots->{_value} if $kind eq 'RichText';
Branch: 1 branch
BranchTrueFalseTotal
if $kind eq "RichText" 0 0 0
1559 0 ▶ return $widget->slots->{_value} if $kind eq 'Input';
Branch: 1 branch
BranchTrueFalseTotal
if $kind eq "Input" 0 0 0
1560 0 ▶ return $widget->slots->{_value} if $kind eq 'DatePicker';
Branch: 1 branch
BranchTrueFalseTotal
if $kind eq "DatePicker" 0 0 0
1561 0 ▶ return $widget->slots->{_label} if $kind eq 'Checkbox';
Branch: 1 branch
BranchTrueFalseTotal
if $kind eq "Checkbox" 0 0 0
1562 0 ▶ return $widget->slots->{_label} if $kind eq 'Radio';
Branch: 1 branch
BranchTrueFalseTotal
if $kind eq "Radio" 0 0 0
1563 0 ▶ return $widget->slots->{_text} if $kind eq 'Button';
Branch: 1 branch
BranchTrueFalseTotal
if $kind eq "Button" 0 0 0
1564 0 ▶ return $widget->slots->{_title} if $kind eq 'Tab';
Branch: 1 branch
BranchTrueFalseTotal
if $kind eq "Tab" 0 0 0
1565 0 return '';
1566 }
1567  
1568 0 ▶sub _decode_html_entities {
Subroutine _decode_html_entities: not called CC=9 SCAR=45.0
1569 0 my ( $text ) = @_;
1570  
1571 0 ▶ $text //= '';
Condition0%0/2
$text //= ""
l!l
00
MC/DC0%0/1
$text //= ""
$text
Truth table0%0/2
A
A= $text
Aresult
11
00
1572 0 $text =~ s{&(#x[0-9a-fA-F]+|#[0-9]+|amp|lt|gt|quot|apos);}{do {
1573 0 my $entity = $1;
1574 0 ▶ if ( $entity =~ /^#x([0-9a-fA-F]+)$/ ) {
Branch: 7 branches
BranchTrueFalseTotal
if ($entity =~ /^#x([0-9a-fA-F]+)$/) { } 0 0 0
elsif ($entity =~ /^#([0-9]+)$/) { } 0 0 0
elsif ($entity eq 'amp') { } 0 0 0
elsif ($entity eq 'lt') { } 0 0 0
elsif ($entity eq 'gt') { } 0 0 0
elsif ($entity eq 'quot') { } 0 0 0
elsif ($entity eq 'apos') { } 0 0 0
1575 0 chr(hex($1));
1576 }
1577 elsif ( $entity =~ /^#([0-9]+)$/ ) {
1578 0 chr($1);
1579 }
1580 0 elsif ( $entity eq 'amp' ) { '&' }
1581 0 elsif ( $entity eq 'lt' ) { '<' }
1582 0 elsif ( $entity eq 'gt' ) { '>' }
1583 0 elsif ( $entity eq 'quot' ) { '"' }
1584 0 elsif ( $entity eq 'apos' ) { "'" }
1585 0 else { "&$entity;" }
1586 }}eg;
1587  
1588 0 return $text;
1589 }
1590  
1591 0 ▶sub _prima_markup_quote {
Subroutine _prima_markup_quote: not called CC=4 SCAR=30.0
1592 0 my ( $text ) = @_;
1593  
1594 0 ▶ return '' if !defined $text or $text eq '';
Branch: 1 branch
BranchTrueFalseTotal
if not defined $text or $text eq "" 0 0 0
Condition0%0/3
not defined $text or $text eq ""
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $text or $text eq ""
not defined $text $text eq ""
Truth table0%0/3
not(A) or B
A= not defined $textB= $text eq ""
ABresult
1X1
011
000
1595  
1596 0 my $depth = 2;
1597 0 my $close = '>' x $depth;
1598 0 ▶ while ( $text =~ /\s\Q$close\E/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($text =~ /\s\Q$close\E/) 0 0 0
1599 0 $depth++;
1600 0 $close = '>' x $depth;
1601 }
1602  
1603 0 return 'Q<' . ( '<' x ( $depth - 1 ) ) . ' ' . $text . ' '
1604 . $close;
1605 }
1606  
1607 0 ▶sub _prima_markup_url {
Subroutine _prima_markup_url: not called CC=1 SCAR=6.9
1608 0 my ( $url ) = @_;
1609  
1610 0 $url = _decode_html_entities($url);
1611 0 $url =~ s/%/%25/g;
1612 0 $url =~ s/\|/%7C/g;
1613 0 $url =~ s/</%3C/g;
1614 0 $url =~ s/>/%3E/g;
1615 0 $url =~ s/\s/%20/g;
1616 0 return $url;
1617 }
1618  
1619 0 ▶sub _rich_text_html_to_prima_markup {
Subroutine _rich_text_html_to_prima_markup: not called CC=20 SCAR=60.4
1620 0 my ( $html ) = @_;
1621  
1622 0 ▶ $html //= '';
Condition0%0/2
$html //= ""
l!l
00
MC/DC0%0/1
$html //= ""
$html
Truth table0%0/2
A
A= $html
Aresult
11
00
1623 0 my $out = '';
1624 0 my @stack;
1625 0 my $last = 0;
1626  
1627 0 ▶ while ( $html =~ m{(<[^>]*>)}g ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($html =~ /(<[^>]*>)/g) 0 0 0
1628 0 my $tag = $1;
1629 0 my $text = substr( $html, $last, $-[0] - $last );
1630 0 $last = $+[0];
1631  
1632 0 $out .= _prima_markup_quote( _decode_html_entities($text) );
1633  
1634 0 ▶ if ( $tag =~ m{^<\s*(/)?\s*([A-Za-z][A-Za-z0-9]*)\b([^>]*)>$}s ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($tag =~ m[^<\s*(/)?\s*([A-Za-z][A-Za-z0-9]*)\b([^>]*)>$]s) 0 0 0
1635 0 ▶ my ( $closing, $name, $attrs ) = ( $1, lc($2), $3 // '' );
Condition0%0/2
$3 // ""
l!l
00
MC/DC0%0/1
$3 // ""
$3
Truth table0%0/2
A
A= $3
Aresult
11
00
1636 0 ▶ $name = 'b' if $name eq 'strong';
Branch: 1 branch
BranchTrueFalseTotal
if $name eq "strong" 0 0 0
1637 0 ▶ $name = 'i' if $name eq 'em';
Branch: 1 branch
BranchTrueFalseTotal
if $name eq "em" 0 0 0
1638  
1639 0 ▶ if ( !$closing and $name =~ /^(?:b|i|u)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $closing and $name =~ /^(?:b|i|u)$/) 0 0 0
Condition0%0/3
not $closing and $name =~ /^(?:b|i|u)$/
!ll&&!rl&&r
000
MC/DC0%0/2
not $closing and $name =~ /^(?:b|i|u)$/
not $closing $name =~ /^(?:b|i|u)$/
Truth table0%0/3
not(A) and B
A= not $closingB= $name =~ /^(?:b|i|u)$/
ABresult
0X0
100
111
1640 0 $out .= uc($name) . '<';
1641 0 push @stack, $name;
1642 0 next;
1643 }
1644  
1645 0 ▶ if ( !$closing and $name eq 'a' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $closing and $name eq "a") 0 0 0
Condition0%0/3
not $closing and $name eq "a"
!ll&&!rl&&r
000
MC/DC0%0/2
not $closing and $name eq "a"
not $closing $name eq "a"
Truth table0%0/3
not(A) and B
A= not $closingB= $name eq "a"
ABresult
0X0
100
111
1646 0 my $href;
1647 0 ▶ if ( $attrs =~ /\bhref\s*=\s*"([^"]*)"/is ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($attrs =~ /\bhref\s*=\s*"([^"]*)"/is) { } 0 0 0
elsif ($attrs =~ /\bhref\s*=\s*'([^']*)'/is) { } 0 0 0
elsif ($attrs =~ /\bhref\s*=\s*([^\s"'=<>`]+)/is) { } 0 0 0
1648 0 $href = $1;
1649 }
1650 elsif ( $attrs =~ /\bhref\s*=\s*'([^']*)'/is ) {
1651 0 $href = $1;
1652 }
1653 elsif ( $attrs =~ /\bhref\s*=\s*([^\s"'=<>`]+)/is ) {
1654 0 $href = $1;
1655 }
1656 0 ▶ if ( defined $href ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $href) 0 0 0
1657 0 $out .= 'L<' . _prima_markup_url($href) . '|';
1658 0 push @stack, 'a';
1659 0 next;
1660 }
1661 }
1662  
1663 0 ▶ if ( $closing and @stack and $stack[-1] eq $name ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($closing and @stack and $stack[-1] eq $name) 0 0 0
Condition0%0/6
$closing and @stack and $stack[-1] eq $name
!ll&&!rl&&r
000
$closing and @stack
!ll&&!rl&&r
000
MC/DC0%0/3
$closing and @stack and $stack[-1] eq $name
$closing @stack $stack[-1] eq $name
Truth table0%0/4
A and B and C
A= $closingB= @stackC= $stack[-1] eq $name
ABCresult
0XX0
10X0
1100
1111
1664 0 pop @stack;
1665 0 $out .= '>';
1666 0 next;
1667 }
1668 }
1669  
1670 0 $out .= _prima_markup_quote( _decode_html_entities($tag) );
1671 }
1672  
1673 0 $out .= _prima_markup_quote( _decode_html_entities( substr( $html, $last ) ) );
1674 0 ▶ $out .= '>' while @stack and pop @stack;
Branch: 1 branch
BranchTrueFalseTotal
@stack and pop @stack and do { $out .= '>' } 0 0 0
Condition0%0/3
@stack and pop @stack
!ll&&!rl&&r
000
MC/DC0%0/2
@stack and pop @stack
@stack pop @stack
Truth table0%0/3
A and B
A= @stackB= pop @stack
ABresult
0X0
100
111
1675 0 return $out;
1676 }
1677  
1678 0 ▶sub _native_rich_text {
Subroutine _native_rich_text: not called CC=2 SCAR=17.9
1679 0 my ( $widget ) = @_;
1680  
1681 my $markup = _rich_text_html_to_prima_markup(
1682 0 ▶ $widget->slots->{_value} // '',
Condition0%0/2
$widget->slots->{"_value"} // ""
l!l
00
MC/DC0%0/1
$widget->slots->{"_value"} // ""
$widget->slots->{"_value"}
Truth table0%0/2
A
A= $widget->slots->{"_value"}
Aresult
11
00
1683 );
1684  
1685 0 return Prima::Drawable::Markup->new( markup => $markup );
1686 }
1687  
1688 0 ▶sub _refresh_native {
Subroutine _refresh_native: not called CC=75 SCAR=86.5
1689 0 my ( $widget ) = @_;
1690  
1691 0 ▶ my $kind = $widget->slots->{_widget_type} // '';
Condition0%0/2
$widget->slots->{"_widget_type"} // ""
l!l
00
MC/DC0%0/1
$widget->slots->{"_widget_type"} // ""
$widget->slots->{"_widget_type"}
Truth table0%0/2
A
A= $widget->slots->{"_widget_type"}
Aresult
11
00
1692 return if !_has_native($widget)
1693 0 ▶ and !( $kind eq 'MenuItem' and defined $widget->slots->{_native_menu_owner} );
Branch: 1 branch
BranchTrueFalseTotal
unless _has_native($widget) or $kind eq "MenuItem" and defined $widget->slots->{"_native_menu_owner"} 0 0 0
Condition0%0/6
_has_native($widget) or $kind eq "MenuItem" and defined $widget->slots->{"_native_menu_owner"}
l!l&&r!l&&!r
000
$kind eq "MenuItem" and defined $widget->slots->{"_native_menu_owner"}
!ll&&!rl&&r
000
MC/DC0%0/3
_has_native($widget) or $kind eq "MenuItem" and defined $widget->slots->{"_native_menu_owner"}
_has_native($widget) $kind eq "MenuItem" defined $widget->slots->{"_native_menu_owner"}
Truth table0%0/4
A or B and C
A= _has_native($widget)B= $kind eq "MenuItem"C= defined $widget->slots->{"_native_menu_owner"}
ABCresult
1XX1
0111
00X0
0100
1694 0 ▶ return if $widget->slots->{_syncing_native};
Branch: 1 branch
BranchTrueFalseTotal
if $widget->slots->{"_syncing_native"} 0 0 0
1695  
1696 0 my $native = $widget->slots->{_native};
1697 0 local $widget->slots->{_syncing_native} = 1;
1698  
1699 0 eval {
1700 0 ▶ if ( defined $native ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $native) 0 0 0
1701 0 ▶ $native->enabled( $widget->slots->{_enabled} ? 1 : 0 )
Branch: 2 branches
BranchTrueFalseTotal
if $native->can("enabled") 0 0 0
$widget->slots->{'_enabled'} ? : 0 0 0
1702 if $native->can('enabled');
1703 0 ▶ $native->visible( $widget->slots->{_visible} ? 1 : 0 )
Branch: 2 branches
BranchTrueFalseTotal
if $native->can("visible") 0 0 0
$widget->slots->{'_visible'} ? : 0 0 0
1704 if $native->can('visible');
1705 }
1706 0 ▶ if ( $kind eq 'Window' ) {
Branch: 14 branches
BranchTrueFalseTotal
if ($kind eq 'Window') { } 0 0 0
elsif ($kind eq 'Frame') { } 0 0 0
elsif ($kind eq 'Label' or $kind eq 'Text' or $kind eq 'RichText') { } 0 0 0
elsif ($kind eq 'Input') { } 0 0 0
elsif ($kind eq 'DatePicker') { } 0 0 0
elsif ($kind eq 'Checkbox' or $kind eq 'Radio') { } 0 0 0
elsif ($kind eq 'Button') { } 0 0 0
elsif ($kind eq 'Tab') { } 0 0 0
elsif ($kind eq 'Tabs') { } 0 0 0
elsif ($kind eq 'MenuItem') { } 0 0 0
elsif ($kind =~ /\A(?:Slider|Progress)\z/) { } 0 0 0
elsif ($kind eq 'ListView') { } 0 0 0
elsif ($kind eq 'TreeView') { } 0 0 0
elsif ($kind eq 'Select') { } 0 0 0
1707 0 ▶ $native->text( $widget->slots->{_title} // '' )
Branch: 1 branch
BranchTrueFalseTotal
if $native->can("text") 0 0 0
Condition0%0/2
$widget->slots->{"_title"} // ""
l!l
00
MC/DC0%0/1
$widget->slots->{"_title"} // ""
$widget->slots->{"_title"}
Truth table0%0/2
A
A= $widget->slots->{"_title"}
Aresult
11
00
1708 if $native->can('text');
1709 }
1710 elsif ( $kind eq 'Frame' ) {
1711 0 ▶ $native->text( $widget->slots->{_label} // '' )
Branch: 1 branch
BranchTrueFalseTotal
if $native->can("text") 0 0 0
Condition0%0/2
$widget->slots->{"_label"} // ""
l!l
00
MC/DC0%0/1
$widget->slots->{"_label"} // ""
$widget->slots->{"_label"}
Truth table0%0/2
A
A= $widget->slots->{"_label"}
Aresult
11
00
1712 if $native->can('text');
1713 }
1714 ▶ elsif ( $kind eq 'Label' or $kind eq 'Text' or $kind eq 'RichText' ) {
Condition0%0/6
$kind eq "Label" or $kind eq "Text" or $kind eq "RichText"
l!l&&r!l&&!r
000
$kind eq "Label" or $kind eq "Text"
l!l&&r!l&&!r
000
MC/DC0%0/3
$kind eq "Label" or $kind eq "Text" or $kind eq "RichText"
$kind eq "Label" $kind eq "Text" $kind eq "RichText"
Truth table0%0/4
A or B or C
A= $kind eq "Label"B= $kind eq "Text"C= $kind eq "RichText"
ABCresult
1XX1
01X1
0011
0000
1715 0 ▶ my $text = $kind eq 'RichText'
Branch: 1 branch
BranchTrueFalseTotal
$kind eq 'RichText' ? : 0 0 0
Condition0%0/2
_native_text($widget) // ""
l!l
00
MC/DC0%0/1
_native_text($widget) // ""
_native_text($widget)
Truth table0%0/2
A
A= _native_text($widget)
Aresult
11
00
1716 ? _native_rich_text($widget)
1717 : _native_text($widget) // '';
1718 0 ▶ $native->text($text)
Branch: 1 branch
BranchTrueFalseTotal
if $native->can("text") 0 0 0
1719 if $native->can('text');
1720 }
1721 elsif ( $kind eq 'Input' ) {
1722 0 ▶ $native->text( $widget->slots->{_value} // '' )
Branch: 1 branch
BranchTrueFalseTotal
if $native->can("text") 0 0 0
Condition0%0/2
$widget->slots->{"_value"} // ""
l!l
00
MC/DC0%0/1
$widget->slots->{"_value"} // ""
$widget->slots->{"_value"}
Truth table0%0/2
A
A= $widget->slots->{"_value"}
Aresult
11
00
1723 if $native->can('text');
1724 }
1725 elsif ( $kind eq 'DatePicker' ) {
1726 0 ▶ if ( $native->can('date') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($native->can("date")) 0 0 0
1727 my ( $year, $month, $day ) = _date_parts(
1728 $widget->slots->{_value},
1729 0 );
1730 0 $native->date( $day, $month - 1, $year - 1900 );
1731 }
1732 }
1733 ▶ elsif ( $kind eq 'Checkbox' or $kind eq 'Radio' ) {
Condition0%0/3
$kind eq "Checkbox" or $kind eq "Radio"
l!l&&r!l&&!r
000
MC/DC0%0/2
$kind eq "Checkbox" or $kind eq "Radio"
$kind eq "Checkbox" $kind eq "Radio"
Truth table0%0/3
A or B
A= $kind eq "Checkbox"B= $kind eq "Radio"
ABresult
1X1
011
000
1734 0 ▶ $native->text( $widget->slots->{_label} // '' )
Branch: 1 branch
BranchTrueFalseTotal
if $native->can("text") 0 0 0
Condition0%0/2
$widget->slots->{"_label"} // ""
l!l
00
MC/DC0%0/1
$widget->slots->{"_label"} // ""
$widget->slots->{"_label"}
Truth table0%0/2
A
A= $widget->slots->{"_label"}
Aresult
11
00
1735 if $native->can('text');
1736 0 ▶ $native->checked( $widget->slots->{_checked} ? 1 : 0 )
Branch: 2 branches
BranchTrueFalseTotal
if $native->can("checked") 0 0 0
$widget->slots->{'_checked'} ? : 0 0 0
1737 if $native->can('checked');
1738 }
1739 elsif ( $kind eq 'Button' ) {
1740 0 ▶ $native->text( $widget->slots->{_text} // '' )
Branch: 1 branch
BranchTrueFalseTotal
if $native->can("text") 0 0 0
Condition0%0/2
$widget->slots->{"_text"} // ""
l!l
00
MC/DC0%0/1
$widget->slots->{"_text"} // ""
$widget->slots->{"_text"}
Truth table0%0/2
A
A= $widget->slots->{"_text"}
Aresult
11
00
1741 if $native->can('text');
1742 }
1743 elsif ( $kind eq 'Tab' ) {
1744 0 ▶ $native->text( $widget->slots->{_title} // '' )
Branch: 1 branch
BranchTrueFalseTotal
if $native->can("text") 0 0 0
Condition0%0/2
$widget->slots->{"_title"} // ""
l!l
00
MC/DC0%0/1
$widget->slots->{"_title"} // ""
$widget->slots->{"_title"}
Truth table0%0/2
A
A= $widget->slots->{"_title"}
Aresult
11
00
1745 if $native->can('text');
1746 $native->visible(
1747 $widget->slots->{_visible} && $widget->slots->{_selected}
1748 0 ▶ ? 1
Branch: 2 branches
BranchTrueFalseTotal
if $native->can("visible") 0 0 0
$widget->slots->{'_visible'} && $widget->slots->{'_selected'} ? : 0 0 0
Condition0%0/3
$widget->slots->{"_visible"} and $widget->slots->{"_selected"}
!ll&&!rl&&r
000
MC/DC0%0/2
$widget->slots->{"_visible"} and $widget->slots->{"_selected"}
$widget->slots->{"_visible"} $widget->slots->{"_selected"}
Truth table0%0/3
A and B
A= $widget->slots->{"_visible"}B= $widget->slots->{"_selected"}
ABresult
0X0
100
111
1749 : 0,
1750 ) if $native->can('visible');
1751 }
1752 elsif ( $kind eq 'Tabs' ) {
1753 0 _sync_native_tabs($widget);
1754 }
1755 elsif ( $kind eq 'MenuItem' ) {
1756 0 my $menu = $widget->slots->{_native_menu_owner};
1757 0 my $name = $widget->slots->{_native_menu_name};
1758 0 ▶ if ( defined $menu and defined $name ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $menu and defined $name) 0 0 0
Condition0%0/3
defined $menu and defined $name
!ll&&!rl&&r
000
MC/DC0%0/2
defined $menu and defined $name
defined $menu defined $name
Truth table0%0/3
A and B
A= defined $menuB= defined $name
ABresult
0X0
100
111
1759 0 my $item = eval { $menu->$name };
1760 0 ▶ if ($item) {
Branch: 1 branch
BranchTrueFalseTotal
if ($item) 0 0 0
1761 0 ▶ $item->text( $widget->slots->{_text} // '' )
Branch: 1 branch
BranchTrueFalseTotal
if $item->can("text") 0 0 0
Condition0%0/2
$widget->slots->{"_text"} // ""
l!l
00
MC/DC0%0/1
$widget->slots->{"_text"} // ""
$widget->slots->{"_text"}
Truth table0%0/2
A
A= $widget->slots->{"_text"}
Aresult
11
00
1762 if $item->can('text');
1763 0 ▶ $item->enabled( $widget->slots->{_enabled} ? 1 : 0 )
Branch: 2 branches
BranchTrueFalseTotal
if $item->can("enabled") 0 0 0
$widget->slots->{'_enabled'} ? : 0 0 0
1764 if $item->can('enabled');
1765 }
1766 }
1767 }
1768 elsif ( $kind =~ /\A(?:Slider|Progress)\z/ ) {
1769 0 ▶ $native->value( int( $widget->slots->{_value} || 0 ) )
Branch: 1 branch
BranchTrueFalseTotal
if $native->can("value") 0 0 0
Condition0%0/2
$widget->slots->{'_value'} || 0
l!l
00
MC/DC0%0/1
$widget->slots->{'_value'} || 0
$widget->slots->{'_value'}
Truth table0%0/2
A
A= $widget->slots->{'_value'}
Aresult
11
00
1770 if $native->can('value');
1771 0 ▶ $native->min( int( $widget->slots->{_min} || 0 ) )
Branch: 1 branch
BranchTrueFalseTotal
if $native->can("min") 0 0 0
Condition0%0/2
$widget->slots->{'_min'} || 0
l!l
00
MC/DC0%0/1
$widget->slots->{'_min'} || 0
$widget->slots->{'_min'}
Truth table0%0/2
A
A= $widget->slots->{'_min'}
Aresult
11
00
1772 if $native->can('min');
1773 0 ▶ $native->max( int( $widget->slots->{_max} || 100 ) )
Branch: 1 branch
BranchTrueFalseTotal
if $native->can("max") 0 0 0
Condition0%0/2
$widget->slots->{'_max'} || 100
l!l
00
MC/DC0%0/1
$widget->slots->{'_max'} || 100
$widget->slots->{'_max'}
Truth table0%0/2
A
A= $widget->slots->{'_max'}
Aresult
11
00
1774 if $native->can('max');
1775 }
1776 elsif ( $kind eq 'ListView' ) {
1777 0 ▶ if ( $native->can('items') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($native->can("items")) 0 0 0
1778 0 $native->items( [ map { _item_label($_) }
1779 0 @{ $widget->slots->{_items}->items } ] );
1780 }
1781 $native->focusedItem( $widget->slots->{_selected_index} )
1782 if defined $widget->slots->{_selected_index}
1783 0 ▶ and $native->can('focusedItem');
Branch: 1 branch
BranchTrueFalseTotal
if defined $widget->slots->{"_selected_index"} and $native->can("focusedItem") 0 0 0
Condition0%0/3
defined $widget->slots->{"_selected_index"} and $native->can("focusedItem")
!ll&&!rl&&r
000
MC/DC0%0/2
defined $widget->slots->{"_selected_index"} and $native->can("focusedItem")
defined $widget->slots->{"_selected_index"} $native->can("focusedItem")
Truth table0%0/3
A and B
A= defined $widget->slots->{"_selected_index"}B= $native->can("focusedItem")
ABresult
0X0
100
111
1784 }
1785 elsif ( $kind eq 'TreeView' ) {
1786 0 ▶ $native->items( _tree_outline_items($widget) )
Branch: 1 branch
BranchTrueFalseTotal
if $native->can("items") 0 0 0
1787 if $native->can('items');
1788 0 _sync_tree_outline_selection($widget);
1789 }
1790 elsif ( $kind eq 'Select' ) {
1791 $native->text( defined $widget->slots->{_value}
1792 ? '' . $widget->slots->{_value}
1793 0 ▶ : '' )
Branch: 2 branches
BranchTrueFalseTotal
if $native->can("text") 0 0 0
defined $widget->slots->{'_value'} ? : 0 0 0
1794 if $native->can('text');
1795 }
1796 my $native_width = $widget->slots->{_width}
1797 0 ▶ // $widget->slots->{_maxwidth};
Condition0%0/3
$widget->slots->{"_width"} // $widget->slots->{"_maxwidth"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$widget->slots->{"_width"} // $widget->slots->{"_maxwidth"}
$widget->slots->{"_width"} $widget->slots->{"_maxwidth"}
Truth table0%0/3
A // B
A= $widget->slots->{"_width"}B= $widget->slots->{"_maxwidth"}
ABresult
1X1
011
000
1798 my $native_height = $widget->slots->{_height}
1799 0 ▶ // $widget->slots->{_maxheight};
Condition0%0/3
$widget->slots->{"_height"} // $widget->slots->{"_maxheight"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$widget->slots->{"_height"} // $widget->slots->{"_maxheight"}
$widget->slots->{"_height"} $widget->slots->{"_maxheight"}
Truth table0%0/3
A // B
A= $widget->slots->{"_height"}B= $widget->slots->{"_maxheight"}
ABresult
1X1
011
000
1800 0 ▶ if ( defined $native_width and $native->can('width') ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $native_width and $native->can("width")) 0 0 0
Condition0%0/3
defined $native_width and $native->can("width")
!ll&&!rl&&r
000
MC/DC0%0/2
defined $native_width and $native->can("width")
defined $native_width $native->can("width")
Truth table0%0/3
A and B
A= defined $native_widthB= $native->can("width")
ABresult
0X0
100
111
1801 0 $native->width( int($native_width) );
1802 }
1803 0 ▶ if ( defined $native_height and $native->can('height') ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $native_height and $native->can("height")) 0 0 0
Condition0%0/3
defined $native_height and $native->can("height")
!ll&&!rl&&r
000
MC/DC0%0/2
defined $native_height and $native->can("height")
defined $native_height $native->can("height")
Truth table0%0/3
A and B
A= defined $native_heightB= $native->can("height")
ABresult
0X0
100
111
1804 0 $native->height( int($native_height) );
1805 }
1806 0 ▶ $native->repaint if $native->can('repaint');
Branch: 1 branch
BranchTrueFalseTotal
if $native->can("repaint") 0 0 0
1807 0 1;
1808 };
1809  
1810 0 return;
1811 }
1812  
1813 0 ▶sub _sync_native_tabs {
Subroutine _sync_native_tabs: not called CC=16 SCAR=56.1
1814 0 my ( $tabs ) = @_;
1815  
1816 0 ▶ return if !_has_native($tabs);
Branch: 1 branch
BranchTrueFalseTotal
unless _has_native($tabs) 0 0 0
1817 0 ▶ return if !defined $tabs->slots->{_native_content};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $tabs->slots->{"_native_content"} 0 0 0
1818  
1819 0 my $selected;
1820 0 for my $child ( @{ $tabs->slots->{_children}->items } ) {
1821 0 ▶ next if _class_name($child) ne 'Tab';
Branch: 1 branch
BranchTrueFalseTotal
if _class_name($child) ne "Tab" 0 0 0
1822 0 ▶ next if !_has_native($child);
Branch: 1 branch
BranchTrueFalseTotal
unless _has_native($child) 0 0 0
1823 0 my $native = $child->slots->{_native};
1824 0 ▶ eval { $native->packForget if $native->can('packForget'); 1 };
Branch: 1 branch
BranchTrueFalseTotal
if $native->can("packForget") 0 0 0
1825 0 ▶ $native->visible(0) if $native->can('visible');
Branch: 1 branch
BranchTrueFalseTotal
if $native->can("visible") 0 0 0
1826 0 ▶ $selected = $child if $child->slots->{_selected} and !defined $selected;
Branch: 1 branch
BranchTrueFalseTotal
if $child->slots->{"_selected"} and not defined $selected 0 0 0
Condition0%0/3
$child->slots->{"_selected"} and not defined $selected
!ll&&!rl&&r
000
MC/DC0%0/2
$child->slots->{"_selected"} and not defined $selected
$child->slots->{"_selected"} not defined $selected
Truth table0%0/3
A and not(B)
A= $child->slots->{"_selected"}B= not defined $selected
ABresult
0X0
100
111
1827 }
1828  
1829 0 ▶ return if !defined $selected or !_has_native($selected);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $selected and _has_native($selected) 0 0 0
Condition0%0/3
defined $selected and _has_native($selected)
!ll&&!rl&&r
000
MC/DC0%0/2
defined $selected and _has_native($selected)
defined $selected _has_native($selected)
Truth table0%0/3
A and B
A= defined $selectedB= _has_native($selected)
ABresult
0X0
100
111
1830 0 my $native = $selected->slots->{_native};
1831 0 ▶ $native->pack(
Branch: 1 branch
BranchTrueFalseTotal
if $native->can("pack") 0 0 0
1832 side => 'top',
1833 fill => 'both',
1834 expand => 1,
1835 padx => 0,
1836 pady => 0,
1837 ) if $native->can('pack');
1838 0 ▶ $native->visible(1) if $native->can('visible');
Branch: 1 branch
BranchTrueFalseTotal
if $native->can("visible") 0 0 0
1839 0 ▶ $native->repaint if $native->can('repaint');
Branch: 1 branch
BranchTrueFalseTotal
if $native->can("repaint") 0 0 0
1840 $tabs->slots->{_native_content}->repaint
1841 0 ▶ if $tabs->slots->{_native_content}->can('repaint');
Branch: 1 branch
BranchTrueFalseTotal
if $tabs->slots->{"_native_content"}->can("repaint") 0 0 0
1842 0 return;
1843 }
1844  
1845 0 ▶sub _native_pack_for {
Subroutine _native_pack_for: not called CC=12 SCAR=50.5
1846 0 my ( $parent_kind, $widget ) = @_;
1847  
1848 0 ▶ my $kind = $widget->slots->{_widget_type} // '';
Condition0%0/2
$widget->slots->{"_widget_type"} // ""
l!l
00
MC/DC0%0/1
$widget->slots->{"_widget_type"} // ""
$widget->slots->{"_widget_type"}
Truth table0%0/2
A
A= $widget->slots->{"_widget_type"}
Aresult
11
00
1849 my $fixed_width = defined $widget->slots->{_width}
1850 0 ▶ || defined $widget->slots->{_maxwidth};
Condition0%0/3
defined $widget->slots->{'_width'} || defined $widget->slots->{'_maxwidth'}
l!l&&r!l&&!r
000
MC/DC0%0/2
defined $widget->slots->{'_width'} || defined $widget->slots->{'_maxwidth'}
defined $widget->slots->{'_width'} defined $widget->slots->{'_maxwidth'}
Truth table0%0/3
A || B
A= defined $widget->slots->{'_width'}B= defined $widget->slots->{'_maxwidth'}
ABresult
1X1
011
000
1851 my $fixed_height = defined $widget->slots->{_height}
1852 0 ▶ || defined $widget->slots->{_maxheight};
Condition0%0/3
defined $widget->slots->{'_height'} || defined $widget->slots->{'_maxheight'}
l!l&&r!l&&!r
000
MC/DC0%0/2
defined $widget->slots->{'_height'} || defined $widget->slots->{'_maxheight'}
defined $widget->slots->{'_height'} defined $widget->slots->{'_maxheight'}
Truth table0%0/3
A || B
A= defined $widget->slots->{'_height'}B= defined $widget->slots->{'_maxheight'}
ABresult
1X1
011
000
1853 0 ▶ my %pack = (
Branch: 2 branches
BranchTrueFalseTotal
$parent_kind eq 'HBox' ? : 0 0 0
$parent_kind eq 'HBox' ? : 0 0 0
1854 side => ( $parent_kind eq 'HBox' ? 'left' : 'top' ),
1855 fill => ( $parent_kind eq 'HBox' ? 'y' : 'x' ),
1856 padx => 4,
1857 pady => 4,
1858 );
1859  
1860 0 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($kind =~ /\A(?: VBox|HBox|Frame|Image|RadioGroup|Tabs|Tab|ListView|TreeView )\z/x) 0 0 0
1861 $kind =~ /\A(?:
1862 VBox|HBox|Frame|Image|RadioGroup|Tabs|Tab|ListView|TreeView
1863 )\z/x
1864 ) {
1865 0 $pack{expand} = 1;
1866 0 $pack{fill} = 'both';
1867 }
1868 0 ▶ if ( $parent_kind eq 'VBox' and $fixed_height ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($parent_kind eq 'VBox' and $fixed_height) { } 0 0 0
elsif ($parent_kind eq 'HBox' and $fixed_height) { } 0 0 0
Condition0%0/3
$parent_kind eq "VBox" and $fixed_height
!ll&&!rl&&r
000
MC/DC0%0/2
$parent_kind eq "VBox" and $fixed_height
$parent_kind eq "VBox" $fixed_height
Truth table0%0/3
A and B
A= $parent_kind eq "VBox"B= $fixed_height
ABresult
0X0
100
111
1869 0 delete $pack{expand};
1870 0 $pack{fill} = 'x';
1871 }
1872 ▶ elsif ( $parent_kind eq 'HBox' and $fixed_height ) {
Condition0%0/3
$parent_kind eq "HBox" and $fixed_height
!ll&&!rl&&r
000
MC/DC0%0/2
$parent_kind eq "HBox" and $fixed_height
$parent_kind eq "HBox" $fixed_height
Truth table0%0/3
A and B
A= $parent_kind eq "HBox"B= $fixed_height
ABresult
0X0
100
111
1873 0 delete $pack{expand};
1874 0 ▶ $pack{fill} = $fixed_width ? 'none' : 'x';
Branch: 1 branch
BranchTrueFalseTotal
$fixed_width ? : 0 0 0
1875 }
1876  
1877 0 return \%pack;
1878 }
1879  
1880 0 ▶sub _native_geometry_args {
Subroutine _native_geometry_args: not called CC=10 SCAR=47.0
1881 0 my ( $widget, %fallback ) = @_;
1882  
1883 0 my %args;
1884 0 for my $axis ( qw( width height ) ) {
1885 0 my $slot = '_' . $axis;
1886 0 my $max_slot = '_max' . $axis;
1887 0 my $min_slot = '_min' . $axis;
1888 0 my $value = $widget->slots->{$slot};
1889 $value = $widget->slots->{$max_slot}
1890 0 ▶ if !defined $value and defined $widget->slots->{$max_slot};
Branch: 1 branch
BranchTrueFalseTotal
if not defined $value and defined $widget->slots->{$max_slot} 0 0 0
Condition0%0/3
not defined $value and defined $widget->slots->{$max_slot}
!ll&&!rl&&r
000
MC/DC0%0/2
not defined $value and defined $widget->slots->{$max_slot}
not defined $value defined $widget->slots->{$max_slot}
Truth table0%0/3
not(A) and B
A= not defined $valueB= defined $widget->slots->{$max_slot}
ABresult
0X0
100
111
1891 $value = $fallback{$axis}
1892 0 ▶ if !defined $value and defined $fallback{$axis};
Branch: 1 branch
BranchTrueFalseTotal
if not defined $value and defined $fallback{$axis} 0 0 0
Condition0%0/3
not defined $value and defined $fallback{$axis}
!ll&&!rl&&r
000
MC/DC0%0/2
not defined $value and defined $fallback{$axis}
not defined $value defined $fallback{$axis}
Truth table0%0/3
not(A) and B
A= not defined $valueB= defined $fallback{$axis}
ABresult
0X0
100
111
1893 $value = $widget->slots->{$min_slot}
1894 if defined $widget->slots->{$min_slot}
1895 0 ▶ and ( !defined $value or $value < $widget->slots->{$min_slot} );
Branch: 1 branch
BranchTrueFalseTotal
if defined $widget->slots->{$min_slot} and !defined($value) || $value < $widget->slots->{$min_slot} 0 0 0
Condition0%0/6
defined $widget->slots->{$min_slot} and !defined($value) || $value < $widget->slots->{$min_slot}
!ll&&!rl&&r
000
not defined $value or $value < $widget->slots->{$min_slot}
l!l&&r!l&&!r
000
MC/DC0%0/3
defined $widget->slots->{$min_slot} and !defined($value) || $value < $widget->slots->{$min_slot}
defined $widget->slots->{$min_slot} not defined $value $value < $widget->slots->{$min_slot}
Truth table0%0/4
A and not(B) or C
A= defined $widget->slots->{$min_slot}B= not defined $valueC= $value < $widget->slots->{$min_slot}
ABCresult
0XX0
1000
11X1
1011
1896 0 ▶ $args{$axis} = int($value) if defined $value;
Branch: 1 branch
BranchTrueFalseTotal
if defined $value 0 0 0
1897 }
1898 0 return %args;
1899 }
1900  
1901 2 ▶sub _emit_native_event {
Subroutine _emit_native_event: called CC=3 SCAR=11.2
1902 2 my ( $runtime, $widget, $name, $data ) = @_;
1903  
1904 2 ▶ return if $widget->slots->{_syncing_native};
Branch: 1 branch
BranchTrueFalseTotal
if $widget->slots->{"_syncing_native"} 0 2 2
1905 2 ▶ eval {
Branch: 1 branch
BranchTrueFalseTotal
eval { do { my $event = _make_event($runtime->{"_gui_event_class"}, $name, $widget, $data); _dispatch_event($runtime, $widget, $event); 1 } } or warn "$@" 2 0 2
1906 my $event = _make_event(
1907 $runtime->{_gui_event_class},
1908 2 $name,
1909 $widget,
1910 $data,
1911 );
1912 2 _dispatch_event( $runtime, $widget, $event );
1913 2 1;
1914 } or warn "$@";
1915 2 return;
1916 }
1917  
1918 4 ▶sub _dispatch_named_event {
Subroutine _dispatch_named_event: called CC=1 SCAR=0.0
1919 4 my ( $runtime, $widget, $name, $data ) = @_;
1920  
1921 4 my $event = _make_event( $runtime->{_gui_event_class}, $name, $widget, $data );
1922 4 return _dispatch_event( $runtime, $widget, $event );
1923 }
1924  
1925 2 ▶sub _event_cancelled {
Subroutine _event_cancelled: called CC=3 SCAR=11.4
1926 2 my ( $event ) = @_;
1927  
1928 2 ▶ return 1 if $event->slots->{default_prevented};
Branch: 1 branch
BranchTrueFalseTotal
if $event->slots->{"default_prevented"} 0 2 2
1929 2 ▶ return 1 if $event->slots->{cancelled};
Branch: 1 branch
BranchTrueFalseTotal
if $event->slots->{"cancelled"} 0 2 2
1930 2 return 0;
1931 }
1932  
1933 2 ▶sub _clear_native_refs {
Subroutine _clear_native_refs: called CC=3 SCAR=11.2
1934 2 my ( $widget ) = @_;
1935  
1936 2 delete @{ $widget->slots }{
1937 2 qw(
1938 _native
1939 _native_content
1940 _native_menu_owner
1941 _native_menu_name
1942 _native_node_by_path
1943 _native_path_by_node
1944 _native_paths
1945 )
1946 };
1947  
1948 2 ▶ if ( _is_widget($widget) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (_is_widget($widget)) 2 0 2
1949 2 for my $child ( @{ $widget->slots->{_children}->items } ) {
1950 0 _clear_native_refs($child);
1951 }
1952 }
1953  
1954 2 return;
1955 }
1956  
1957 2 ▶sub _stop_prima_call_loop {
Subroutine _stop_prima_call_loop: called CC=5 SCAR=17.5
1958 2 my ( $window ) = @_;
1959  
1960 2 ▶ return if !$window->slots->{_call_running};
Branch: 1 branch
BranchTrueFalseTotal
unless $window->slots->{"_call_running"} 0 2 2
1961 2 ▶ return if !$PRIMA_READY or !_prima_application_ready();
Branch: 1 branch
BranchTrueFalseTotal
unless $PRIMA_READY and _prima_application_ready() 0 2 2
Condition33%1/3
$PRIMA_READY and _prima_application_ready()
!ll&&!rl&&r
002
MC/DC0%0/2
$PRIMA_READY and _prima_application_ready()
$PRIMA_READY _prima_application_ready()
Truth table33%1/3
A and B
A= $PRIMA_READYB= _prima_application_ready()
ABresult
0X0
100
111
1962 2 ▶ eval { $::application->stop if $::application->can('stop'); 1 };
Branch: 1 branch
BranchTrueFalseTotal
if $main::application->can("stop") 2 0 2
1963 2 return;
1964 }
1965  
1966 2 ▶sub _close_window {
Subroutine _close_window: called CC=5 SCAR=18.7
1967 2 my ( $runtime, $window, $result, $skip_native ) = @_;
1968  
1969 2 ▶ return $window if $window->slots->{_closed};
Branch: 1 branch
BranchTrueFalseTotal
if $window->slots->{"_closed"} 0 2 2
1970  
1971 2 my $event = _dispatch_named_event(
1972 $runtime,
1973 $window,
1974 'close_request',
1975 $result,
1976 );
1977 2 ▶ return $window if _event_cancelled($event);
Branch: 1 branch
BranchTrueFalseTotal
if _event_cancelled($event) 0 2 2
1978  
1979 2 $window->slots->{_closed} = 1;
1980 2 $window->slots->{_close_result} = $result;
1981 2 ▶ if ( _has_native($window) and !$skip_native ) {
Branch: 1 branch
BranchTrueFalseTotal
if (_has_native($window) and not $skip_native) 0 2 2
Condition33%1/3
_has_native($window) and not $skip_native
!ll&&!rl&&r
020
MC/DC0%0/2
_has_native($window) and not $skip_native
_has_native($window) not $skip_native
Truth table33%1/3
A and not(B)
A= _has_native($window)B= not $skip_native
ABresult
0X0
100
111
1982 0 local $window->slots->{_native_closing} = 1;
1983 0 eval { $window->slots->{_native}->close; 1 };
1984 }
1985 2 _stop_prima_call_loop($window);
1986 2 _dispatch_named_event( $runtime, $window, 'closed', $result );
1987 2 return $window;
1988 }
1989  
1990 0 ▶sub _option_labels {
Subroutine _option_labels: not called CC=6 SCAR=37.4
1991 0 my ( $select ) = @_;
1992  
1993 0 my @labels;
1994 0 for my $option ( @{ $select->slots->{_options}->items } ) {
1995 0 ▶ if ( blessed($option) and $option->isa('Zuzu::Value::Dict') ) {
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::blessed($option) and $option->isa("Zuzu::Value::Dict")) 0 0 0
Condition0%0/3
builtin::blessed($option) and $option->isa("Zuzu::Value::Dict")
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::blessed($option) and $option->isa("Zuzu::Value::Dict")
builtin::blessed($option) $option->isa("Zuzu::Value::Dict")
Truth table0%0/3
A and B
A= builtin::blessed($option)B= $option->isa("Zuzu::Value::Dict")
ABresult
0X0
100
111
1996 0 my $label = $option->map->{label};
1997 0 my $value = $option->map->{value};
1998 0 ▶ push @labels, defined $label ? "$label" : "$value";
Branch: 1 branch
BranchTrueFalseTotal
defined $label ? : 0 0 0
1999 0 next;
2000 }
2001 0 ▶ push @labels, defined $option ? "$option" : '';
Branch: 1 branch
BranchTrueFalseTotal
defined $option ? : 0 0 0
2002 }
2003  
2004 0 return \@labels;
2005 }
2006  
2007 0 ▶sub _option_value_from_label {
Subroutine _option_value_from_label: not called CC=6 SCAR=37.4
2008 0 my ( $select, $label ) = @_;
2009  
2010 0 for my $option ( @{ $select->slots->{_options}->items } ) {
2011 0 ▶ next if !blessed($option) or !$option->isa('Zuzu::Value::Dict');
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($option) and $option->isa("Zuzu::Value::Dict") 0 0 0
Condition0%0/3
builtin::blessed($option) and $option->isa("Zuzu::Value::Dict")
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::blessed($option) and $option->isa("Zuzu::Value::Dict")
builtin::blessed($option) $option->isa("Zuzu::Value::Dict")
Truth table0%0/3
A and B
A= builtin::blessed($option)B= $option->isa("Zuzu::Value::Dict")
ABresult
0X0
100
111
2012 0 my $olabel = $option->map->{label};
2013 0 my $value = $option->map->{value};
2014 0 ▶ next if !defined $olabel;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $olabel 0 0 0
2015 0 ▶ return $value if "$olabel" eq "$label";
Branch: 1 branch
BranchTrueFalseTotal
if "$olabel" eq "$label" 0 0 0
2016 }
2017  
2018 0 return $label;
2019 }
2020  
2021 0 ▶sub _insert_container {
Subroutine _insert_container: not called CC=9 SCAR=45.0
2022 0 my ( $runtime, $parent, $widget, $parent_kind, $class, %extra ) = @_;
2023  
2024 0 ▶ my $visible = $widget->slots->{_visible} ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$widget->slots->{'_visible'} ? : 0 0 0
2025 $visible = $visible && $widget->slots->{_selected}
2026 0 ▶ if $widget->slots->{_widget_type} eq 'Tab';
Branch: 1 branch
BranchTrueFalseTotal
if $widget->slots->{"_widget_type"} eq "Tab" 0 0 0
Condition0%0/3
$visible && $widget->slots->{'_selected'}
!ll&&!rl&&r
000
MC/DC0%0/2
$visible && $widget->slots->{'_selected'}
$visible $widget->slots->{'_selected'}
Truth table0%0/3
A && B
A= $visibleB= $widget->slots->{'_selected'}
ABresult
0X0
100
111
2027 my $native = $parent->insert(
2028 $class,
2029 pack => _native_pack_for( $parent_kind, $widget ),
2030 font => _prima_font(),
2031 0 ▶ enabled => $widget->slots->{_enabled} ? 1 : 0,
Branch: 1 branch
BranchTrueFalseTotal
$widget->slots->{'_enabled'} ? : 0 0 0
2032 visible => $visible,
2033 _native_geometry_args($widget),
2034 %extra,
2035 );
2036 0 $widget->slots->{_native} = $native;
2037  
2038 0 my $child_parent = $native;
2039 0 ▶ if ( $class eq 'GroupBox' and defined( $extra{text} ) and $extra{text} ne '' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($class eq "GroupBox" and defined $extra{"text"} and $extra{"text"} ne "") 0 0 0
Condition0%0/6
$class eq "GroupBox" and defined $extra{"text"} and $extra{"text"} ne ""
!ll&&!rl&&r
000
$class eq "GroupBox" and defined $extra{"text"}
!ll&&!rl&&r
000
MC/DC0%0/3
$class eq "GroupBox" and defined $extra{"text"} and $extra{"text"} ne ""
$class eq "GroupBox" defined $extra{"text"} $extra{"text"} ne ""
Truth table0%0/4
A and B and C
A= $class eq "GroupBox"B= defined $extra{"text"}C= $extra{"text"} ne ""
ABCresult
0XX0
10X0
1100
1111
2040 0 $child_parent = $native->insert(
2041 Widget =>
2042 pack => {
2043 side => 'top',
2044 fill => 'both',
2045 expand => 1,
2046 padx => 6,
2047 pady => _prima_groupbox_content_pady(),
2048 },
2049 font => _prima_font(),
2050 ownerBackColor => 1,
2051 );
2052 0 $widget->slots->{_native_content} = $child_parent;
2053 }
2054  
2055 0 for my $child ( @{ $widget->slots->{_children}->items } ) {
2056 0 _render_widget( $runtime, $child_parent, $child, $widget->slots->{_widget_type} );
2057 }
2058 0 return $native;
2059 }
2060  
2061 0 ▶sub _render_tabs_widget {
Subroutine _render_tabs_widget: not called CC=7 SCAR=40.3
2062 0 my ( $runtime, $parent, $widget, $parent_kind ) = @_;
2063  
2064 my $native = $parent->insert(
2065 GroupBox =>
2066 pack => _native_pack_for( $parent_kind, $widget ),
2067 font => _prima_font(),
2068 text => 'Tabs',
2069 enabled => $widget->slots->{_enabled} ? 1 : 0,
2070 0 ▶ visible => $widget->slots->{_visible} ? 1 : 0,
Branch: 2 branches
BranchTrueFalseTotal
$widget->slots->{'_enabled'} ? : 0 0 0
$widget->slots->{'_visible'} ? : 0 0 0
2071 );
2072 0 $widget->slots->{_native} = $native;
2073  
2074 0 my $header = $native->insert(
2075 Widget =>
2076 pack => {
2077 side => 'top',
2078 fill => 'x',
2079 padx => 2,
2080 pady => 2,
2081 },
2082 font => _prima_font(),
2083 );
2084 0 for my $child ( @{ $widget->slots->{_children}->items } ) {
2085 0 ▶ next if _class_name($child) ne 'Tab';
Branch: 1 branch
BranchTrueFalseTotal
if _class_name($child) ne "Tab" 0 0 0
2086 $header->insert(
2087 Button =>
2088 pack => {
2089 side => 'left',
2090 padx => 2,
2091 pady => 2,
2092 },
2093 font => _prima_font(),
2094 text => $child->slots->{_title} // '',
2095 0 ▶ onClick => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
2096 0 _sync_tabs_selected( $widget, $child->slots->{_value} );
2097 0 _emit_native_event( $runtime, $widget, 'select' );
2098 0 _emit_native_event( $runtime, $widget, 'change' );
2099 },
2100 0 ▶ );
Condition0%0/2
$child->slots->{"_title"} // ""
l!l
00
MC/DC0%0/1
$child->slots->{"_title"} // ""
$child->slots->{"_title"}
Truth table0%0/2
A
A= $child->slots->{"_title"}
Aresult
11
00
2101 }
2102  
2103 0 my $content = $native->insert(
2104 Widget =>
2105 pack => {
2106 side => 'top',
2107 fill => 'both',
2108 expand => 1,
2109 padx => 2,
2110 pady => 2,
2111 },
2112 font => _prima_font(),
2113 );
2114 0 $widget->slots->{_native_content} = $content;
2115 0 for my $child ( @{ $widget->slots->{_children}->items } ) {
2116 0 _render_widget( $runtime, $content, $child, 'Tabs' );
2117 }
2118 0 _sync_native_tabs($widget);
2119 0 return $native;
2120 }
2121  
2122 0 ▶sub _render_image_widget {
Subroutine _render_image_widget: not called CC=5 SCAR=34.0
2123 0 my ( $runtime, $parent, $widget, $parent_kind ) = @_;
2124  
2125 0 my $image;
2126 0 my $src = $widget->slots->{_src};
2127 0 ▶ if ( defined $src and $src ne '' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $src and $src ne "") 0 0 0
Condition0%0/3
defined $src and $src ne ""
!ll&&!rl&&r
000
MC/DC0%0/2
defined $src and $src ne ""
defined $src $src ne ""
Truth table0%0/3
A and B
A= defined $srcB= $src ne ""
ABresult
0X0
100
111
2128 0 ▶ my $path = File::Spec->file_name_is_absolute($src)
Branch: 1 branch
BranchTrueFalseTotal
'File::Spec'->file_name_is_absolute($src) ? : 0 0 0
2129 ? $src
2130 : File::Spec->rel2abs($src);
2131 0 ▶ $image = eval { Prima::Image->load($path) } if -f $path;
Branch: 1 branch
BranchTrueFalseTotal
if -f $path 0 0 0
2132 }
2133  
2134 my $native = $parent->insert(
2135 Widget =>
2136 pack => _native_pack_for( $parent_kind, $widget ),
2137 font => _prima_font(),
2138 _native_geometry_args( $widget, height => 96 ),
2139 0 ▶ onPaint => sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
2140 0 my ( $self, $canvas ) = @_;
2141 0 my ( $w, $h ) = $self->size;
2142 0 $canvas->clear;
2143 0 $canvas->color(cl::LightGray);
2144 0 $canvas->bar( 0, 0, $w, $h );
2145 0 ▶ if ($image) {
Branch: 1 branch
BranchTrueFalseTotal
if ($image) { } 0 0 0
2146 0 $canvas->stretch_image( 4, 4, $w - 8, $h - 8, $image );
2147 }
2148 else {
2149 0 $canvas->color(cl::DarkGray);
2150 0 $canvas->rectangle( 4, 4, $w - 5, $h - 5 );
2151 0 $canvas->color(cl::Black);
2152 0 $canvas->font( _prima_font() );
2153 0 ▶ $canvas->text_out( $widget->slots->{_alt} // 'Image', 12, int( $h / 2 ) );
Condition0%0/2
$widget->slots->{"_alt"} // "Image"
l!l
00
MC/DC0%0/1
$widget->slots->{"_alt"} // "Image"
$widget->slots->{"_alt"}
Truth table0%0/2
A
A= $widget->slots->{"_alt"}
Aresult
11
00
2154 }
2155 },
2156 0 ▶ onMouseUp => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
2157 0 _emit_native_event( $runtime, $widget, 'click' );
2158 },
2159 0 );
2160 0 $widget->slots->{_native} = $native;
2161 0 return $native;
2162 }
2163  
2164 0 ▶sub _render_separator_widget {
Subroutine _render_separator_widget: not called CC=3 SCAR=24.8
2165 0 my ( $runtime, $parent, $widget, $parent_kind ) = @_;
2166  
2167 my $native = $parent->insert(
2168 Widget =>
2169 pack => _native_pack_for( $parent_kind, $widget ),
2170 height => $widget->slots->{_orientation} eq 'vertical' ? 48 : 8,
2171 width => $widget->slots->{_orientation} eq 'vertical' ? 8 : 48,
2172 0 ▶ onPaint => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
2173 0 my ( $self, $canvas ) = @_;
2174 0 my ( $w, $h ) = $self->size;
2175 0 $canvas->clear;
2176 0 $canvas->color(cl::DarkGray);
2177 0 ▶ if ( $widget->slots->{_orientation} eq 'vertical' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($widget->slots->{'_orientation'} eq 'vertical') { } 0 0 0
2178 0 my $x = int( $w / 2 );
2179 0 $canvas->line( $x, 2, $x, $h - 3 );
2180 }
2181 else {
2182 0 my $y = int( $h / 2 );
2183 0 $canvas->line( 2, $y, $w - 3, $y );
2184 }
2185 },
2186 0 ▶ );
Branch: 2 branches
BranchTrueFalseTotal
$widget->slots->{'_orientation'} eq 'vertical' ? : 0 0 0
$widget->slots->{'_orientation'} eq 'vertical' ? : 0 0 0
2187 0 $widget->slots->{_native} = $native;
2188 0 return $native;
2189 }
2190  
2191 0 ▶sub _render_tree_items {
Subroutine _render_tree_items: not called CC=1 SCAR=6.9
2192 0 my ( $tree ) = @_;
2193  
2194 0 my @labels;
2195 my @paths;
2196 _flatten_tree_items(
2197 $tree->slots->{_items},
2198 0,
2199 [],
2200 \@labels,
2201 \@paths,
2202 $tree->slots->{_expanded_path_keys},
2203 0 );
2204 0 $tree->slots->{_native_paths} = \@paths;
2205 0 return \@labels;
2206 }
2207  
2208 0 ▶sub _tree_outline_items {
Subroutine _tree_outline_items: not called CC=1 SCAR=6.9
2209 0 my ( $tree ) = @_;
2210  
2211 0 my %path_by_node;
2212 my %node_by_path;
2213 0 my $build;
2214 0 ▶ $build = sub {
Subroutine __ANON__: not called CC=5 SCAR=34.0
2215 0 my ( $items, $prefix ) = @_;
2216 0 my @nodes;
2217 0 ▶ for ( my $i = 0; $i < @{ $items->items }; $i++ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < @{$items->items;}) 0 0 0
2218 0 my $item = $items->items->[$i];
2219 0 ▶ my @path = ( @{ $prefix // [] }, $i );
Condition0%0/2
$prefix // []
l!l
00
MC/DC0%0/1
$prefix // []
$prefix
Truth table0%0/2
A
A= $prefix
Aresult
11
00
2220 0 my $children = _tree_children($item);
2221 0 my @child_nodes = @{ $build->( $children, \@path ) };
2222 0 my $key = _path_key(\@path);
2223 my $node = [
2224 _item_label($item),
2225 @child_nodes ? \@child_nodes : undef,
2226 0 ▶ exists $tree->slots->{_expanded_path_keys}{$key} ? 1 : 0,
Branch: 2 branches
BranchTrueFalseTotal
@child_nodes ? : 0 0 0
exists $tree->slots->{'_expanded_path_keys'}{$key} ? : 0 0 0
2227 ];
2228 0 $path_by_node{ refaddr($node) } = \@path;
2229 0 $node_by_path{$key} = $node;
2230 0 push @nodes, $node;
2231 }
2232 0 return \@nodes;
2233 0 };
2234  
2235 0 my $nodes = $build->( $tree->slots->{_items}, [] );
2236 0 $tree->slots->{_native_path_by_node} = \%path_by_node;
2237 0 $tree->slots->{_native_node_by_path} = \%node_by_path;
2238 0 return $nodes;
2239 }
2240  
2241 0 ▶sub _sync_tree_outline_selection {
Subroutine _sync_tree_outline_selection: not called CC=7 SCAR=40.3
2242 0 my ( $tree ) = @_;
2243  
2244 0 my $native = $tree->slots->{_native};
2245 0 ▶ return if !defined $native or !$native->can('focusedItem');
Branch: 1 branch
BranchTrueFalseTotal
unless defined $native and $native->can("focusedItem") 0 0 0
Condition0%0/3
defined $native and $native->can("focusedItem")
!ll&&!rl&&r
000
MC/DC0%0/2
defined $native and $native->can("focusedItem")
defined $native $native->can("focusedItem")
Truth table0%0/3
A and B
A= defined $nativeB= $native->can("focusedItem")
ABresult
0X0
100
111
2246  
2247 0 my $key = _path_key( [ @{ $tree->slots->{_selected_path}->items } ] );
2248 0 my $node = $tree->slots->{_native_node_by_path}{$key};
2249 0 ▶ if ($node and $native->can('get_index')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($node and $native->can("get_index")) 0 0 0
Condition0%0/3
$node and $native->can("get_index")
!ll&&!rl&&r
000
MC/DC0%0/2
$node and $native->can("get_index")
$node $native->can("get_index")
Truth table0%0/3
A and B
A= $nodeB= $native->can("get_index")
ABresult
0X0
100
111
2250 0 my ( $index ) = $native->get_index($node);
2251 0 ▶ $native->focusedItem($index) if defined $index and $index >= 0;
Branch: 1 branch
BranchTrueFalseTotal
if defined $index and $index >= 0 0 0 0
Condition0%0/3
defined $index and $index >= 0
!ll&&!rl&&r
000
MC/DC0%0/2
defined $index and $index >= 0
defined $index $index >= 0
Truth table0%0/3
A and B
A= defined $indexB= $index >= 0
ABresult
0X0
100
111
2252 }
2253 }
2254  
2255 0 ▶sub _tree_outline_focused_path {
Subroutine _tree_outline_focused_path: not called CC=7 SCAR=40.3
2256 0 my ( $tree, $native ) = @_;
2257  
2258 0 ▶ return [] if !defined $native or !$native->can('focusedItem');
Branch: 1 branch
BranchTrueFalseTotal
unless defined $native and $native->can("focusedItem") 0 0 0
Condition0%0/3
defined $native and $native->can("focusedItem")
!ll&&!rl&&r
000
MC/DC0%0/2
defined $native and $native->can("focusedItem")
defined $native $native->can("focusedItem")
Truth table0%0/3
A and B
A= defined $nativeB= $native->can("focusedItem")
ABresult
0X0
100
111
2259 0 my $index = $native->focusedItem;
2260 0 ▶ return [] if !defined $index or $index < 0;
Branch: 1 branch
BranchTrueFalseTotal
if not defined $index or $index < 0 0 0 0
Condition0%0/3
not defined $index or $index < 0
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $index or $index < 0
not defined $index $index < 0
Truth table0%0/3
not(A) or B
A= not defined $indexB= $index < 0
ABresult
1X1
011
000
2261 0 my ( $node ) = $native->get_item($index);
2262 0 ▶ return [] if !$node;
Branch: 1 branch
BranchTrueFalseTotal
unless $node 0 0 0
2263 0 ▶ return $tree->slots->{_native_path_by_node}{ refaddr($node) } // [];
Condition0%0/2
$tree->slots->{"_native_path_by_node"}{builtin::refaddr($node)} // []
l!l
00
MC/DC0%0/1
$tree->slots->{"_native_path_by_node"}{builtin::refaddr($node)} // []
$tree->slots->{"_native_path_by_node"}{builtin::refaddr($node)}
Truth table0%0/2
A
A= $tree->slots->{"_native_path_by_node"}{builtin::refaddr($node)}
Aresult
11
00
2264 }
2265  
2266 0 ▶sub _render_widget {
Subroutine _render_widget: not called CC=51 SCAR=78.8
2267 0 my ( $runtime, $parent, $widget, $parent_kind ) = @_;
2268  
2269 0 ▶ my $kind = $widget->slots->{_widget_type} // '';
Condition0%0/2
$widget->slots->{"_widget_type"} // ""
l!l
00
MC/DC0%0/1
$widget->slots->{"_widget_type"} // ""
$widget->slots->{"_widget_type"}
Truth table0%0/2
A
A= $widget->slots->{"_widget_type"}
Aresult
11
00
2270 0 ▶ return _insert_container( $runtime, $parent, $widget, $parent_kind, 'Widget' )
Branch: 1 branch
BranchTrueFalseTotal
if $kind eq "VBox" or $kind eq "HBox" 0 0 0
Condition0%0/3
$kind eq "VBox" or $kind eq "HBox"
l!l&&r!l&&!r
000
MC/DC0%0/2
$kind eq "VBox" or $kind eq "HBox"
$kind eq "VBox" $kind eq "HBox"
Truth table0%0/3
A or B
A= $kind eq "VBox"B= $kind eq "HBox"
ABresult
1X1
011
000
2271 if $kind eq 'VBox' or $kind eq 'HBox';
2272 return _insert_container(
2273 $runtime,
2274 $parent,
2275 $widget,
2276 $parent_kind,
2277 'GroupBox',
2278 0 ▶ text => $widget->slots->{_label} // '',
Branch: 1 branch
BranchTrueFalseTotal
if $kind eq "Frame" or $kind eq "RadioGroup" 0 0 0
Condition0%0/5
$kind eq "Frame" or $kind eq "RadioGroup"
l!l&&r!l&&!r
000
$widget->slots->{"_label"} // ""
l!l
00
MC/DC0%0/2
$kind eq "Frame" or $kind eq "RadioGroup"
$kind eq "Frame" $kind eq "RadioGroup"
MC/DC0%0/1
$widget->slots->{"_label"} // ""
$widget->slots->{"_label"}
Truth table0%0/3
A or B
A= $kind eq "Frame"B= $kind eq "RadioGroup"
ABresult
1X1
011
000
Truth table0%0/2
A
A= $widget->slots->{"_label"}
Aresult
11
00
2279 ) if $kind eq 'Frame' or $kind eq 'RadioGroup';
2280 0 ▶ return _render_tabs_widget( $runtime, $parent, $widget, $parent_kind )
Branch: 1 branch
BranchTrueFalseTotal
if $kind eq "Tabs" 0 0 0
2281 if $kind eq 'Tabs';
2282 return _insert_container(
2283 $runtime,
2284 $parent,
2285 $widget,
2286 $parent_kind,
2287 'GroupBox',
2288 0 ▶ text => $widget->slots->{_title} // '',
Branch: 1 branch
BranchTrueFalseTotal
if $kind eq "Tab" 0 0 0
Condition0%0/2
$widget->slots->{"_title"} // ""
l!l
00
MC/DC0%0/1
$widget->slots->{"_title"} // ""
$widget->slots->{"_title"}
Truth table0%0/2
A
A= $widget->slots->{"_title"}
Aresult
11
00
2289 ) if $kind eq 'Tab';
2290  
2291 0 ▶ if ( $kind eq 'Label' or $kind eq 'Text' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($kind eq "Label" or $kind eq "Text") 0 0 0
Condition0%0/3
$kind eq "Label" or $kind eq "Text"
l!l&&r!l&&!r
000
MC/DC0%0/2
$kind eq "Label" or $kind eq "Text"
$kind eq "Label" $kind eq "Text"
Truth table0%0/3
A or B
A= $kind eq "Label"B= $kind eq "Text"
ABresult
1X1
011
000
2292 my $native = $parent->insert(
2293 Label =>
2294 pack => _native_pack_for( $parent_kind, $widget ),
2295 font => _prima_font(),
2296 text => _native_text($widget) // '',
2297 wordWrap => 1,
2298 enabled => $widget->slots->{_enabled} ? 1 : 0,
2299 0 ▶ onMouseUp => sub { _emit_native_event( $runtime, $widget, 'click' ) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
2300 0 ▶ );
Branch: 1 branch
BranchTrueFalseTotal
$widget->slots->{'_enabled'} ? : 0 0 0
Condition0%0/2
_native_text($widget) // ""
l!l
00
MC/DC0%0/1
_native_text($widget) // ""
_native_text($widget)
Truth table0%0/2
A
A= _native_text($widget)
Aresult
11
00
2301 0 $widget->slots->{_native} = $native;
2302 0 return $native;
2303 }
2304  
2305 0 ▶ if ( $kind eq 'RichText' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($kind eq "RichText") 0 0 0
2306 my $native = $parent->insert(
2307 Label =>
2308 pack => _native_pack_for( $parent_kind, $widget ),
2309 font => _prima_font(),
2310 text => _native_rich_text($widget),
2311 wordWrap => 1,
2312 enabled => $widget->slots->{_enabled} ? 1 : 0,
2313 0 ▶ onMouseUp => sub { _emit_native_event( $runtime, $widget, 'click' ) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
2314 0 ▶ );
Branch: 1 branch
BranchTrueFalseTotal
$widget->slots->{'_enabled'} ? : 0 0 0
2315 0 $widget->slots->{_native} = $native;
2316 0 return $native;
2317 }
2318  
2319 0 ▶ return _render_image_widget( $runtime, $parent, $widget, $parent_kind )
Branch: 1 branch
BranchTrueFalseTotal
if $kind eq "Image" 0 0 0
2320 if $kind eq 'Image';
2321 0 ▶ return _render_separator_widget( $runtime, $parent, $widget, $parent_kind )
Branch: 1 branch
BranchTrueFalseTotal
if $kind eq "Separator" 0 0 0
2322 if $kind eq 'Separator';
2323  
2324 0 ▶ if ( $kind eq 'Slider' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($kind eq "Slider") 0 0 0
2325 my $native = $parent->insert(
2326 Slider =>
2327 pack => _native_pack_for( $parent_kind, $widget ),
2328 font => _prima_font(),
2329 min => int( $widget->slots->{_min} || 0 ),
2330 max => int( $widget->slots->{_max} || 100 ),
2331 value => int( $widget->slots->{_value} || 0 ),
2332 enabled => $widget->slots->{_enabled} ? 1 : 0,
2333 0 ▶ onChange => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
2334 0 ▶ return if $widget->slots->{_syncing_native};
Branch: 1 branch
BranchTrueFalseTotal
if $widget->slots->{"_syncing_native"} 0 0 0
2335 0 $widget->slots->{_value} = $_[0]->value;
2336 0 _emit_native_event( $runtime, $widget, 'input' );
2337 0 _emit_native_event( $runtime, $widget, 'change' );
2338 },
2339 0 ▶ );
Branch: 1 branch
BranchTrueFalseTotal
$widget->slots->{'_enabled'} ? : 0 0 0
Condition0%0/6
$widget->slots->{'_min'} || 0
l!l
00
$widget->slots->{'_max'} || 100
l!l
00
$widget->slots->{'_value'} || 0
l!l
00
MC/DC0%0/1
$widget->slots->{'_min'} || 0
$widget->slots->{'_min'}
MC/DC0%0/1
$widget->slots->{'_max'} || 100
$widget->slots->{'_max'}
MC/DC0%0/1
$widget->slots->{'_value'} || 0
$widget->slots->{'_value'}
Truth table0%0/2
A
A= $widget->slots->{'_min'}
Aresult
11
00
Truth table0%0/2
A
A= $widget->slots->{'_max'}
Aresult
11
00
Truth table0%0/2
A
A= $widget->slots->{'_value'}
Aresult
11
00
2340 0 $widget->slots->{_native} = $native;
2341 0 return $native;
2342 }
2343  
2344 0 ▶ if ( $kind eq 'Progress' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($kind eq "Progress") 0 0 0
2345 my $native = $parent->insert(
2346 Widget =>
2347 pack => _native_pack_for( $parent_kind, $widget ),
2348 font => _prima_font(),
2349 height => 28,
2350 enabled => $widget->slots->{_enabled} ? 1 : 0,
2351 0 ▶ onPaint => sub {
Subroutine __ANON__: not called CC=9 SCAR=45.0
2352 0 my ( $self, $canvas ) = @_;
2353 0 my ( $width, $height ) = $self->size;
2354 0 ▶ my $min = $widget->slots->{_min} || 0;
Condition0%0/2
$widget->slots->{'_min'} || 0
l!l
00
MC/DC0%0/1
$widget->slots->{'_min'} || 0
$widget->slots->{'_min'}
Truth table0%0/2
A
A= $widget->slots->{'_min'}
Aresult
11
00
2355 0 ▶ my $max = $widget->slots->{_max} || 100;
Condition0%0/2
$widget->slots->{'_max'} || 100
l!l
00
MC/DC0%0/1
$widget->slots->{'_max'} || 100
$widget->slots->{'_max'}
Truth table0%0/2
A
A= $widget->slots->{'_max'}
Aresult
11
00
2356 0 ▶ my $value = $widget->slots->{_value} || 0;
Condition0%0/2
$widget->slots->{'_value'} || 0
l!l
00
MC/DC0%0/1
$widget->slots->{'_value'} || 0
$widget->slots->{'_value'}
Truth table0%0/2
A
A= $widget->slots->{'_value'}
Aresult
11
00
2357 0 my $range = $max - $min;
2358 0 ▶ my $ratio = $range <= 0 ? 0 : ( $value - $min ) / $range;
Branch: 1 branch
BranchTrueFalseTotal
$range <= 0 ? : 0 0 0
2359 0 ▶ $ratio = 0 if $ratio < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $ratio < 0 0 0 0
2360 0 ▶ $ratio = 1 if $ratio > 1;
Branch: 1 branch
BranchTrueFalseTotal
if $ratio > 1 0 0 0
2361  
2362 0 $canvas->clear;
2363 0 $canvas->color(0xE6E6E6);
2364 0 $canvas->bar( 0, 0, $width, $height );
2365 0 $canvas->color(0x2D6CDF);
2366 0 $canvas->bar( 0, 0, int( $width * $ratio ), $height );
2367 0 $canvas->color(0x202020);
2368 0 $canvas->rectangle( 0, 0, $width - 1, $height - 1 );
2369 0 ▶ if ( $widget->slots->{_show_text} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($widget->slots->{"_show_text"}) 0 0 0
2370 0 my $text = int( $ratio * 100 ) . '%';
2371 0 $canvas->font( _prima_font() );
2372 0 my $tw = $canvas->get_text_width($text);
2373 0 ▶ my $th = ( $canvas->font->{height} || 12 );
Condition0%0/2
$canvas->font->{'height'} || 12
l!l
00
MC/DC0%0/1
$canvas->font->{'height'} || 12
$canvas->font->{'height'}
Truth table0%0/2
A
A= $canvas->font->{'height'}
Aresult
11
00
2374 0 $canvas->color(0xFFFFFF);
2375 0 $canvas->text_out(
2376 $text,
2377 int( ( $width - $tw ) / 2 ),
2378 int( ( $height - $th ) / 2 ),
2379 );
2380 }
2381 },
2382 0 ▶ );
Branch: 1 branch
BranchTrueFalseTotal
$widget->slots->{'_enabled'} ? : 0 0 0
2383 0 $widget->slots->{_native} = $native;
2384 0 return $native;
2385 }
2386  
2387 0 ▶ if ( $kind eq 'ListView' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($kind eq "ListView") 0 0 0
2388 my $native = $parent->insert(
2389 ListBox =>
2390 pack => _native_pack_for( $parent_kind, $widget ),
2391 font => _prima_font(),
2392 0 items => [ map { _item_label($_) }
2393 0 ▶ @{ $widget->slots->{_items}->items } ],
Branch: 2 branches
BranchTrueFalseTotal
$widget->slots->{'_multiple'} ? : 0 0 0
$widget->slots->{'_enabled'} ? : 0 0 0
2394 multiSelect => $widget->slots->{_multiple} ? 1 : 0,
2395 enabled => $widget->slots->{_enabled} ? 1 : 0,
2396 0 ▶ onClick => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
2397 0 ▶ return if $widget->slots->{_syncing_native};
Branch: 1 branch
BranchTrueFalseTotal
if $widget->slots->{"_syncing_native"} 0 0 0
2398 0 $widget->slots->{_selected_index} = $_[0]->focusedItem;
2399 0 _emit_native_event( $runtime, $widget, 'select' );
2400 },
2401 0 ▶ onMouseDblClk => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
2402 0 ▶ return if $widget->slots->{_syncing_native};
Branch: 1 branch
BranchTrueFalseTotal
if $widget->slots->{"_syncing_native"} 0 0 0
2403 0 $widget->slots->{_selected_index} = $_[0]->focusedItem;
2404 0 _emit_native_event( $runtime, $widget, 'activate' );
2405 },
2406 0 );
2407 0 $widget->slots->{_native} = $native;
2408 0 return $native;
2409 }
2410  
2411 0 ▶ if ( $kind eq 'TreeView' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($kind eq "TreeView") 0 0 0
2412 my $native = $parent->insert(
2413 StringOutline =>
2414 pack => _native_pack_for( $parent_kind, $widget ),
2415 font => _prima_font(),
2416 items => _tree_outline_items($widget),
2417 multiSelect => $widget->slots->{_multiple} ? 1 : 0,
2418 enabled => $widget->slots->{_enabled} ? 1 : 0,
2419 0 ▶ onSelectItem => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
2420 0 ▶ return if $widget->slots->{_syncing_native};
Branch: 1 branch
BranchTrueFalseTotal
if $widget->slots->{"_syncing_native"} 0 0 0
2421 0 my $path = _tree_outline_focused_path( $widget, $_[0] );
2422 0 $widget->slots->{_selected_path} = _zarray( @{ $path } );
2423 0 _emit_native_event( $runtime, $widget, 'select' );
2424 },
2425 0 ▶ onMouseDblClk => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
2426 0 ▶ return if $widget->slots->{_syncing_native};
Branch: 1 branch
BranchTrueFalseTotal
if $widget->slots->{"_syncing_native"} 0 0 0
2427 0 my $path = _tree_outline_focused_path( $widget, $_[0] );
2428 0 $widget->slots->{_selected_path} = _zarray( @{ $path } );
2429 0 _emit_native_event( $runtime, $widget, 'activate' );
2430 },
2431 0 ▶ onExpand => sub {
Subroutine __ANON__: not called CC=5 SCAR=34.0
2432 0 ▶ return if $widget->slots->{_syncing_native};
Branch: 1 branch
BranchTrueFalseTotal
if $widget->slots->{"_syncing_native"} 0 0 0
2433 0 my ( $native, $node, $action ) = @_;
2434 0 my $path = $widget->slots->{_native_path_by_node}{ refaddr($node) };
2435 0 ▶ return if !$path;
Branch: 1 branch
BranchTrueFalseTotal
unless $path 0 0 0
2436 0 my $key = _path_key($path);
2437 0 ▶ if ($action) {
Branch: 1 branch
BranchTrueFalseTotal
if ($action) { } 0 0 0
2438 0 $widget->slots->{_expanded_path_keys}{$key} = [ @{ $path } ];
2439 }
2440 else {
2441 0 delete $widget->slots->{_expanded_path_keys}{$key};
2442 }
2443 0 ▶ _emit_native_event(
Branch: 1 branch
BranchTrueFalseTotal
$action ? : 0 0 0
2444 $runtime,
2445 $widget,
2446 $action ? 'expand' : 'collapse',
2447 );
2448 },
2449 0 ▶ );
Branch: 2 branches
BranchTrueFalseTotal
$widget->slots->{'_multiple'} ? : 0 0 0
$widget->slots->{'_enabled'} ? : 0 0 0
2450 0 $widget->slots->{_native} = $native;
2451 0 _sync_tree_outline_selection($widget);
2452 0 return $native;
2453 }
2454  
2455 0 ▶ if ( $kind eq 'Input' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($kind eq "Input") 0 0 0
2456 my $native = $parent->insert(
2457 InputLine =>
2458 pack => _native_pack_for( $parent_kind, $widget ),
2459 font => _prima_font(),
2460 text => $widget->slots->{_value} // '',
2461 readOnly => $widget->slots->{_readonly} ? 1 : 0,
2462 enabled => $widget->slots->{_enabled} ? 1 : 0,
2463 0 ▶ onChange => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
2464 0 ▶ return if $widget->slots->{_syncing_native};
Branch: 1 branch
BranchTrueFalseTotal
if $widget->slots->{"_syncing_native"} 0 0 0
2465 0 $widget->slots->{_value} = $_[0]->text;
2466 0 _emit_native_event( $runtime, $widget, 'input' );
2467 0 _emit_native_event( $runtime, $widget, 'change' );
2468 },
2469 0 ▶ );
Branch: 2 branches
BranchTrueFalseTotal
$widget->slots->{'_readonly'} ? : 0 0 0
$widget->slots->{'_enabled'} ? : 0 0 0
Condition0%0/2
$widget->slots->{"_value"} // ""
l!l
00
MC/DC0%0/1
$widget->slots->{"_value"} // ""
$widget->slots->{"_value"}
Truth table0%0/2
A
A= $widget->slots->{"_value"}
Aresult
11
00
2470 0 $widget->slots->{_native} = $native;
2471 0 return $native;
2472 }
2473  
2474 0 ▶ if ( $kind eq 'DatePicker' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($kind eq "DatePicker") 0 0 0
2475 0 my ( $year, $month, $day ) = _date_parts( $widget->slots->{_value} );
2476 my $native = $parent->insert(
2477 'Widget::Date' =>
2478 pack => _native_pack_for( $parent_kind, $widget ),
2479 font => _prima_font(),
2480 format => 'YYYY-MM-DD',
2481 date => [ $day, $month - 1, $year - 1900 ],
2482 enabled => $widget->slots->{_enabled} ? 1 : 0,
2483 0 ▶ onChange => sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
2484 0 ▶ return if $widget->slots->{_syncing_native};
Branch: 1 branch
BranchTrueFalseTotal
if $widget->slots->{"_syncing_native"} 0 0 0
2485 0 my @date = $_[0]->date;
2486 0 my $value = _date_from_parts(
2487 $date[2] + 1900,
2488 $date[1] + 1,
2489 $date[0],
2490 );
2491 0 ▶ eval { _check_date_range( $widget, $value ); 1 } or return;
Branch: 1 branch
BranchTrueFalseTotal
eval { do { _check_date_range($widget, $value); 1 } } or return 0 0 0
2492 0 $widget->slots->{_value} = $value;
2493 0 _emit_native_event( $runtime, $widget, 'change' );
2494 },
2495 0 ▶ );
Branch: 1 branch
BranchTrueFalseTotal
$widget->slots->{'_enabled'} ? : 0 0 0
2496 0 $widget->slots->{_native} = $native;
2497 0 return $native;
2498 }
2499  
2500 0 ▶ if ( $kind eq 'Checkbox' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($kind eq "Checkbox") 0 0 0
2501 my $native = $parent->insert(
2502 CheckBox =>
2503 pack => _native_pack_for( $parent_kind, $widget ),
2504 font => _prima_font(),
2505 text => $widget->slots->{_label} // '',
2506 checked => $widget->slots->{_checked} ? 1 : 0,
2507 enabled => $widget->slots->{_enabled} ? 1 : 0,
2508 0 ▶ onCheck => sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
2509 0 ▶ return if $widget->slots->{_syncing_native};
Branch: 1 branch
BranchTrueFalseTotal
if $widget->slots->{"_syncing_native"} 0 0 0
2510 0 ▶ $widget->slots->{_checked} = $_[0]->checked ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$_[0]->checked ? : 0 0 0
2511 0 _emit_native_event( $runtime, $widget, 'change' );
2512 },
2513 0 ▶ );
Branch: 2 branches
BranchTrueFalseTotal
$widget->slots->{'_checked'} ? : 0 0 0
$widget->slots->{'_enabled'} ? : 0 0 0
Condition0%0/2
$widget->slots->{"_label"} // ""
l!l
00
MC/DC0%0/1
$widget->slots->{"_label"} // ""
$widget->slots->{"_label"}
Truth table0%0/2
A
A= $widget->slots->{"_label"}
Aresult
11
00
2514 0 $widget->slots->{_native} = $native;
2515 0 return $native;
2516 }
2517  
2518 0 ▶ if ( $kind eq 'Radio' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($kind eq "Radio") 0 0 0
2519 my $native = $parent->insert(
2520 Radio =>
2521 pack => _native_pack_for( $parent_kind, $widget ),
2522 font => _prima_font(),
2523 text => $widget->slots->{_label} // '',
2524 checked => $widget->slots->{_checked} ? 1 : 0,
2525 enabled => $widget->slots->{_enabled} ? 1 : 0,
2526 0 ▶ onClick => sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
2527 0 ▶ return if $widget->slots->{_syncing_native};
Branch: 1 branch
BranchTrueFalseTotal
if $widget->slots->{"_syncing_native"} 0 0 0
2528 0 _set_radio_checked( $widget, 1 );
2529 0 _emit_native_event( $runtime, $widget, 'change' );
2530 0 my $group = _nearest_radio_group($widget);
2531 0 ▶ _emit_native_event( $runtime, $group, 'change' ) if $group;
Branch: 1 branch
BranchTrueFalseTotal
if $group 0 0 0
2532 },
2533 0 ▶ );
Branch: 2 branches
BranchTrueFalseTotal
$widget->slots->{'_checked'} ? : 0 0 0
$widget->slots->{'_enabled'} ? : 0 0 0
Condition0%0/2
$widget->slots->{"_label"} // ""
l!l
00
MC/DC0%0/1
$widget->slots->{"_label"} // ""
$widget->slots->{"_label"}
Truth table0%0/2
A
A= $widget->slots->{"_label"}
Aresult
11
00
2534 0 $widget->slots->{_native} = $native;
2535 0 return $native;
2536 }
2537  
2538 0 ▶ if ( $kind eq 'Select' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($kind eq "Select") 0 0 0
2539 my $native = $parent->insert(
2540 ComboBox =>
2541 pack => _native_pack_for( $parent_kind, $widget ),
2542 font => _prima_font(),
2543 items => _option_labels($widget),
2544 text => defined $widget->slots->{_value}
2545 ? '' . $widget->slots->{_value}
2546 : '',
2547 enabled => $widget->slots->{_enabled} ? 1 : 0,
2548 0 ▶ onChange => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
2549 0 ▶ return if $widget->slots->{_syncing_native};
Branch: 1 branch
BranchTrueFalseTotal
if $widget->slots->{"_syncing_native"} 0 0 0
2550 0 $widget->slots->{_value} = _option_value_from_label(
2551 $widget,
2552 $_[0]->text,
2553 );
2554 0 _emit_native_event( $runtime, $widget, 'change' );
2555 },
2556 0 ▶ );
Branch: 2 branches
BranchTrueFalseTotal
defined $widget->slots->{'_value'} ? : 0 0 0
$widget->slots->{'_enabled'} ? : 0 0 0
2557 0 $widget->slots->{_native} = $native;
2558 0 return $native;
2559 }
2560  
2561 0 ▶ if ( $kind eq 'Button' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($kind eq "Button") 0 0 0
2562 my $native = $parent->insert(
2563 Button =>
2564 pack => _native_pack_for( $parent_kind, $widget ),
2565 font => _prima_font(),
2566 text => $widget->slots->{_text} // '',
2567 enabled => $widget->slots->{_enabled} ? 1 : 0,
2568 _native_geometry_args($widget),
2569 0 ▶ onClick => sub { _emit_native_event( $runtime, $widget, 'click' ) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
2570 0 ▶ );
Branch: 1 branch
BranchTrueFalseTotal
$widget->slots->{'_enabled'} ? : 0 0 0
Condition0%0/2
$widget->slots->{"_text"} // ""
l!l
00
MC/DC0%0/1
$widget->slots->{"_text"} // ""
$widget->slots->{"_text"}
Truth table0%0/2
A
A= $widget->slots->{"_text"}
Aresult
11
00
2571 0 $widget->slots->{_native} = $native;
2572 0 return $native;
2573 }
2574  
2575 0 return _insert_container( $runtime, $parent, $widget, $parent_kind, 'Widget' );
2576 }
2577  
2578 3 my $MENU_ITEM_SEQ = 0;
2579  
2580 2 ▶sub _menu_widgets {
Subroutine _menu_widgets: called CC=1 SCAR=0.2
2581 2 my ( $window ) = @_;
2582  
2583 0 return grep { _class_name($_) eq 'Menu' }
2584 2 @{ $window->slots->{_children}->items };
2585 }
2586  
2587 0 ▶sub _menu_item_name {
Subroutine _menu_item_name: not called CC=2 SCAR=17.9
2588 0 my ( $item ) = @_;
2589  
2590 0 ▶ $item->slots->{_native_menu_name} //= 'zuzu_menu_item_' . ++$MENU_ITEM_SEQ;
Condition0%0/2
$item->slots->{"_native_menu_name"} //= 'zuzu_menu_item_' . ++$MENU_ITEM_SEQ
l!l
00
MC/DC0%0/1
$item->slots->{"_native_menu_name"} //= 'zuzu_menu_item_' . ++$MENU_ITEM_SEQ
$item->slots->{"_native_menu_name"}
Truth table0%0/2
A
A= $item->slots->{"_native_menu_name"}
Aresult
11
00
2591 0 return $item->slots->{_native_menu_name};
2592 }
2593  
2594 0 ▶sub _prima_menu_item {
Subroutine _prima_menu_item: not called CC=3 SCAR=24.8
2595 0 my ( $runtime, $item ) = @_;
2596  
2597 0 my $name = _menu_item_name($item);
2598 0 ▶ $name = '-' . $name if !$item->slots->{_enabled};
Branch: 1 branch
BranchTrueFalseTotal
unless $item->slots->{"_enabled"} 0 0 0
2599 return [
2600 $name,
2601 $item->slots->{_text} // '',
2602 0 ▶ sub { _emit_native_event( $runtime, $item, 'click' ) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
2603 0 ▶ ];
Condition0%0/2
$item->slots->{"_text"} // ""
l!l
00
MC/DC0%0/1
$item->slots->{"_text"} // ""
$item->slots->{"_text"}
Truth table0%0/2
A
A= $item->slots->{"_text"}
Aresult
11
00
2604 }
2605  
2606 2 ▶sub _prima_window_menu_items {
Subroutine _prima_window_menu_items: called CC=3 SCAR=16.0
2607 2 my ( $runtime, $window ) = @_;
2608  
2609 2 my @menus;
2610 2 for my $menu ( _menu_widgets($window) ) {
2611 push @menus, [
2612 $menu->slots->{_text} // '',
2613 [
2614 0 map { _prima_menu_item( $runtime, $_ ) }
2615 0 grep { _class_name($_) eq 'MenuItem' }
2616 0 ▶ @{ $menu->slots->{_children}->items },
Condition0%0/2
$menu->slots->{"_text"} // ""
l!l
00
MC/DC0%0/1
$menu->slots->{"_text"} // ""
$menu->slots->{"_text"}
Truth table0%0/2
A
A= $menu->slots->{"_text"}
Aresult
11
00
2617 ],
2618 ];
2619 }
2620 2 return @menus;
2621 }
2622  
2623 0 ▶sub _bind_native_menu_items {
Subroutine _bind_native_menu_items: not called CC=5 SCAR=34.0
2624 0 my ( $window, $native_menu ) = @_;
2625  
2626 0 ▶ return if !defined $native_menu;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $native_menu 0 0 0
2627 0 for my $menu ( _menu_widgets($window) ) {
2628 0 for my $item ( @{ $menu->slots->{_children}->items } ) {
2629 0 ▶ next if _class_name($item) ne 'MenuItem';
Branch: 1 branch
BranchTrueFalseTotal
if _class_name($item) ne "MenuItem" 0 0 0
2630 0 $item->slots->{_native_menu_owner} = $native_menu;
2631 }
2632 }
2633 0 return;
2634 }
2635  
2636 2 ▶sub _ensure_prima_window {
Subroutine _ensure_prima_window: called CC=9 SCAR=26.9
2637 2 my ( $runtime, $window ) = @_;
2638  
2639 2 ▶ return $window->slots->{_native} if _has_native($window);
Branch: 1 branch
BranchTrueFalseTotal
if _has_native($window) 0 2 2
2640  
2641 2 _load_prima_backend();
2642 2 my @menu_items = _prima_window_menu_items( $runtime, $window );
2643 my %args = (
2644 text => $window->slots->{_title} // '',
2645 font => _prima_font(),
2646 width => int( $window->slots->{_width} || 800 ),
2647 height => int( $window->slots->{_height} || 600 ),
2648 centered => 1,
2649 0 ▶ onSize => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
2650 0 my ( $self ) = @_;
2651 0 my ( $width, $height ) = $self->size;
2652 0 $window->slots->{_width} = $width;
2653 0 $window->slots->{_height} = $height;
2654 0 _emit_native_event( $runtime, $window, 'resize' );
2655 },
2656 2 ▶ onClose => sub {
Subroutine __ANON__: called CC=3 SCAR=11.7
2657 2 ▶ return if $window->slots->{_native_closing};
Branch: 1 branch
BranchTrueFalseTotal
if $window->slots->{"_native_closing"} 0 2 2
2658 2 _close_window( $runtime, $window, undef, 1 );
2659 2 ▶ return $window->slots->{_closed} ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$window->slots->{'_closed'} ? : 2 0 2
2660 },
2661 2 ▶ onDestroy => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
2662 2 _clear_native_refs($window);
2663 },
2664 2 ▶ );
Condition50%3/6
$window->slots->{"_title"} // ""
l!l
20
$window->slots->{'_width'} || 800
l!l
20
$window->slots->{'_height'} || 600
l!l
20
MC/DC0%0/1
$window->slots->{"_title"} // ""
$window->slots->{"_title"}
MC/DC0%0/1
$window->slots->{'_width'} || 800
$window->slots->{'_width'}
MC/DC0%0/1
$window->slots->{'_height'} || 600
$window->slots->{'_height'}
Truth table50%1/2
A
A= $window->slots->{"_title"}
Aresult
11
00
Truth table50%1/2
A
A= $window->slots->{'_width'}
Aresult
11
00
Truth table50%1/2
A
A= $window->slots->{'_height'}
Aresult
11
00
2665 2 ▶ $args{menuItems} = \@menu_items if @menu_items;
Branch: 1 branch
BranchTrueFalseTotal
if @menu_items 0 2 2
2666 2 my $native = Prima::Window->new(%args);
2667 2 $window->slots->{_native} = $native;
2668 2 ▶ _bind_native_menu_items( $window, $native->menu ) if @menu_items;
Branch: 1 branch
BranchTrueFalseTotal
if @menu_items 0 2 2
2669 2 for my $child ( @{ $window->slots->{_children}->items } ) {
2670 0 ▶ next if _class_name($child) eq 'Menu';
Branch: 1 branch
BranchTrueFalseTotal
if _class_name($child) eq "Menu" 0 0 0
2671 0 _render_widget( $runtime, $native, $child, 'Window' );
2672 }
2673 2 return $native;
2674 }
2675  
2676 2 ▶sub _show_prima_window {
Subroutine _show_prima_window: called CC=2 SCAR=7.0
2677 2 my ( $runtime, $window ) = @_;
2678  
2679 2 my $native = _ensure_prima_window( $runtime, $window );
2680 2 ▶ $native->show if $native->can('show');
Branch: 1 branch
BranchTrueFalseTotal
if $native->can("show") 2 0 2
2681 2 $window->slots->{_shown} = 1;
2682 2 _emit_native_event( $runtime, $window, 'open' );
2683 2 return $window;
2684 }
2685  
2686 7 ▶sub IMPORT {
Subroutine IMPORT: called CC=5 SCAR=26.9
Pod undocumented
2687 7 my ( $class, $runtime ) = @_;
2688  
2689 7 $runtime->assert_capability(
2690 'gui',
2691 'std/gui/objects is denied by runtime policy',
2692 '<std/gui/objects>',
2693 0,
2694 );
2695  
2696 7 my $widget_class = native_class( name => 'Widget' );
2697 7 my $window_class = native_class( name => 'Window', parent => $widget_class );
2698 7 my $vbox_class = native_class( name => 'VBox', parent => $widget_class );
2699 7 my $hbox_class = native_class( name => 'HBox', parent => $widget_class );
2700 7 my $frame_class = native_class( name => 'Frame', parent => $widget_class );
2701 7 my $label_class = native_class( name => 'Label', parent => $widget_class );
2702 7 my $text_class = native_class( name => 'Text', parent => $widget_class );
2703 7 my $rich_text_class = native_class(
2704 name => 'RichText',
2705 parent => $widget_class,
2706 );
2707 7 my $image_class = native_class( name => 'Image', parent => $widget_class );
2708 7 my $input_class = native_class( name => 'Input', parent => $widget_class );
2709 7 my $date_picker_class = native_class(
2710 name => 'DatePicker',
2711 parent => $widget_class,
2712 );
2713 7 my $checkbox_class = native_class(
2714 name => 'Checkbox',
2715 parent => $widget_class,
2716 );
2717 7 my $radio_class = native_class( name => 'Radio', parent => $widget_class );
2718 7 my $radio_group_class = native_class(
2719 name => 'RadioGroup',
2720 parent => $widget_class,
2721 );
2722 7 my $select_class = native_class( name => 'Select', parent => $widget_class );
2723 7 my $menu_class = native_class( name => 'Menu', parent => $widget_class );
2724 7 my $menu_item_class = native_class(
2725 name => 'MenuItem',
2726 parent => $widget_class,
2727 );
2728 7 my $button_class = native_class( name => 'Button', parent => $widget_class );
2729 7 my $separator_class = native_class(
2730 name => 'Separator',
2731 parent => $widget_class,
2732 );
2733 7 my $slider_class = native_class( name => 'Slider', parent => $widget_class );
2734 7 my $progress_class = native_class(
2735 name => 'Progress',
2736 parent => $widget_class,
2737 );
2738 7 my $tabs_class = native_class( name => 'Tabs', parent => $widget_class );
2739 7 my $tab_class = native_class( name => 'Tab', parent => $widget_class );
2740 7 my $list_view_class = native_class(
2741 name => 'ListView',
2742 parent => $widget_class,
2743 );
2744 7 my $tree_view_class = native_class(
2745 name => 'TreeView',
2746 parent => $widget_class,
2747 );
2748 7 my $event_class = native_class( name => 'Event' );
2749 7 my $listener_token_class = native_class( name => 'ListenerToken' );
2750 7 $runtime->{_gui_event_class} = $event_class;
2751  
2752 7 _add_event_methods( $event_class );
2753 7 _add_widget_methods(
2754 $runtime,
2755 $widget_class,
2756 $event_class,
2757 $listener_token_class,
2758 );
2759  
2760 7 $widget_class->native_constructor( _widget_constructor(
2761 'Widget',
2762 'Widget',
2763 [],
2764 undef,
2765 ) );
2766  
2767 $window_class->native_constructor( _widget_constructor(
2768 'Window',
2769 'Window',
2770 [ qw( title width height resizable modal content ) ],
2771 2 ▶ sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
2772 2 my ( $slots, $named ) = @_;
2773 2 $slots->{_title} = _string_prop( $named, 'title', '' );
2774 2 $slots->{_width} = _number_prop( $named, 'width', 800 );
2775 2 $slots->{_height} = _number_prop( $named, 'height', 600 );
2776 2 $slots->{_resizable} = _bool_prop( $named, 'resizable', 1 );
2777 2 $slots->{_modal} = _bool_prop( $named, 'modal', 0 );
2778 2 $slots->{_shown} = 0;
2779 2 $slots->{_closed} = 0;
2780 2 $slots->{_close_result} = undef;
2781 2 $slots->{_content} = undef;
2782 },
2783 7 ) );
2784 $window_class->methods->{show} = native_function(
2785 name => 'show',
2786 0 ▶ native => sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
2787 0 my ( $self ) = @_;
2788 0 my $opened = 0;
2789 eval {
2790 0 _show_prima_window( $runtime, $self );
2791 0 $opened = 1;
2792 0 1;
2793 0 ▶ } or do {
Branch: 1 branch
BranchTrueFalseTotal
eval { do { _show_prima_window($runtime, $self); $opened = 1; 1 } } or do { $self->slots->{"_backend_error"} = "$@" } 0 0 0
2794 0 $self->slots->{_backend_error} = "$@";
2795 };
2796 0 $self->slots->{_shown} = 1;
2797 0 ▶ _dispatch_named_event( $runtime, $self, 'open' ) if !$opened;
Branch: 1 branch
BranchTrueFalseTotal
unless $opened 0 0 0
2798 0 return $self;
2799 },
2800 7 );
2801 $window_class->methods->{call} = native_function(
2802 name => 'call',
2803 2 ▶ native => sub {
Subroutine __ANON__: called CC=7 SCAR=20.9
2804 2 my ( $self ) = @_;
2805 2 ▶ return $self->slots->{_close_result} if $self->slots->{_closed};
Branch: 1 branch
BranchTrueFalseTotal
if $self->slots->{"_closed"} 0 2 2
2806 2 ▶ if ( !_has_native($self) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (_has_native($self)) 2 0 2
2807 eval {
2808 2 _show_prima_window( $runtime, $self );
2809 2 1;
2810 2 ▶ } or do {
Branch: 1 branch
BranchTrueFalseTotal
eval { do { _show_prima_window($runtime, $self); 1 } } or do { die $@ } 2 0 2
2811 0 die $@;
2812 };
2813 }
2814 2 $self->slots->{_shown} = 1;
2815 2 ▶ return $self->slots->{_close_result} if $self->slots->{_closed};
Branch: 1 branch
BranchTrueFalseTotal
if $self->slots->{"_closed"} 0 2 2
2816 2 ▶ if ($PRIMA_READY) {
Branch: 1 branch
BranchTrueFalseTotal
if ($PRIMA_READY) 2 0 2
2817 2 local $self->slots->{_call_running} = 1;
2818 2 ▶ Prima->run if !$self->slots->{_closed};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->slots->{"_closed"} 2 0 2
2819 }
2820 2 return $self->slots->{_close_result};
2821 },
2822 7 );
2823 $window_class->methods->{close} = native_function(
2824 name => 'close',
2825 0 ▶ native => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
2826 0 my ( $self, @args ) = @_;
2827 0 ▶ return _close_window(
Branch: 1 branch
BranchTrueFalseTotal
@args ? : 0 0 0
2828 $runtime,
2829 $self,
2830 @args ? $args[0] : undef,
2831 0,
2832 );
2833 },
2834 7 );
2835 $window_class->methods->{content} = native_function(
2836 name => 'content',
2837 0 ▶ native => sub { return $_[0]->slots->{_content}; },
Subroutine __ANON__: not called CC=1 SCAR=6.9
2838 7 );
2839 $window_class->methods->{menus} = native_function(
2840 name => 'menus',
2841 0 ▶ native => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
2842 0 my ( $self ) = @_;
2843 0 return _zarray( _menu_widgets($self) );
2844 },
2845 7 );
2846 $window_class->methods->{set_content} = native_function(
2847 name => 'set_content',
2848 0 ▶ native => sub {
Subroutine __ANON__: not called CC=9 SCAR=45.0
2849 0 my ( $self, $child ) = @_;
2850 0 ▶ _runtime_error(
Branch: 1 branch
BranchTrueFalseTotal
if defined $child and !_is_widget($child) || _is_menu_kind($child) 0 0 0
Condition0%0/6
defined $child and !_is_widget($child) || _is_menu_kind($child)
!ll&&!rl&&r
000
not _is_widget($child) or _is_menu_kind($child)
l!l&&r!l&&!r
000
MC/DC0%0/3
defined $child and !_is_widget($child) || _is_menu_kind($child)
defined $child not _is_widget($child) _is_menu_kind($child)
Truth table0%0/4
A and not(B) or C
A= defined $childB= not _is_widget($child)C= _is_menu_kind($child)
ABCresult
0XX0
1000
11X1
1011
2851 'GUI_PROP_TYPE',
2852 'set_content expects a non-menu Widget or null',
2853 ) if defined $child and ( !_is_widget($child) or _is_menu_kind($child) );
2854 0 my @menus;
2855 0 for my $old ( @{ $self->slots->{_children}->items } ) {
2856 0 ▶ if ( _class_name($old) eq 'Menu' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (_class_name($old) eq "Menu") 0 0 0
2857 0 push @menus, $old;
2858 0 next;
2859 }
2860 0 ▶ _set_parent( $old, undef )
Branch: 1 branch
BranchTrueFalseTotal
if defined _parent($old) and _parent($old) == $self 0 0 0
Condition0%0/3
defined _parent($old) and _parent($old) == $self
!ll&&!rl&&r
000
MC/DC0%0/2
defined _parent($old) and _parent($old) == $self
defined _parent($old) _parent($old) == $self
Truth table0%0/3
A and B
A= defined _parent($old)B= _parent($old) == $self
ABresult
0X0
100
111
2861 if defined _parent($old)
2862 and _parent($old) == $self;
2863 }
2864 0 $self->slots->{_children}->items( \@menus );
2865 0 $self->slots->{_content} = $child;
2866 0 ▶ _adopt_child( $self, $child ) if defined $child;
Branch: 1 branch
BranchTrueFalseTotal
if defined $child 0 0 0
2867 0 return $self;
2868 },
2869 7 );
2870 7 _add_text_methods( $window_class, '_title', 'title', 'set_title' );
2871  
2872 7 for my $spec (
2873 0 ▶ [ $vbox_class, 'VBox', 'VBox', [ qw( align gap padding ) ], sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
2874 0 my ( $slots, $named ) = @_;
2875 0 $slots->{_align} = _enum_prop(
2876 'VBox',
2877 $named,
2878 'align',
2879 'top',
2880 qw( top centre bottom stretch ),
2881 );
2882 0 $slots->{_gap} = _number_prop( $named, 'gap', 0 );
2883 $slots->{_padding} = exists $named->{padding}
2884 ? $named->{padding}
2885 0 ▶ : 0;
Branch: 1 branch
BranchTrueFalseTotal
exists $named->{'padding'} ? : 0 0 0
2886 } ],
2887 0 ▶ [ $hbox_class, 'HBox', 'HBox', [ qw( align gap padding ) ], sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
2888 0 my ( $slots, $named ) = @_;
2889 0 $slots->{_align} = _enum_prop(
2890 'HBox',
2891 $named,
2892 'align',
2893 'left',
2894 qw( left centre right stretch ),
2895 );
2896 0 $slots->{_gap} = _number_prop( $named, 'gap', 0 );
2897 $slots->{_padding} = exists $named->{padding}
2898 ? $named->{padding}
2899 0 ▶ : 0;
Branch: 1 branch
BranchTrueFalseTotal
exists $named->{'padding'} ? : 0 0 0
2900 } ],
2901 [ $frame_class, 'Frame', 'Frame',
2902 0 ▶ [ qw( label collapsible collapsed ) ], sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
2903 0 my ( $slots, $named ) = @_;
2904 0 $slots->{_label} = _string_prop( $named, 'label', '' );
2905 0 $slots->{_collapsible} = _bool_prop( $named, 'collapsible', 0 );
2906 0 $slots->{_collapsed} = _bool_prop( $named, 'collapsed', 0 );
2907 } ],
2908 0 ▶ [ $label_class, 'Label', 'Label', [ qw( text for ) ], sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
2909 0 my ( $slots, $named ) = @_;
2910 0 $slots->{_text} = _string_prop( $named, 'text', '' );
2911 0 $slots->{_for} = _string_prop( $named, 'for', undef );
2912 } ],
2913 0 ▶ [ $text_class, 'Text', 'Text', [ qw( value multiline readonly wrap ) ], sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
2914 0 my ( $slots, $named ) = @_;
2915 0 $slots->{_value} = _string_prop( $named, 'value', '' );
2916 0 $slots->{_multiline} = _bool_prop( $named, 'multiline', 0 );
2917 0 $slots->{_readonly} = _bool_prop( $named, 'readonly', 0 );
2918 0 $slots->{_wrap} = _bool_prop( $named, 'wrap', 1 );
2919 } ],
2920 [ $rich_text_class, 'RichText', 'RichText',
2921 0 ▶ [ qw( value multiline readonly ) ], sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
2922 0 my ( $slots, $named ) = @_;
2923 0 $slots->{_value} = _string_prop( $named, 'value', '' );
2924 0 $slots->{_multiline} = _bool_prop( $named, 'multiline', 1 );
2925 0 $slots->{_readonly} = _bool_prop( $named, 'readonly', 1 );
2926 } ],
2927 0 ▶ [ $image_class, 'Image', 'Image', [ qw( src alt fit ) ], sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
2928 0 my ( $slots, $named ) = @_;
2929 0 $slots->{_src} = _string_prop( $named, 'src', '' );
2930 0 $slots->{_alt} = _string_prop( $named, 'alt', '' );
2931 0 $slots->{_fit} = _enum_prop(
2932 'Image',
2933 $named,
2934 'fit',
2935 'none',
2936 qw( none contain cover stretch ),
2937 );
2938 } ],
2939 [ $input_class, 'Input', 'Input',
2940 0 ▶ [ qw( value placeholder multiline readonly password required ) ], sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
2941 0 my ( $slots, $named ) = @_;
2942 0 $slots->{_value} = _string_prop( $named, 'value', '' );
2943 0 $slots->{_placeholder} = _string_prop( $named, 'placeholder', '' );
2944 0 $slots->{_multiline} = _bool_prop( $named, 'multiline', 0 );
2945 0 $slots->{_readonly} = _bool_prop( $named, 'readonly', 0 );
2946 0 $slots->{_password} = _bool_prop( $named, 'password', 0 );
2947 0 $slots->{_required} = _bool_prop( $named, 'required', 0 );
2948 } ],
2949 [ $date_picker_class, 'DatePicker', 'DatePicker',
2950 0 ▶ [ qw( value min max first_day_of_week ) ], sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
2951 0 my ( $slots, $named ) = @_;
2952 $slots->{_value} =
2953 0 ▶ _date_prop( $named, 'value', _today_date() ) // _today_date();
Condition0%0/3
_date_prop($named, "value", _today_date()) // _today_date()
l!l&&r!l&&!r
000
MC/DC0%0/2
_date_prop($named, "value", _today_date()) // _today_date()
_date_prop($named, "value", _today_date()) _today_date()
Truth table0%0/3
A // B
A= _date_prop($named, "value", _today_date())B= _today_date()
ABresult
1X1
011
000
2954 0 $slots->{_min} = _date_prop( $named, 'min', undef );
2955 0 $slots->{_max} = _date_prop( $named, 'max', undef );
2956 0 $slots->{_first_day_of_week} = _weekday_prop(
2957 $named,
2958 'first_day_of_week',
2959 0,
2960 );
2961 0 _check_date_range_slots( $slots, $slots->{_value} );
2962 } ],
2963 [ $checkbox_class, 'Checkbox', 'Checkbox',
2964 0 ▶ [ qw( label checked indeterminate ) ], sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
2965 0 my ( $slots, $named ) = @_;
2966 0 $slots->{_label} = _string_prop( $named, 'label', '' );
2967 0 $slots->{_checked} = _bool_prop( $named, 'checked', 0 );
2968 0 $slots->{_indeterminate} = _bool_prop(
2969 $named,
2970 'indeterminate',
2971 0,
2972 );
2973 } ],
2974 0 ▶ [ $radio_class, 'Radio', 'Radio', [ qw( label value group checked ) ], sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
2975 0 my ( $slots, $named ) = @_;
2976 0 $slots->{_label} = _string_prop( $named, 'label', '' );
2977 0 $slots->{_value} = _string_prop( $named, 'value', '' );
2978 0 $slots->{_group} = _string_prop( $named, 'group', undef );
2979 0 $slots->{_checked} = _bool_prop( $named, 'checked', 0 );
2980 } ],
2981 0 ▶ [ $radio_group_class, 'RadioGroup', 'RadioGroup', [ qw( name value ) ], sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
2982 0 my ( $slots, $named ) = @_;
2983 0 $slots->{_name} = _string_prop( $named, 'name', '' );
2984 0 $slots->{_value} = _string_prop( $named, 'value', undef );
2985 } ],
2986 0 ▶ [ $select_class, 'Select', 'Select', [ qw( value options multiple ) ], sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
2987 0 my ( $slots, $named ) = @_;
2988 0 ▶ $slots->{_value} = exists $named->{value} ? $named->{value} : undef;
Branch: 1 branch
BranchTrueFalseTotal
exists $named->{'value'} ? : 0 0 0
2989 0 $slots->{_options} = _array_prop( $named, 'options', _zarray() );
2990 0 $slots->{_multiple} = _bool_prop( $named, 'multiple', 0 );
2991 } ],
2992 0 ▶ [ $menu_class, 'Menu', 'Menu', [ qw( text ) ], sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
2993 0 my ( $slots, $named ) = @_;
2994 0 $slots->{_text} = _string_prop( $named, 'text', '' );
2995 } ],
2996 0 ▶ [ $menu_item_class, 'MenuItem', 'MenuItem', [ qw( text ) ], sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
2997 0 my ( $slots, $named ) = @_;
2998 0 $slots->{_text} = _string_prop( $named, 'text', '' );
2999 0 $slots->{_native_menu_name} = undef;
3000 0 $slots->{_native_menu_owner} = undef;
3001 } ],
3002 0 ▶ [ $button_class, 'Button', 'Button', [ qw( text variant ) ], sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
3003 0 my ( $slots, $named ) = @_;
3004 0 $slots->{_text} = _string_prop( $named, 'text', '' );
3005 0 $slots->{_variant} = _enum_prop(
3006 'Button',
3007 $named,
3008 'variant',
3009 'default',
3010 qw( default primary danger ),
3011 );
3012 } ],
3013 [ $separator_class, 'Separator', 'Separator',
3014 0 ▶ [ qw( orientation ) ], sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
3015 0 my ( $slots, $named ) = @_;
3016 0 $slots->{_orientation} = _enum_prop(
3017 'Separator',
3018 $named,
3019 'orientation',
3020 'horizontal',
3021 qw( horizontal vertical ),
3022 );
3023 } ],
3024 [ $slider_class, 'Slider', 'Slider',
3025 0 ▶ [ qw( value min max step orientation readonly ) ], sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
3026 0 my ( $slots, $named ) = @_;
3027 0 $slots->{_value} = _number_prop( $named, 'value', 0 );
3028 0 $slots->{_min} = _number_prop( $named, 'min', 0 );
3029 0 $slots->{_max} = _number_prop( $named, 'max', 100 );
3030 0 $slots->{_step} = _number_prop( $named, 'step', 1 );
3031 0 $slots->{_orientation} = _enum_prop(
3032 'Slider',
3033 $named,
3034 'orientation',
3035 'horizontal',
3036 qw( horizontal vertical ),
3037 );
3038 0 $slots->{_readonly} = _bool_prop( $named, 'readonly', 0 );
3039 } ],
3040 [ $progress_class, 'Progress', 'Progress',
3041 0 ▶ [ qw( value min max indeterminate show_text ) ], sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
3042 0 my ( $slots, $named ) = @_;
3043 0 $slots->{_value} = _number_prop( $named, 'value', 0 );
3044 0 $slots->{_min} = _number_prop( $named, 'min', 0 );
3045 0 $slots->{_max} = _number_prop( $named, 'max', 100 );
3046 0 $slots->{_indeterminate} = _bool_prop(
3047 $named,
3048 'indeterminate',
3049 0,
3050 );
3051 0 $slots->{_show_text} = _bool_prop( $named, 'show_text', 0 );
3052 } ],
3053 [ $tabs_class, 'Tabs', 'Tabs',
3054 0 ▶ [ qw( selected value placement ) ], sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
3055 0 my ( $slots, $named ) = @_;
3056 $slots->{_selected} = exists $named->{selected}
3057 0 ▶ ? _string_prop( $named, 'selected', undef )
Branch: 1 branch
BranchTrueFalseTotal
exists $named->{'selected'} ? : 0 0 0
3058 : _string_prop( $named, 'value', undef );
3059 0 $slots->{_placement} = _enum_prop(
3060 'Tabs',
3061 $named,
3062 'placement',
3063 'top',
3064 qw( top bottom left right ),
3065 );
3066 } ],
3067 [ $tab_class, 'Tab', 'Tab',
3068 0 ▶ [ qw( title value selected closable icon ) ], sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
3069 0 my ( $slots, $named ) = @_;
3070 0 $slots->{_title} = _string_prop( $named, 'title', '' );
3071 0 $slots->{_value} = _string_prop( $named, 'value', '' );
3072 0 $slots->{_selected} = _bool_prop( $named, 'selected', 0 );
3073 0 $slots->{_closable} = _bool_prop( $named, 'closable', 0 );
3074 0 $slots->{_icon} = _string_prop( $named, 'icon', undef );
3075 } ],
3076 [ $list_view_class, 'ListView', 'ListView',
3077 0 ▶ [ qw( items selected_index multiple ) ], sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
3078 0 my ( $slots, $named ) = @_;
3079 0 $slots->{_items} = _array_prop( $named, 'items', _zarray() );
3080 $slots->{_selected_index} = exists $named->{selected_index}
3081 0 ▶ ? 0 + ( $named->{selected_index} // 0 )
Branch: 1 branch
BranchTrueFalseTotal
exists $named->{'selected_index'} ? : 0 0 0
Condition0%0/2
$named->{"selected_index"} // 0
l!l
00
MC/DC0%0/1
$named->{"selected_index"} // 0
$named->{"selected_index"}
Truth table0%0/2
A
A= $named->{"selected_index"}
Aresult
11
00
3082 : undef;
3083 0 $slots->{_multiple} = _bool_prop( $named, 'multiple', 0 );
3084 } ],
3085 [ $tree_view_class, 'TreeView', 'TreeView',
3086 0 ▶ [ qw( items selected_path multiple ) ], sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
3087 0 my ( $slots, $named ) = @_;
3088 0 $slots->{_items} = _array_prop( $named, 'items', _zarray() );
3089 $slots->{_selected_path} = exists $named->{selected_path}
3090 0 ▶ ? _zarray( @{ _path_indexes( $named->{selected_path} ) } )
Branch: 1 branch
BranchTrueFalseTotal
exists $named->{'selected_path'} ? : 0 0 0
3091 : _zarray();
3092 0 $slots->{_multiple} = _bool_prop( $named, 'multiple', 0 );
3093 0 $slots->{_expanded_path_keys} = {};
3094 _mark_tree_expanded(
3095 $slots->{_items},
3096 [],
3097 $slots->{_expanded_path_keys},
3098 0 );
3099 } ],
3100 ) {
3101 161 my ( $klass, $class_name, $widget_type, $allowed, $builder ) = @{ $spec };
3102 161 $klass->native_constructor( _widget_constructor(
3103 $class_name,
3104 $widget_type,
3105 $allowed,
3106 $builder,
3107 ) );
3108 }
3109  
3110 7 for my $klass ( $vbox_class, $hbox_class ) {
3111 $klass->methods->{align} = native_function(
3112 name => 'align',
3113 0 ▶ native => sub { return $_[0]->slots->{_align}; },
Subroutine __ANON__: not called CC=1 SCAR=6.9
3114 14 );
3115 $klass->methods->{gap} = native_function(
3116 name => 'gap',
3117 0 ▶ native => sub { return $_[0]->slots->{_gap}; },
Subroutine __ANON__: not called CC=1 SCAR=6.9
3118 14 );
3119 $klass->methods->{padding} = native_function(
3120 name => 'padding',
3121 0 ▶ native => sub { return $_[0]->slots->{_padding}; },
Subroutine __ANON__: not called CC=1 SCAR=6.9
3122 14 );
3123 }
3124 7 _add_text_methods( $frame_class, '_label', 'label', 'set_label' );
3125 7 _add_bool_method( $frame_class, '_collapsed', 'collapsed' );
3126 7 _add_bool_method( $frame_class, '_collapsible', 'collapsible' );
3127  
3128 7 _add_text_methods( $label_class, '_text', 'text', 'set_text' );
3129 7 _add_text_methods( $label_class, '_for', 'for_id', 'set_for_id' );
3130  
3131 7 for my $klass ( $text_class, $rich_text_class ) {
3132 14 _add_text_methods( $klass, '_value', 'value', 'set_value' );
3133 14 _add_bool_method( $klass, '_multiline', 'multiline' );
3134 14 _add_bool_method( $klass, '_readonly', 'readonly' );
3135 }
3136 7 _add_bool_method( $text_class, '_wrap', 'wrap' );
3137 7 _add_text_methods( $image_class, '_src', 'src', 'set_src' );
3138 7 _add_text_methods( $image_class, '_alt', 'alt', 'set_alt' );
3139 7 _add_getter( $image_class, '_fit', 'fit' );
3140  
3141 7 _add_text_methods( $button_class, '_text', 'text', 'set_text' );
3142 7 _add_text_methods( $input_class, '_value', 'value', 'set_value' );
3143 7 _add_text_methods(
3144 $input_class,
3145 '_placeholder',
3146 'placeholder',
3147 'set_placeholder',
3148 );
3149 7 _add_bool_method( $input_class, '_multiline', 'multiline' );
3150 7 _add_bool_method( $input_class, '_readonly', 'readonly' );
3151 7 _add_bool_method( $input_class, '_password', 'password' );
3152 7 _add_bool_method( $input_class, '_required', 'required' );
3153 $input_class->methods->{select_all} = native_function(
3154 name => 'select_all',
3155 0 ▶ native => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
3156 0 my ( $self ) = @_;
3157 $self->slots->{_selection} = [
3158 0,
3159 0 ▶ length( $self->slots->{_value} // '' ),
Condition0%0/2
$self->slots->{"_value"} // ""
l!l
00
MC/DC0%0/1
$self->slots->{"_value"} // ""
$self->slots->{"_value"}
Truth table0%0/2
A
A= $self->slots->{"_value"}
Aresult
11
00
3160 ];
3161 0 return $self;
3162 },
3163 7 );
3164  
3165 $date_picker_class->methods->{value} = native_function(
3166 name => 'value',
3167 0 ▶ native => sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
3168 0 my ( $self, @args ) = @_;
3169 0 ▶ if (@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) 0 0 0
3170 0 ▶ my $value = _validate_date( $args[0], 'value' )
Condition0%0/3
_validate_date($args[0], "value") // _today_date()
l!l&&r!l&&!r
000
MC/DC0%0/2
_validate_date($args[0], "value") // _today_date()
_validate_date($args[0], "value") _today_date()
Truth table0%0/3
A // B
A= _validate_date($args[0], "value")B= _today_date()
ABresult
1X1
011
000
3171 // _today_date();
3172 0 _check_date_range( $self, $value );
3173 0 $self->slots->{_value} = $value;
3174 0 _refresh_native($self);
3175 0 return $self;
3176 }
3177 0 return $self->slots->{_value};
3178 },
3179 7 );
3180 $date_picker_class->methods->{set_value} = native_function(
3181 name => 'set_value',
3182 0 ▶ native => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
3183 0 my ( $self, $value ) = @_;
3184 0 ▶ $value = _validate_date( $value, 'value' ) // _today_date();
Condition0%0/3
_validate_date($value, "value") // _today_date()
l!l&&r!l&&!r
000
MC/DC0%0/2
_validate_date($value, "value") // _today_date()
_validate_date($value, "value") _today_date()
Truth table0%0/3
A // B
A= _validate_date($value, "value")B= _today_date()
ABresult
1X1
011
000
3185 0 _check_date_range( $self, $value );
3186 0 $self->slots->{_value} = $value;
3187 0 _refresh_native($self);
3188 0 return $self;
3189 },
3190 7 );
3191 $date_picker_class->methods->{min} = native_function(
3192 name => 'min',
3193 0 ▶ native => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
3194 0 my ( $self, @args ) = @_;
3195 0 ▶ if (@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) 0 0 0
3196 0 my $value = _validate_date( $args[0], 'min' );
3197 0 my %slots = %{ $self->slots };
3198 0 $slots{_min} = $value;
3199 0 _check_date_range_slots( \%slots, $self->slots->{_value} );
3200 0 $self->slots->{_min} = $value;
3201 0 return $self;
3202 }
3203 0 return $self->slots->{_min};
3204 },
3205 7 );
3206 $date_picker_class->methods->{max} = native_function(
3207 name => 'max',
3208 0 ▶ native => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
3209 0 my ( $self, @args ) = @_;
3210 0 ▶ if (@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) 0 0 0
3211 0 my $value = _validate_date( $args[0], 'max' );
3212 0 my %slots = %{ $self->slots };
3213 0 $slots{_max} = $value;
3214 0 _check_date_range_slots( \%slots, $self->slots->{_value} );
3215 0 $self->slots->{_max} = $value;
3216 0 return $self;
3217 }
3218 0 return $self->slots->{_max};
3219 },
3220 7 );
3221 $date_picker_class->methods->{first_day_of_week} = native_function(
3222 name => 'first_day_of_week',
3223 0 ▶ native => sub {
Subroutine __ANON__: not called CC=6 SCAR=37.4
3224 0 my ( $self, @args ) = @_;
3225 0 ▶ if (@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) 0 0 0
3226 0 ▶ my $value = 0 + ( $args[0] // 0 );
Condition0%0/2
$args[0] // 0
l!l
00
MC/DC0%0/1
$args[0] // 0
$args[0]
Truth table0%0/2
A
A= $args[0]
Aresult
11
00
3227 0 ▶ _runtime_error(
Branch: 1 branch
BranchTrueFalseTotal
if $value < 0 or $value > 6 or int $value != $value 0 0 0
Condition0%0/6
$value < 0 or $value > 6 or int $value != $value
l!l&&r!l&&!r
000
$value < 0 or $value > 6
l!l&&r!l&&!r
000
MC/DC0%0/3
$value < 0 or $value > 6 or int $value != $value
$value < 0 $value > 6 int $value != $value
Truth table0%0/4
A or B or C
A= $value < 0B= $value > 6C= int $value != $value
ABCresult
1XX1
01X1
0011
0000
3228 'GUI_PROP_TYPE',
3229 'first_day_of_week property expects an integer from 0 to 6',
3230 ) if $value < 0 or $value > 6 or int($value) != $value;
3231 0 $self->slots->{_first_day_of_week} = int($value);
3232 0 return $self;
3233 }
3234 0 return $self->slots->{_first_day_of_week};
3235 },
3236 7 );
3237  
3238 7 _add_text_methods( $checkbox_class, '_label', 'label', 'set_label' );
3239 7 _add_bool_method( $checkbox_class, '_checked', 'checked' );
3240 7 _add_bool_method( $checkbox_class, '_indeterminate', 'indeterminate' );
3241  
3242 7 _add_text_methods( $radio_class, '_label', 'label', 'set_label' );
3243 7 _add_text_methods( $radio_class, '_value', 'value', 'set_value' );
3244 7 _add_getter( $radio_class, '_group', 'group' );
3245 $radio_class->methods->{checked} = native_function(
3246 name => 'checked',
3247 0 ▶ native => sub {
Subroutine __ANON__: not called CC=4 SCAR=30.0
3248 0 my ( $self, @args ) = @_;
3249 0 ▶ if (@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) 0 0 0
3250 0 ▶ _set_radio_checked( $self, zuzu_bool( $args[0], 0 ) ? 1 : 0 );
Branch: 1 branch
BranchTrueFalseTotal
zuzu_bool($args[0], 0) ? : 0 0 0
3251 0 _refresh_native($self);
3252 0 return $self;
3253 }
3254 0 ▶ return $self->slots->{_checked} ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$self->slots->{'_checked'} ? : 0 0 0
3255 },
3256 7 );
3257  
3258 7 _add_getter( $radio_group_class, '_name', 'name' );
3259 $radio_group_class->methods->{value} = native_function(
3260 name => 'value',
3261 0 ▶ native => sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
3262 0 my ( $self, @args ) = @_;
3263 0 ▶ if (@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) 0 0 0
3264 0 _sync_radio_group_value( $self, $args[0] );
3265 0 for my $child ( @{ $self->slots->{_children}->items } ) {
3266 0 _refresh_native($child);
3267 }
3268 0 return $self;
3269 }
3270 0 return $self->slots->{_value};
3271 },
3272 7 );
3273 $radio_group_class->methods->{options} = native_function(
3274 name => 'options',
3275 0 ▶ native => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
3276 0 my ( $self ) = @_;
3277 0 my @radios = grep { _class_name($_) eq 'Radio' }
3278 0 @{ $self->slots->{_children}->items };
3279 0 return _zarray(@radios);
3280 },
3281 7 );
3282  
3283 $select_class->methods->{value} = native_function(
3284 name => 'value',
3285 0 ▶ native => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
3286 0 my ( $self, @args ) = @_;
3287 0 ▶ if (@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) 0 0 0
3288 0 $self->slots->{_value} = $args[0];
3289 0 _refresh_native($self);
3290 0 return $self;
3291 }
3292 0 return $self->slots->{_value};
3293 },
3294 7 );
3295 $select_class->methods->{options} = native_function(
3296 name => 'options',
3297 0 ▶ native => sub { return _copy_array( $_[0]->slots->{_options} ); },
Subroutine __ANON__: not called CC=1 SCAR=6.9
3298 7 );
3299 $select_class->methods->{add_option} = native_function(
3300 name => 'add_option',
3301 0 ▶ native => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
3302 0 my ( $self, $option ) = @_;
3303 0 push @{ $self->slots->{_options}->items }, $option;
3304 0 ▶ if ( _has_native($self) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (_has_native($self)) 0 0 0
3305 0 eval { $self->slots->{_native}->items( _option_labels($self) ); 1 };
3306 }
3307 0 return $self;
3308 },
3309 7 );
3310 $select_class->methods->{clear_options} = native_function(
3311 name => 'clear_options',
3312 0 ▶ native => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
3313 0 my ( $self ) = @_;
3314 0 $self->slots->{_options}->items( [] );
3315 0 ▶ if ( _has_native($self) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (_has_native($self)) 0 0 0
3316 0 eval { $self->slots->{_native}->items( [] ); 1 };
3317 }
3318 0 return $self;
3319 },
3320 7 );
3321 7 _add_bool_method( $select_class, '_multiple', 'multiple' );
3322  
3323 7 _add_text_methods( $menu_class, '_text', 'text', 'set_text' );
3324 $menu_class->methods->{items} = native_function(
3325 name => 'items',
3326 0 ▶ native => sub { return _copy_array( $_[0]->slots->{_children} ); },
Subroutine __ANON__: not called CC=1 SCAR=6.9
3327 7 );
3328 7 _add_text_methods( $menu_item_class, '_text', 'text', 'set_text' );
3329 $menu_item_class->methods->{disabled} = native_function(
3330 name => 'disabled',
3331 0 ▶ native => sub {
Subroutine __ANON__: not called CC=4 SCAR=30.0
3332 0 my ( $self, @args ) = @_;
3333 0 ▶ if (@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) 0 0 0
3334 0 ▶ $self->slots->{_enabled} = zuzu_bool( $args[0], 0 ) ? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
zuzu_bool($args[0], 0) ? : 0 0 0
3335 0 _refresh_native($self);
3336 0 return $self;
3337 }
3338 0 ▶ return $self->slots->{_enabled} ? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$self->slots->{'_enabled'} ? : 0 0 0
3339 },
3340 7 );
3341  
3342 7 _add_getter( $button_class, '_variant', 'variant' );
3343 7 _add_getter( $separator_class, '_orientation', 'orientation' );
3344  
3345 7 for my $klass ( $slider_class, $progress_class ) {
3346 14 _add_number_method( $klass, '_value', 'value' );
3347 14 _add_number_method( $klass, '_min', 'min' );
3348 14 _add_number_method( $klass, '_max', 'max' );
3349 }
3350 7 _add_number_method( $slider_class, '_step', 'step' );
3351 7 _add_getter( $slider_class, '_orientation', 'orientation' );
3352 7 _add_bool_method( $slider_class, '_readonly', 'readonly' );
3353 7 _add_bool_method( $progress_class, '_indeterminate', 'indeterminate' );
3354 7 _add_bool_method( $progress_class, '_show_text', 'show_text' );
3355  
3356 7 _add_getter( $tabs_class, '_placement', 'placement' );
3357 $tabs_class->methods->{selected} = native_function(
3358 name => 'selected',
3359 0 ▶ native => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
3360 0 my ( $self, @args ) = @_;
3361 0 ▶ if (@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) 0 0 0
3362 0 _sync_tabs_selected( $self, $args[0] );
3363 0 return $self;
3364 }
3365 0 return $self->slots->{_selected};
3366 },
3367 7 );
3368 $tabs_class->methods->{value} = native_function(
3369 name => 'value',
3370 0 ▶ native => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
3371 0 my ( $self, @args ) = @_;
3372 0 ▶ if (@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) 0 0 0
3373 0 _sync_tabs_selected( $self, $args[0] );
3374 0 return $self;
3375 }
3376 0 return $self->slots->{_selected};
3377 },
3378 7 );
3379 $tabs_class->methods->{tabs} = native_function(
3380 name => 'tabs',
3381 0 ▶ native => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
3382 0 my ( $self ) = @_;
3383 0 my @tabs = grep { _class_name($_) eq 'Tab' }
3384 0 @{ $self->slots->{_children}->items };
3385 0 return _zarray(@tabs);
3386 },
3387 7 );
3388 $tabs_class->methods->{selected_tab} = native_function(
3389 name => 'selected_tab',
3390 0 ▶ native => sub {
Subroutine __ANON__: not called CC=4 SCAR=30.0
3391 0 my ( $self ) = @_;
3392 0 for my $child ( @{ $self->slots->{_children}->items } ) {
3393 0 ▶ next if _class_name($child) ne 'Tab';
Branch: 1 branch
BranchTrueFalseTotal
if _class_name($child) ne "Tab" 0 0 0
3394 0 ▶ return $child if $child->slots->{_selected};
Branch: 1 branch
BranchTrueFalseTotal
if $child->slots->{"_selected"} 0 0 0
3395 }
3396 0 return undef;
3397 },
3398 7 );
3399  
3400 7 _add_text_methods( $tab_class, '_title', 'title', 'set_title' );
3401 7 _add_text_methods( $tab_class, '_value', 'value', 'set_value' );
3402 7 _add_text_methods( $tab_class, '_icon', 'icon', 'set_icon' );
3403 7 _add_bool_method( $tab_class, '_closable', 'closable' );
3404 $tab_class->methods->{selected} = native_function(
3405 name => 'selected',
3406 0 ▶ native => sub {
Subroutine __ANON__: not called CC=4 SCAR=30.0
3407 0 my ( $self, @args ) = @_;
3408 0 ▶ if (@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) 0 0 0
3409 0 ▶ _set_tab_selected( $self, zuzu_bool( $args[0], 0 ) ? 1 : 0 );
Branch: 1 branch
BranchTrueFalseTotal
zuzu_bool($args[0], 0) ? : 0 0 0
3410 0 return $self;
3411 }
3412 0 ▶ return $self->slots->{_selected} ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$self->slots->{'_selected'} ? : 0 0 0
3413 },
3414 7 );
3415  
3416 $list_view_class->methods->{items} = native_function(
3417 name => 'items',
3418 0 ▶ native => sub { return _copy_array( $_[0]->slots->{_items} ); },
Subroutine __ANON__: not called CC=1 SCAR=6.9
3419 7 );
3420 $list_view_class->methods->{selected_index} = native_function(
3421 name => 'selected_index',
3422 0 ▶ native => sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
3423 0 my ( $self, @args ) = @_;
3424 0 ▶ if (@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) 0 0 0
3425 0 ▶ $self->slots->{_selected_index} = defined $args[0]
Branch: 1 branch
BranchTrueFalseTotal
defined $args[0] ? : 0 0 0
3426 ? 0 + $args[0]
3427 : undef;
3428 0 _refresh_native($self);
3429 0 return $self;
3430 }
3431 0 return $self->slots->{_selected_index};
3432 },
3433 7 );
3434 $list_view_class->methods->{selected_item} = native_function(
3435 name => 'selected_item',
3436 0 ▶ native => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
3437 0 my ( $self ) = @_;
3438 0 return _item_at_index( $self, $self->slots->{_selected_index} );
3439 },
3440 7 );
3441 $list_view_class->methods->{add_item} = native_function(
3442 name => 'add_item',
3443 0 ▶ native => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
3444 0 my ( $self, $item ) = @_;
3445 0 push @{ $self->slots->{_items}->items }, $item;
3446 0 _refresh_native($self);
3447 0 return $self;
3448 },
3449 7 );
3450 $list_view_class->methods->{clear_items} = native_function(
3451 name => 'clear_items',
3452 0 ▶ native => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
3453 0 my ( $self ) = @_;
3454 0 $self->slots->{_items}->items( [] );
3455 0 $self->slots->{_selected_index} = undef;
3456 0 _refresh_native($self);
3457 0 return $self;
3458 },
3459 7 );
3460 $list_view_class->methods->{activate_index} = native_function(
3461 name => 'activate_index',
3462 0 ▶ native => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
3463 0 my ( $self, $index ) = @_;
3464 0 ▶ $self->slots->{_selected_index} = 0 + ( $index // 0 );
Condition0%0/2
$index // 0
l!l
00
MC/DC0%0/1
$index // 0
$index
Truth table0%0/2
A
A= $index
Aresult
11
00
3465 0 _emit_native_event( $runtime, $self, 'activate' );
3466 0 return $self;
3467 },
3468 7 );
3469 7 _add_bool_method( $list_view_class, '_multiple', 'multiple' );
3470  
3471 $tree_view_class->methods->{items} = native_function(
3472 name => 'items',
3473 0 ▶ native => sub { return _copy_array( $_[0]->slots->{_items} ); },
Subroutine __ANON__: not called CC=1 SCAR=6.9
3474 7 );
3475 7 _add_bool_method( $tree_view_class, '_multiple', 'multiple' );
3476 $tree_view_class->methods->{selected_path} = native_function(
3477 name => 'selected_path',
3478 0 ▶ native => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
3479 0 my ( $self, @args ) = @_;
3480 0 ▶ if (@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) 0 0 0
3481 $self->slots->{_selected_path} = _zarray(
3482 0 @{ _path_indexes( $args[0] ) },
3483 );
3484 0 _refresh_native($self);
3485 0 return $self;
3486 }
3487 0 return _copy_array( $self->slots->{_selected_path} );
3488 },
3489 7 );
3490 $tree_view_class->methods->{selected_item} = native_function(
3491 name => 'selected_item',
3492 0 ▶ native => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
3493 0 my ( $self ) = @_;
3494 return _tree_item_at_path(
3495 $self,
3496 0 [ @{ $self->slots->{_selected_path}->items } ],
3497 );
3498 },
3499 7 );
3500 $tree_view_class->methods->{add_item} = native_function(
3501 name => 'add_item',
3502 0 ▶ native => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
3503 0 my ( $self, $item ) = @_;
3504 0 push @{ $self->slots->{_items}->items }, $item;
3505 _mark_tree_expanded(
3506 $self->slots->{_items},
3507 [],
3508 $self->slots->{_expanded_path_keys},
3509 0 );
3510 0 _refresh_native($self);
3511 0 return $self;
3512 },
3513 7 );
3514 $tree_view_class->methods->{clear_items} = native_function(
3515 name => 'clear_items',
3516 0 ▶ native => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
3517 0 my ( $self ) = @_;
3518 0 $self->slots->{_items}->items( [] );
3519 0 $self->slots->{_selected_path}->items( [] );
3520 0 $self->slots->{_expanded_path_keys} = {};
3521 0 _refresh_native($self);
3522 0 return $self;
3523 },
3524 7 );
3525 $tree_view_class->methods->{activate_path} = native_function(
3526 name => 'activate_path',
3527 0 ▶ native => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
3528 0 my ( $self, $path ) = @_;
3529 $self->slots->{_selected_path} = _zarray(
3530 0 @{ _path_indexes($path) },
3531 );
3532 0 _emit_native_event( $runtime, $self, 'activate' );
3533 0 return $self;
3534 },
3535 7 );
3536 $tree_view_class->methods->{expand_path} = native_function(
3537 name => 'expand_path',
3538 0 ▶ native => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
3539 0 my ( $self, $path ) = @_;
3540 0 my $indexes = _path_indexes($path);
3541 $self->slots->{_expanded_path_keys}{ _path_key($indexes) } = [
3542 0 @{ $indexes },
3543 ];
3544 0 _refresh_native($self);
3545 0 _emit_native_event( $runtime, $self, 'expand' );
3546 0 return $self;
3547 },
3548 7 );
3549 $tree_view_class->methods->{collapse_path} = native_function(
3550 name => 'collapse_path',
3551 0 ▶ native => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
3552 0 my ( $self, $path ) = @_;
3553 0 my $indexes = _path_indexes($path);
3554 0 delete $self->slots->{_expanded_path_keys}{ _path_key($indexes) };
3555 0 _refresh_native($self);
3556 0 _emit_native_event( $runtime, $self, 'collapse' );
3557 0 return $self;
3558 },
3559 7 );
3560 $tree_view_class->methods->{is_expanded} = native_function(
3561 name => 'is_expanded',
3562 0 ▶ native => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
3563 0 my ( $self, $path ) = @_;
3564 0 my $indexes = _path_indexes($path);
3565 0 ▶ return exists $self->slots->{_expanded_path_keys}{ _path_key($indexes) }
Branch: 1 branch
BranchTrueFalseTotal
exists $self->slots->{'_expanded_path_keys'}{_path_key($indexes)} ? : 0 0 0
3566 ? 1
3567 : 0;
3568 },
3569 7 );
3570  
3571 return {
3572 7 Widget => $widget_class,
3573 Window => $window_class,
3574 VBox => $vbox_class,
3575 HBox => $hbox_class,
3576 Frame => $frame_class,
3577 Label => $label_class,
3578 Text => $text_class,
3579 RichText => $rich_text_class,
3580 Image => $image_class,
3581 Input => $input_class,
3582 DatePicker => $date_picker_class,
3583 Checkbox => $checkbox_class,
3584 Radio => $radio_class,
3585 RadioGroup => $radio_group_class,
3586 Select => $select_class,
3587 Menu => $menu_class,
3588 MenuItem => $menu_item_class,
3589 Button => $button_class,
3590 Separator => $separator_class,
3591 Slider => $slider_class,
3592 Progress => $progress_class,
3593 Tabs => $tabs_class,
3594 Tab => $tab_class,
3595 ListView => $list_view_class,
3596 TreeView => $tree_view_class,
3597 Event => $event_class,
3598 ListenerToken => $listener_token_class,
3599 native_file_open => native_function(
3600 name => 'native_file_open',
3601 native => \&_native_file_open,
3602 ),
3603 native_file_save => native_function(
3604 name => 'native_file_save',
3605 native => \&_native_file_save,
3606 ),
3607 native_directory_open => native_function(
3608 name => 'native_directory_open',
3609 native => \&_native_directory_open,
3610 ),
3611 native_directory_save => native_function(
3612 name => 'native_directory_save',
3613 native => \&_native_directory_save,
3614 ),
3615 native_alert => native_function(
3616 name => 'native_alert',
3617 native => \&_native_alert,
3618 ),
3619 native_confirm => native_function(
3620 name => 'native_confirm',
3621 native => \&_native_confirm,
3622 ),
3623 native_prompt => native_function(
3624 name => 'native_prompt',
3625 native => \&_native_prompt,
3626 ),
3627 native_colour_picker => native_function(
3628 name => 'native_colour_picker',
3629 native => \&_native_colour_picker,
3630 ),
3631 meta => _backend_meta(),
3632 };
3633 }
3634  
3635 3 1;
3636  
3637 =pod
3638  
3639 =head1 NAME
3640  
3641 Zuzu::Module::GUI::Objects - headless std/gui object model.
3642  
3643 =head1 DESCRIPTION
3644  
3645 Implements the early runtime-backed GUI object, event, and baseline
3646 control model for the Perl runtime, with a Prima backend for on-screen
3647 windows and controls.
3648  
3649 =head1 COPYRIGHT AND LICENCE
3650  
3651 B<< Zuzu::Module::GUI::Objects >> is copyright Toby Inkster.
3652  
3653 It is free software; you may redistribute it and/or modify it under
3654 the terms of either the Artistic License 1.0 or the GNU General Public
3655 License version 2.
3656  
3657 =cut
↑ Summary blib/lib/Zuzu/Module/String/Encode.pm »