blob: 921b58e1d136fa535630bc4d624bcf4f4ddc8242 [file] [log] [blame]
Akronef8544f2016-01-16 14:51:07 +01001#!/usr/bin/env perl
2use strict;
3use warnings;
4use utf8;
5use Test::More;
Akron151676d2016-03-14 20:12:14 +01006use lib 't/annotation';
Akronef8544f2016-01-16 14:51:07 +01007use TestInit;
8use Scalar::Util qw/weaken/;
9use Data::Dumper;
10
Akronef8544f2016-01-16 14:51:07 +010011ok(my $tokens = TestInit::tokens('0001'), 'Parse tokens');
12
Akron41ac10b2017-02-08 22:47:25 +010013ok($tokens->add('DeReKo', 'Structure', 'pagebreaks'), 'Add Structure');
Akronef8544f2016-01-16 14:51:07 +010014
15my $data = $tokens->to_data->{data};
16
17like($data->{foundries}, qr!dereko/structure!, 'data');
18like($data->{layerInfos}, qr!dereko/s=spans!, 'data');
19
20# Empty element (from 0 to 0) on level 1, with TUI 2
21is($data->{stream}->[0]->[1],
Akron69a4a2f2016-01-17 12:55:50 +010022 '<>:dereko/s:idsHeader$<b>65<i>0<i>0<i>0<b>1<s>2',
Akronef8544f2016-01-16 14:51:07 +010023 'Empty element');
24
Akronef8544f2016-01-16 14:51:07 +010025
Akrondec43122020-03-03 11:22:25 +010026is($data->{stream}->[0]->[5], '<>:base/s:t$<b>64<i>0<i>129<i>18<b>0', 'Text boundary');
Akronee443f92016-02-25 23:56:49 +010027
28# Attributes:
Akronef8544f2016-01-16 14:51:07 +010029is($data->{stream}->[0]->[11],
Akronee443f92016-02-25 23:56:49 +010030 '@:dereko/s:type:text$<b>17<s>2',
Akronef8544f2016-01-16 14:51:07 +010031 'Attribute of idsHeader');
32
33is($data->{stream}->[0]->[12],
34 '@:dereko/s:status:new$<b>17<s>2',
35 'Attribute of idsHeader');
36
37is($data->{stream}->[0]->[13],
Akronee443f92016-02-25 23:56:49 +010038 '@:dereko/s:version:1.1$<b>17<s>2',
Akronef8544f2016-01-16 14:51:07 +010039 'Attribute of idsHeader');
40
41is($data->{stream}->[0]->[14],
42 '@:dereko/s:pattern:text$<b>17<s>2',
43 'Attribute of idsHeader');
44
Akronb62d92a2020-03-01 16:32:00 +010045is($data->{stream}->[5]->[1],
Akron69a4a2f2016-01-17 12:55:50 +010046 '<>:dereko/s:s$<b>64<i>32<i>42<i>6<b>6<s>1',
47 'Sentence span');
48
Akronb62d92a2020-03-01 16:32:00 +010049is($data->{stream}->[5]->[2],
Akron69a4a2f2016-01-17 12:55:50 +010050 '@:dereko/s:broken:no$<b>17<s>1<i>6',
51 'Attribute of sentence span');
52
Akronb62d92a2020-03-01 16:32:00 +010053is($data->{stream}->[7]->[0],
54 '<>:dereko/s:pb$<b>65<i>42<i>42<i>7<b>6<s>1',
Akron69a4a2f2016-01-17 12:55:50 +010055 'Pagebreak element');
Akronef8544f2016-01-16 14:51:07 +010056
Akronb62d92a2020-03-01 16:32:00 +010057is($data->{stream}->[7]->[-1],
Akron41ac10b2017-02-08 22:47:25 +010058 '~:base/s:pb$<i>2<i>42',
59 'Pagebreak element');
60
Akronef8544f2016-01-16 14:51:07 +010061done_testing;
62
63__END__