use strict;
use warnings;
use Test::More tests => 14;
use Subtitle::Format::SMI;
my $smi = Subtitle::Format::SMI->new(debug => 1);
is(ref $smi, 'Subtitle::Format::SMI');
can_ok($smi, qw(new parse build));
my $sample = <<"EOF";
Title
First event
Another line
Second event
No 'empty' event to hide this
show till end-of-file
EOF
my $cnt = $smi->from_string($sample);
is($cnt, 3);
is($smi->{style}, "P {margin-left: 2pt; margin-right: 2pt; font-size: 12pt; }\n.SCC {Name: 'Some lang'; lang: ru; }");
my @events = $smi->events;
is($events[0]->t_start, 12);
is($events[0]->t_end, 20);
is($events[0]->text, "First event\\nAnother line");
is($events[1]->t_start, 30);
is($events[1]->t_end, 40);
is($events[1]->text, "Second event");
is($events[2]->t_start, 50);
is($events[2]->t_end, 63); # from samiparam/length
is($events[2]->text, "No 'empty' event to hide this\\nshow till end-of-file");
$sample = <<"EOF";
Title
First event Another line
Second event
No 'empty' event to hide this show till end-of-file