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.

35 lines
740 B

use strict;
use warnings;
use Test::More tests => 9;
use Subtitle::Format::SRT;
my $srt = Subtitle::Format::SRT->new(debug => 1);
is(ref $srt, 'Subtitle::Format::SRT');
can_ok($srt, qw(new parse build));
my $sample = <<"EOF";
1
00:00:00,100 --> 00:00:08,000
<i>kirari hikaru yume o taisetsu ni dakishimete
</i>
2
00:00:08,100 --> 00:00:12,000
<i>ippo dzutsu aruite yukou
</i>
EOF
my $cnt = $srt->from_string($sample);
is($cnt, 2);
my @events = @{ $srt->{events} };
is($events[0]->t_start, 0.1);
is($events[0]->t_end, 8.0);
is($events[0]->text, "<i>kirari hikaru yume o taisetsu ni dakishimete\n</i>");
is($events[1]->t_start, 8.1);
is($events[1]->t_end, 12.0);
is($events[1]->text, "<i>ippo dzutsu aruite yukou\n</i>");
exit 0;