| 1 | ##---------------------------------------------------------------------------- | ||||||||||||
| 2 | ## HTML Object - ~/lib/HTML/Object/DOM/VTTCue.pm | ||||||||||||
| 3 | ## Version v0.2.0 | ||||||||||||
| 4 | ## Copyright(c) 2021 DEGUEST Pte. Ltd. | ||||||||||||
| 5 | ## Author: Jacques Deguest <jack@deguest.jp> | ||||||||||||
| 6 | ## Created 2021/12/27 | ||||||||||||
| 7 | ## Modified 2022/09/18 | ||||||||||||
| 8 | ## All rights reserved. | ||||||||||||
| 9 | ## | ||||||||||||
| 10 | ## | ||||||||||||
| 11 | ## This program is free software; you can redistribute it and/or modify it | ||||||||||||
| 12 | ## under the same terms as Perl itself. | ||||||||||||
| 13 | ##---------------------------------------------------------------------------- | ||||||||||||
| 14 | package HTML::Object::DOM::VTTCue; | ||||||||||||
| 15 | BEGIN | ||||||||||||
| 16 | 1 | ▶ | { | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 17 | 1 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 18 | 1 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 19 | 1 | warnings::register_categories( 'HTML::Object' ); | |||||||||||
| 20 | 1 | ▶ | use parent qw( HTML::Object::DOM::TextTrackCue ); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 21 | 1 | ▶ | use vars qw( $VERSION ); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 22 | 1 | ▶ | use HTML::Object::Exception; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 23 | 1 | our $VERSION = 'v0.2.0'; | |||||||||||
| 24 | }; | ||||||||||||
| 25 | |||||||||||||
| 26 | 1 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 27 | 1 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 28 | |||||||||||||
| 29 | sub init | ||||||||||||
| 30 | 0 | ▶ | { | ||||||||||
|
Subroutine
init: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||
| 31 | 0 | my $self = shift( @_ ); | |||||||||||
| 32 | 0 | ▶ | return( $self->error({ | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 33 | message => sprintf( "At least 3 arguments required, but only %d passed", scalar( @_ ) ), | ||||||||||||
| 34 | class => 'HML::Object::TypeError', | ||||||||||||
| 35 | }) ) if( scalar( @_ ) < 3 ); | ||||||||||||
| 36 | 0 | my $start = shift( @_ ); | |||||||||||
| 37 | 0 | my $end = shift( @_ ); | |||||||||||
| 38 | 0 | my $text = shift( @_ ); | |||||||||||
| 39 | 0 | ▶ | return( $self->error({ | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 40 | message => "start argument provided is not a number", | ||||||||||||
| 41 | class => 'HML::Object::TypeError', | ||||||||||||
| 42 | }) ) if( !$self->_is_number( $start ) ); | ||||||||||||
| 43 | 0 | ▶ | return( $self->error({ | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 44 | message => "end argument provided is not a number", | ||||||||||||
| 45 | class => 'HML::Object::TypeError', | ||||||||||||
| 46 | }) ) if( !$self->_is_number( $end ) ); | ||||||||||||
| 47 | 0 | $self->{positionalign} = 'auto'; | |||||||||||
| 48 | 0 | $self->{startTime} = $start; | |||||||||||
| 49 | 0 | $self->{endTime} = $end; | |||||||||||
| 50 | 0 | $self->{text} = $text; | |||||||||||
| 51 | 0 | $self->{_init_strict_use_sub} = 1; | |||||||||||
| 52 | 0 | ▶ | $self->SUPER::init( @_ ) || return( $self->pass_error ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 53 | 0 | return( $self ); | |||||||||||
| 54 | } | ||||||||||||
| 55 | |||||||||||||
| 56 | # Note: property | ||||||||||||
| 57 | 0 | ▶ | sub align : lvalue { return( shift->_set_get_scalar_as_object( 'align', @_ ) ); } | ||||||||||
|
Subroutine
align: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 58 | |||||||||||||
| 59 | 0 | ▶ | sub endTime : lvalue { return( shift->_set_get_scalar_as_object( 'endTime', @_ ) ); } | ||||||||||
|
Subroutine
endTime: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 60 | |||||||||||||
| 61 | sub getCueAsHTML | ||||||||||||
| 62 | 0 | ▶ | { | ||||||||||
|
Subroutine
getCueAsHTML: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||
| 63 | 0 | my $self = shift( @_ ); | |||||||||||
| 64 | 0 | ▶ | $self->_load_class( 'HTML::Object::DOM::DocumentFragment' ) || return( $self->pass_error ); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 65 | 0 | my $frag = HTML::Object::DOM::DocumentFragment->new; | |||||||||||
| 66 | 0 | ▶ | my $text = $frag->new_text( value => $self->{text} ) || return( $self->pass_error( $frag->error ) ); | ||||||||||
|
Condition0%0/2
$frag->new_text('value', $self->{'text'}) || (return $self->pass_error($frag->error))
MC/DC0%0/1
$frag->new_text('value', $self->{'text'}) || (return $self->pass_error($frag->error))
$frag->new_text('value', $self->{'text'})
Truth table0%0/2
A
A= $frag->new_text('value', $self->{'text'})
| |||||||||||||
| 67 | 0 | $frag->appendChild( $text ); | |||||||||||
| 68 | 0 | return( $frag ); | |||||||||||
| 69 | } | ||||||||||||
| 70 | |||||||||||||
| 71 | # Note: property | ||||||||||||
| 72 | 0 | ▶ | sub line : lvalue { return( shift->_set_get_scalar_as_object( 'line', @_ ) ); } | ||||||||||
|
Subroutine
line: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 73 | |||||||||||||
| 74 | # Note: property | ||||||||||||
| 75 | 0 | ▶ | sub lineAlign : lvalue { return( shift->_set_get_scalar_as_object( 'linealign', @_ ) ); } | ||||||||||
|
Subroutine
lineAlign: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 76 | |||||||||||||
| 77 | # Note: property | ||||||||||||
| 78 | 0 | ▶ | sub position : lvalue { return( shift->_set_get_scalar_as_object( 'position', @_ ) ); } | ||||||||||
|
Subroutine
position: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 79 | |||||||||||||
| 80 | # Note: property | ||||||||||||
| 81 | 0 | ▶ | sub positionAlign : lvalue { return( shift->_set_get_scalar_as_object( 'positionalign', @_ ) ); } | ||||||||||
|
Subroutine
positionAlign: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 82 | |||||||||||||
| 83 | # Note: property | ||||||||||||
| 84 | 0 | ▶ | sub region : lvalue { return( shift->_set_get_object_without_init( 'region', 'HTML::Object::DOM::VTTRegion', @_ ) ); } | ||||||||||
|
Subroutine
region: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 85 | |||||||||||||
| 86 | # Note: property | ||||||||||||
| 87 | 0 | ▶ | sub size : lvalue { return( shift->_set_get_number( 'size', @_ ) ); } | ||||||||||
|
Subroutine
size: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 88 | |||||||||||||
| 89 | # Note: property | ||||||||||||
| 90 | 0 | ▶ | sub snapToLines : lvalue { return( shift->_set_get_boolean( 'snaptolines', @_ ) ); } | ||||||||||
|
Subroutine
snapToLines: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 91 | |||||||||||||
| 92 | 0 | ▶ | sub startTime : lvalue { return( shift->_set_get_scalar_as_object( 'startTime', @_ ) ); } | ||||||||||
|
Subroutine
startTime: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 93 | |||||||||||||
| 94 | # Note: property | ||||||||||||
| 95 | 0 | ▶ | sub text : lvalue { return( shift->_set_get_scalar_as_object( 'text', @_ ) ); } | ||||||||||
|
Subroutine
text: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 96 | |||||||||||||
| 97 | # Note: property | ||||||||||||
| 98 | 0 | ▶ | sub vertical : lvalue { return( shift->_set_get_scalar_as_object( 'vertical', @_ ) ); } | ||||||||||
|
Subroutine
vertical: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 99 | |||||||||||||
| 100 | 1 | 1; | |||||||||||
| 101 | # NOTE: POD | ||||||||||||
| 102 | __END__ | ||||||||||||