You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
607 B

use strict;
use warnings;
use Test::More tests => 9;
use Subtitle::Format::MSub;
my $msub = Subtitle::Format::MSub->new(debug => 1);
is(ref $msub, 'Subtitle::Format::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 $cnt = $msub->from_string($sample);
is($cnt, 2);
my @events = @{ $msub->{events} };
is($events[0]->t_start, 2.0);
is($events[0]->t_end, 3.0);
is($events[0]->text, "Test event");
is($events[1]->t_start, 3.0);
is($events[1]->t_end, 4.0);
is($events[1]->text, "Test event\nwith line wrap");
exit 0;