Browse Source

+ t/format-msub.t

master
Alex 'AdUser' Z 9 years ago
parent
commit
da79b7833b
  1. 29
      t/format-msub.t

29
t/format-msub.t

@ -0,0 +1,29 @@
use strict;
use warnings;
use Test::More tests => 9;
use Subtitle::MSub;
my $msub = Subtitle::MSub->new(debug => 1);
is(ref $msub, 'Subtitle::MSub');
can_ok($msub, qw(new parse));
my $sample = <<"EOF";
{1}{1} 15.0
{30}{45} Test event
{45}{60} Test event|with line wrap
EOF
my @lines = split(/[\r\n]+/, $sample);
my $cnt = $msub->parse(\@lines);
is($cnt, 2);
my @events = @{ $msub->{events} };
is($events[0]->{timing}->[0], 2.0);
is($events[0]->{timing}->[1], 3.0);
is($events[0]->{text}, "Test event");
is($events[1]->{timing}->[0], 3.0);
is($events[1]->{timing}->[1], 4.0);
is($events[1]->{text}, "Test event\nwith line wrap");
exit 0;
Loading…
Cancel
Save