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.

30 lines
611 B

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 $cnt = $msub->from_string($sample);
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;