summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webvtt/parsing/file-parsing/support/settings-position.test
blob: efed18caeacb1ae2a9f924bb8b7acfb7f534317b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
settings, position
<link rel="help" href="https://w3c.github.io/webvtt/#collect-webvtt-cue-timings-and-settings">

assert_equals(cues.length, 22);

var valid_positions = [
    [1, 'auto'],
    [100, 'auto'],
    [1, 'auto'],
    [1.5, 'auto'],
    [1, 'line-left'],
    [1, 'center'],
    [1, 'line-right'],
    [1, 'auto'],
];
valid_positions.forEach(function(pair, index) {
    var position = pair[0];
    var positionAlign = pair[1];

    assert_equals(cues[index].position, position, 'Failed with cue ' + index);
    assert_equals(cues[index].positionAlign, positionAlign, 'Failed with cue ' + index);
});

for (var i = 0; i < 14; i++) {
    var index = valid_positions.length + i;

    assert_equals(cues[index].position, 'auto', 'Failed with cue ' + index);
    assert_equals(cues[index].positionAlign, 'auto', 'Failed with cue ' + index);
}

===
WEBVTT

NOTE valid

00:00:00.000 --> 00:00:01.000 position:1%
text0

00:00:00.000 --> 00:00:01.000 position:100%
text1

00:00:00.000 --> 00:00:01.000 position:1% position:x
text2

00:00:00.000 --> 00:00:01.000 position:1.5%
text3

00:00:00.000 --> 00:00:01.000 position:1%,line-left
text4

00:00:00.000 --> 00:00:01.000 position:1%,center
text5

00:00:00.000 --> 00:00:01.000 position:1%,line-right
text6

00:00:00.000 --> 00:00:01.000 position:1% ,center
text7

NOTE invalid

00:00:00.000 --> 00:00:01.000 position:1%,middle
invalid8

00:00:00.000 --> 00:00:01.000 position:1%, center
invalid9

00:00:00.000 --> 00:00:01.000 position:-1%
invalid10

00:00:00.000 --> 00:00:01.000 position:1
invalid11

00:00:00.000 --> 00:00:01.000 position:1x
invalid12

00:00:00.000 --> 00:00:01.000 position:1%x
invalid13

00:00:00.000 --> 00:00:01.000 position:
invalid14

00:00:00.000 --> 00:00:01.000 position: 1%
invalid15

00:00:00.000 --> 00:00:01.000 position:101%
invalid16

00:00:00.000 --> 00:00:01.000 position:65536%
invalid17

00:00:00.000 --> 00:00:01.000 position:4294967296%
invalid18

00:00:00.000 --> 00:00:01.000 position:101%,line-left
invalid19

00:00:00.000 --> 00:00:01.000 position:101%,center
invalid20

00:00:00.000 --> 00:00:01.000 position:101%,line-right
invalid21