|
|
@ -3,14 +3,14 @@ use warnings; |
|
|
|
|
|
|
|
|
|
|
|
use Test::More tests => 51; |
|
|
|
use Test::More tests => 51; |
|
|
|
|
|
|
|
|
|
|
|
use Subtitle::SSA::Style; |
|
|
|
use Subtitle::Format::SSA::Style; |
|
|
|
|
|
|
|
|
|
|
|
my ($fields, @fields, $format, $sample, $style, $output); |
|
|
|
my ($fields, @fields, $format, $sample, $style, $output); |
|
|
|
|
|
|
|
|
|
|
|
# SSA format line |
|
|
|
# SSA format line |
|
|
|
$format = 'Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, TertiaryColour, BackColour, Bold, Italic, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding'; |
|
|
|
$format = 'Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, TertiaryColour, BackColour, Bold, Italic, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding'; |
|
|
|
@fields = qw(name fontname fontsize primarycolour secondarycolour tertiarycolour backcolour bold italic borderstyle outline shadow alignment marginl marginr marginv alphalevel encoding); |
|
|
|
@fields = qw(name fontname fontsize primarycolour secondarycolour tertiarycolour backcolour bold italic borderstyle outline shadow alignment marginl marginr marginv alphalevel encoding); |
|
|
|
$style = Subtitle::SSA::Style->new(type => 'ssa'); |
|
|
|
$style = Subtitle::Format::SSA::Style->new(type => 'ssa'); |
|
|
|
$fields = $style->parse_format_line($format); |
|
|
|
$fields = $style->parse_format_line($format); |
|
|
|
is(ref $fields, 'ARRAY'); |
|
|
|
is(ref $fields, 'ARRAY'); |
|
|
|
is_deeply($fields, \@fields); |
|
|
|
is_deeply($fields, \@fields); |
|
|
@ -18,13 +18,13 @@ is_deeply($fields, \@fields); |
|
|
|
# ASS format line |
|
|
|
# ASS format line |
|
|
|
$format = 'Format:Name,Fontname,Fontsize,PrimaryColour,SecondaryColour,OutlineColour,BackColour,Bold,Italic,Underline,StrikeOut,ScaleX,ScaleY,Spacing,Angle,BorderStyle,Outline,Shadow,Alignment,MarginL,MarginR,MarginV,Encoding'; |
|
|
|
$format = 'Format:Name,Fontname,Fontsize,PrimaryColour,SecondaryColour,OutlineColour,BackColour,Bold,Italic,Underline,StrikeOut,ScaleX,ScaleY,Spacing,Angle,BorderStyle,Outline,Shadow,Alignment,MarginL,MarginR,MarginV,Encoding'; |
|
|
|
@fields = qw(name fontname fontsize primarycolour secondarycolour outlinecolour backcolour bold italic underline strikeout scalex scaley spacing angle borderstyle outline shadow alignment marginl marginr marginv encoding); |
|
|
|
@fields = qw(name fontname fontsize primarycolour secondarycolour outlinecolour backcolour bold italic underline strikeout scalex scaley spacing angle borderstyle outline shadow alignment marginl marginr marginv encoding); |
|
|
|
$style = Subtitle::SSA::Style->new(type => 'ass'); |
|
|
|
$style = Subtitle::Format::SSA::Style->new(type => 'ass'); |
|
|
|
$fields = $style->parse_format_line($format); |
|
|
|
$fields = $style->parse_format_line($format); |
|
|
|
is(ref $fields, 'ARRAY'); |
|
|
|
is(ref $fields, 'ARRAY'); |
|
|
|
is_deeply($fields, \@fields); |
|
|
|
is_deeply($fields, \@fields); |
|
|
|
|
|
|
|
|
|
|
|
$sample = 'Style: Default,Arial,20,11259130,33023,12582847,32,-1,0,1,2,1,2,10,10,2,0,204'; |
|
|
|
$sample = 'Style: Default,Arial,20,11259130,33023,12582847,32,-1,0,1,2,1,2,10,10,2,0,204'; |
|
|
|
$style = Subtitle::SSA::Style->new(type => 'ssa'); |
|
|
|
$style = Subtitle::Format::SSA::Style->new(type => 'ssa'); |
|
|
|
ok($style->parse($sample), "SSA style parsing test"); |
|
|
|
ok($style->parse($sample), "SSA style parsing test"); |
|
|
|
is($style->{name} => 'Default'); |
|
|
|
is($style->{name} => 'Default'); |
|
|
|
is($style->{fontname} => 'Arial'); |
|
|
|
is($style->{fontname} => 'Arial'); |
|
|
@ -49,7 +49,7 @@ ok($output = $style->to_string(), 'converting SSA style to string'); |
|
|
|
is($output, $sample); |
|
|
|
is($output, $sample); |
|
|
|
|
|
|
|
|
|
|
|
$sample = 'Style: Default,Georgia,50,&H00F0F4F6,&H008D7127,&H00414B4C,&H00000000,0,0,0,0,100,95,0,0,1,3.5,0,2,11,11,13,204'; |
|
|
|
$sample = 'Style: Default,Georgia,50,&H00F0F4F6,&H008D7127,&H00414B4C,&H00000000,0,0,0,0,100,95,0,0,1,3.5,0,2,11,11,13,204'; |
|
|
|
$style = Subtitle::SSA::Style->new(type => 'ass'); |
|
|
|
$style = Subtitle::Format::SSA::Style->new(type => 'ass'); |
|
|
|
ok($style->parse($sample), "ASS style parsing test"); |
|
|
|
ok($style->parse($sample), "ASS style parsing test"); |
|
|
|
is($style->{name} => 'Default'); |
|
|
|
is($style->{name} => 'Default'); |
|
|
|
is($style->{fontname} => 'Georgia'); |
|
|
|
is($style->{fontname} => 'Georgia'); |
|
|
|