mirror of
https://github.com/servo/servo.git
synced 2025-08-16 19:05:33 +01:00
Update web-platform-tests to revision 58eb04cecbbec2e18531ab440225e38944a9c444
This commit is contained in:
parent
25e8bf69e6
commit
665817d2a6
35333 changed files with 1818077 additions and 16036 deletions
|
@ -0,0 +1,52 @@
|
|||
# Tests for http://w3c.github.io/webvtt/#file-parsing
|
||||
|
||||
Tests that expect an 'error' event (due to invalid signature) are:
|
||||
|
||||
```bash
|
||||
./signature-invalid.html
|
||||
./support/*.vtt
|
||||
```
|
||||
|
||||
Other tests are generated from source files with a custom format. The source files are:
|
||||
|
||||
```bash
|
||||
./support/*.test
|
||||
```
|
||||
|
||||
## .test Format
|
||||
|
||||
* The first line is the title of the test.
|
||||
* Subsequent lines until a blank line contain HTML metadata.
|
||||
* Subsequent lines until a `===` line contains JS assertions.
|
||||
* Finally the WebVTT file. Special characters can be escaped using python3 escape sequences: `\x00`, `\r`.
|
||||
|
||||
## Building Tests
|
||||
|
||||
Requirements: Python 3.2 or newer
|
||||
|
||||
```bash
|
||||
$ python3 tools/build.py
|
||||
```
|
||||
|
||||
## Spec Coverage Report
|
||||
|
||||
There is also a python implementation of the WebVTT file parser algorithm and a
|
||||
script to create a test coverage report of this implementation, under `tools/`.
|
||||
|
||||
Requirements:
|
||||
* Python 3.2 or newer
|
||||
* [Coverage.py](https://pypi.python.org/pypi/coverage)
|
||||
|
||||
Installing Coverage.py using [pip](https://pypi.python.org/pypi/pip).
|
||||
|
||||
```bash
|
||||
$ pip3 install coverage
|
||||
```
|
||||
|
||||
Generating the report:
|
||||
|
||||
```bash
|
||||
$ python3 spec_report.py
|
||||
```
|
||||
|
||||
Will output `report.html`.
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
":categories": [
|
||||
["file-parsing", "cue-text-parsing"]
|
||||
],
|
||||
":subcategories": ["tests/categories.json"]
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
<!doctype html>
|
||||
<title>WebVTT parser test: invalid signatures</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#webvtt-parser-algorithm">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
[
|
||||
// Alphabetical order, by file
|
||||
['empty', 'empty.vtt'],
|
||||
['formfeed', 'signature-formfeed.vtt'],
|
||||
['invalid whitespace', 'signature-invalid-whitespace.vtt'],
|
||||
['invalid', 'signature-invalid.vtt'],
|
||||
['lowercase', 'signature-lowercase.vtt'],
|
||||
['missing whitespace', 'signature-missing-whitespace.vtt'],
|
||||
['missing', 'signature-missing.vtt'],
|
||||
['null', 'signature-null.vtt'],
|
||||
['partial', 'signature-partial.vtt'],
|
||||
['two boms', 'signature-two-boms.vtt'],
|
||||
['websrt', 'signature-websrt.vtt'],
|
||||
].forEach(function(test_data) {
|
||||
var test_name = 'signature, ' + test_data[0];
|
||||
var test_file = 'support/' + test_data[1];
|
||||
|
||||
var test = async_test(test_name);
|
||||
test.step(function() {
|
||||
var video = document.createElement('video');
|
||||
var track = document.createElement('track');
|
||||
assert_true('src' in track, 'track element not supported');
|
||||
track.src = test_file;
|
||||
track['default'] = true;
|
||||
track.kind = 'subtitles';
|
||||
track.onload = this.step_func(trackLoaded);
|
||||
track.onerror = this.step_func(trackError);
|
||||
video.appendChild(track);
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
|
||||
function trackLoaded(event) {
|
||||
assert_unreached('track should fail to load');
|
||||
this.done();
|
||||
}
|
||||
|
||||
function trackError(e) {
|
||||
this.done();
|
||||
}
|
||||
});
|
||||
done();
|
||||
</script>
|
|
@ -0,0 +1,38 @@
|
|||
arrows
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#cue-timings-and-settings-parsing">
|
||||
|
||||
assert_equals(cues.length, 6);
|
||||
|
||||
for (var i = 0; i < cues.length; i++) {
|
||||
assert_equals(cues[i].id, '', 'Failed with cue ' + i);
|
||||
assert_equals(cues[i].text, 'text' + i, 'Failed with cue ' + i);
|
||||
}
|
||||
|
||||
===
|
||||
WEBVTT
|
||||
|
||||
-->
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text0
|
||||
foo-->
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text1
|
||||
-->foo
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text2
|
||||
--->
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text3
|
||||
-->-->
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text4
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text5
|
||||
|
||||
00:00:00.000 -a -->
|
||||
|
||||
00:00:00.000 --a -->
|
||||
|
||||
00:00:00.000 - -->
|
||||
|
||||
00:00:00.000 -- -->
|
|
@ -0,0 +1,15 @@
|
|||
header, garbage
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-a-webvtt-block">
|
||||
|
||||
assert_equals(cues.length, 1);
|
||||
|
||||
assert_equals(cues[0].text, 'text');
|
||||
assert_equals(cues[0].startTime, 0);
|
||||
assert_equals(cues[0].endTime, 1);
|
||||
|
||||
===
|
||||
WEBVTT
|
||||
foobar
|
||||
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text
|
|
@ -0,0 +1,14 @@
|
|||
header, space
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-a-webvtt-block">
|
||||
|
||||
assert_equals(cues.length, 1);
|
||||
|
||||
assert_equals(cues[0].text, 'text');
|
||||
assert_equals(cues[0].startTime, 0);
|
||||
assert_equals(cues[0].endTime, 1);
|
||||
|
||||
===
|
||||
WEBVTT
|
||||
\x20
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text
|
|
@ -0,0 +1,14 @@
|
|||
header, tab
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-a-webvtt-block">
|
||||
|
||||
assert_equals(cues.length, 1);
|
||||
|
||||
assert_equals(cues[0].text, 'text');
|
||||
assert_equals(cues[0].startTime, 0);
|
||||
assert_equals(cues[0].endTime, 1);
|
||||
|
||||
===
|
||||
WEBVTT
|
||||
\t
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text
|
|
@ -0,0 +1,13 @@
|
|||
header, timings
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-a-webvtt-block">
|
||||
|
||||
assert_equals(cues.length, 1);
|
||||
|
||||
assert_equals(cues[0].text, 'text');
|
||||
assert_equals(cues[0].startTime, 0);
|
||||
assert_equals(cues[0].endTime, 1);
|
||||
|
||||
===
|
||||
WEBVTT
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text
|
|
@ -0,0 +1,32 @@
|
|||
ids
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-a-webvtt-block">
|
||||
|
||||
assert_equals(cues.length, 5);
|
||||
assert_equals(cues[0].id, " leading space");
|
||||
assert_equals(cues[1].id, "trailing space ");
|
||||
assert_equals(cues[2].id, "-- >");
|
||||
assert_equals(cues[3].id, "->");
|
||||
assert_equals(cues[4].id, " ");
|
||||
|
||||
===
|
||||
WEBVTT
|
||||
|
||||
\x20leading space
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text0
|
||||
|
||||
trailing space\x20
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text1
|
||||
|
||||
-- >
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text2
|
||||
|
||||
->
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text3
|
||||
|
||||
\x20
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text4
|
|
@ -0,0 +1,36 @@
|
|||
newlines
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#webvtt-parser-algorithm">
|
||||
|
||||
assert_equals(cues.length, 4);
|
||||
|
||||
assert_equals(cues[0].id, "cr");
|
||||
assert_equals(cues[0].text, "text0");
|
||||
|
||||
assert_equals(cues[1].id, "lf");
|
||||
assert_equals(cues[1].text, "text1");
|
||||
|
||||
assert_equals(cues[2].id, "crlf");
|
||||
assert_equals(cues[2].text, "text2");
|
||||
|
||||
assert_equals(cues[3].id, "lfcr");
|
||||
assert_equals(cues[3].text, "text3");
|
||||
|
||||
===
|
||||
WEBVTT\r\
|
||||
\r\
|
||||
cr\r\
|
||||
00:00:00.000 --> 00:00:01.000\r\
|
||||
text0\n\
|
||||
\n\
|
||||
lf\n\
|
||||
00:00:00.000 --> 00:00:01.000\n\
|
||||
text1\r\n\
|
||||
\r\n\
|
||||
crlf\r\n\
|
||||
00:00:00.000 --> 00:00:01.000\r\n\
|
||||
text2\n\
|
||||
\r\
|
||||
lfcr\r\
|
||||
00:00:00.000 --> 00:00:01.000\n\
|
||||
text3\n\
|
||||
\r
|
|
@ -0,0 +1,232 @@
|
|||
nulls
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#webvtt-parser-algorithm">
|
||||
|
||||
assert_equals(cues.length, 7, cues);
|
||||
|
||||
assert_equals(cues[0].id, "");
|
||||
assert_equals(cues[0].text, "text0");
|
||||
|
||||
assert_equals(cues[1].id, "\uFFFD (null in id)");
|
||||
assert_equals(cues[1].text, "text1");
|
||||
|
||||
assert_equals(cues[2].id, "\uFFFD (null in cue data)");
|
||||
assert_equals(cues[2].text, "\uFFFDtext\uFFFD2");
|
||||
|
||||
assert_equals(cues[3].align, "center");
|
||||
assert_equals(cues[3].text, "text3");
|
||||
|
||||
assert_equals(cues[4].align, "center");
|
||||
assert_equals(cues[4].text, "text4");
|
||||
|
||||
assert_equals(cues[5].align, "center");
|
||||
assert_equals(cues[5].text, "text5");
|
||||
|
||||
assert_equals(cues[6].align, "end");
|
||||
assert_equals(cues[6].text, "text6");
|
||||
|
||||
===
|
||||
WEBVTT
|
||||
\x00
|
||||
(null in previous line should make this line also part of the header)
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text0
|
||||
|
||||
\x00 (null in id)
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text1
|
||||
|
||||
\uFFFD (null in cue data)
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
\uFFFDtext\x002
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 align\x00:end
|
||||
text3
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 align:end\x00
|
||||
text4
|
||||
|
||||
00:00:00.000 --> 00:00:01.000\x00align:end
|
||||
text5
|
||||
|
||||
00:00:00.000 --> 00:00:01.000\x00 align:end
|
||||
text6
|
||||
|
||||
00:00:00.000\x00 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 -->\x0000:00:01.000
|
||||
invalid
|
||||
|
||||
\x0000:00:00.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
0\x000:00:00.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00\x00:00:00.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:\x0000:00.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:0\x000:00.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00\x00:00.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:\x0000.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:0\x000.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00\x00.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.\x00000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.0\x0000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.00\x000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000\x00 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 \x00--> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 -\x00-> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --\x00> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 -->\x00 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> \x0000:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 0\x000:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00\x00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:\x0000:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:0\x000:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:00\x00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:00:\x0001.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:00:0\x001.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:00:01\x00.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:00:01.\x00000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:00:01.0\x0000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:00:01.00\x000
|
||||
invalid
|
||||
|
||||
\x000:00:00.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
0\x00:00:00.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00\x0000:00.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:\x000:00.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:0\x00:00.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00\x0000.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:\x000.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:0\x00.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00\x00000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.\x0000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.0\x000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.00\x00 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000\x00--> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 \x00-> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 -\x00> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --\x00 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 -->\x0000:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> \x000:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 0\x00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00\x0000:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:\x000:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:0\x00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:00\x0001.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:00:\x001.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:00:0\x00.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:00:01\x00000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:00:01.\x0000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:00:01.0\x000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:00:01.00\x00
|
||||
invalid
|
|
@ -0,0 +1,52 @@
|
|||
regions, id
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-webvtt-region-settings">
|
||||
|
||||
assert_equals(cues.length, 4);
|
||||
|
||||
var region1 = cues[0].region;
|
||||
assert_equals(region1.lines, 2);
|
||||
|
||||
var region2 = cues[1].region;
|
||||
assert_equals(region2.lines, 1);
|
||||
|
||||
var region3 = cues[2].region;
|
||||
assert_equals(region3.lines, 3);
|
||||
|
||||
var region4 = cues[3].region;
|
||||
assert_equals(region4.lines, 4);
|
||||
|
||||
===
|
||||
WEBVTT
|
||||
|
||||
NOTE No API for accessing region ids, so using lines to uniquely identify regions
|
||||
|
||||
REGION
|
||||
id:foo
|
||||
id:bar
|
||||
lines:1
|
||||
|
||||
REGION
|
||||
id:bar id:foo
|
||||
lines:2
|
||||
|
||||
REGION
|
||||
id:id
|
||||
id: foo
|
||||
id :bar
|
||||
lines:3
|
||||
|
||||
REGION
|
||||
id:\v
|
||||
lines:4
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:foo
|
||||
valid
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:bar
|
||||
valid
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:id
|
||||
valid
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:\v
|
||||
valid
|
|
@ -0,0 +1,129 @@
|
|||
regions, lines
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-webvtt-region-settings">
|
||||
|
||||
assert_equals(cues.length, 13);
|
||||
|
||||
var regions = Array.from(cues).map(function(cue) {
|
||||
return cue.region;
|
||||
});
|
||||
|
||||
var valid_lines = [
|
||||
0,
|
||||
1,
|
||||
100,
|
||||
101,
|
||||
65536,
|
||||
4294967296,
|
||||
18446744073709552000,
|
||||
10000000000000000000000000000000000,
|
||||
2,
|
||||
];
|
||||
valid_lines.forEach(function(valid, index) {
|
||||
assert_equals(regions[index].lines, valid, 'Failed with region ' + index);
|
||||
});
|
||||
|
||||
for (var i = 0; i < 4; i++) {
|
||||
var index = valid_lines.length + i;
|
||||
|
||||
assert_equals(regions[index].lines, 3, 'Failed with region ' + index);
|
||||
}
|
||||
|
||||
===
|
||||
WEBVTT
|
||||
|
||||
NOTE valid
|
||||
|
||||
REGION
|
||||
id:1
|
||||
lines:0
|
||||
|
||||
REGION
|
||||
id:2
|
||||
lines:1
|
||||
|
||||
REGION
|
||||
id:3
|
||||
lines:100
|
||||
|
||||
REGION
|
||||
id:4
|
||||
lines:101
|
||||
|
||||
REGION
|
||||
id:5
|
||||
lines:65536
|
||||
|
||||
REGION
|
||||
id:6
|
||||
lines:4294967296
|
||||
|
||||
REGION
|
||||
id:7
|
||||
lines:18446744073709552000
|
||||
|
||||
REGION
|
||||
id:8
|
||||
lines:10000000000000000000000000000000000
|
||||
|
||||
REGION
|
||||
id:9
|
||||
lines:1 lines:3
|
||||
lines:2
|
||||
|
||||
NOTE invalid
|
||||
|
||||
REGION
|
||||
id:10
|
||||
lines:-0
|
||||
|
||||
REGION
|
||||
id:11
|
||||
lines:1.5
|
||||
|
||||
REGION
|
||||
id:12
|
||||
lines:-1
|
||||
|
||||
REGION
|
||||
id:13
|
||||
lines: 1
|
||||
lines :1
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:1
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:2
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:3
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:4
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:5
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:6
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:7
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:8
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:9
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:10
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:11
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:12
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:13
|
||||
text
|
|
@ -0,0 +1,18 @@
|
|||
regions, old
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-webvtt-region-settings">
|
||||
|
||||
assert_equals(cues.length, 2);
|
||||
|
||||
assert_equals(cues[0].region, null);
|
||||
assert_equals(cues[1].region, null);
|
||||
|
||||
===
|
||||
WEBVTT
|
||||
Region: id=foo width=40% lines=3 regionanchor=0%,100% viewportanchor=10%,90% scroll=up
|
||||
Region: id=bar width=40% lines=3 regionanchor=100%,100% viewportanchor=90%,90% scroll=up
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:foo
|
||||
text0
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:bar
|
||||
text1
|
|
@ -0,0 +1,182 @@
|
|||
regions, regionanchor
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-webvtt-region-settings">
|
||||
|
||||
assert_equals(cues.length, 20);
|
||||
|
||||
var regions = Array.from(cues).map(function(cue) {
|
||||
return cue.region;
|
||||
});
|
||||
|
||||
var valid_anchors = [
|
||||
[0, 100],
|
||||
[0, 0],
|
||||
[1, 1],
|
||||
[100, 0],
|
||||
[0, 100],
|
||||
[100, 100],
|
||||
];
|
||||
valid_anchors.forEach(function(pair, index) {
|
||||
var anchorX = pair[0];
|
||||
var anchorY = pair[1];
|
||||
|
||||
assert_equals(regions[index].regionAnchorX, anchorX, 'Failed with region ' + index);
|
||||
assert_equals(regions[index].regionAnchorY, anchorY, 'Failed with region ' + index);
|
||||
});
|
||||
|
||||
for (var i = 0; i < 14; i++) {
|
||||
var index = valid_anchors.length + i;
|
||||
|
||||
assert_equals(regions[index].regionAnchorX, 0, 'Failed with region ' + index);
|
||||
assert_equals(regions[index].regionAnchorY, 100, 'Failed with region ' + index);
|
||||
}
|
||||
|
||||
===
|
||||
WEBVTT
|
||||
|
||||
NOTE valid
|
||||
|
||||
REGION
|
||||
id:0
|
||||
|
||||
REGION
|
||||
id:1
|
||||
regionanchor:0%,0%
|
||||
|
||||
REGION
|
||||
id:2
|
||||
regionanchor:1%,1%
|
||||
|
||||
REGION
|
||||
id:3
|
||||
regionanchor:100%,0%
|
||||
|
||||
REGION
|
||||
id:4
|
||||
regionanchor:0%,100%
|
||||
|
||||
REGION
|
||||
id:5
|
||||
regionanchor:100%,100%
|
||||
|
||||
NOTE invalid
|
||||
|
||||
REGION
|
||||
id:6
|
||||
regionanchor:0,0
|
||||
|
||||
REGION
|
||||
id:7
|
||||
regionanchor:0%,0
|
||||
|
||||
REGION
|
||||
id:8
|
||||
regionanchor:0,0%
|
||||
|
||||
REGION
|
||||
id:9
|
||||
regionanchor:1%
|
||||
|
||||
REGION
|
||||
id:10
|
||||
regionanchor:,1%
|
||||
|
||||
REGION
|
||||
id:11
|
||||
regionanchor:101%,1%
|
||||
|
||||
REGION
|
||||
id:12
|
||||
regionanchor:1%,101%
|
||||
|
||||
REGION
|
||||
id:13
|
||||
regionanchor:-0%,0%
|
||||
|
||||
REGION
|
||||
id:14
|
||||
regionanchor:0%,-0%
|
||||
|
||||
REGION
|
||||
id:15
|
||||
regionanchor:65536%,65536%
|
||||
|
||||
REGION
|
||||
id:16
|
||||
regionanchor:4294967296%,4294967296%
|
||||
|
||||
REGION
|
||||
id:17
|
||||
regionanchor:18446744073709552000%,18446744073709552000%
|
||||
|
||||
REGION
|
||||
id:18
|
||||
regionanchor:10000000000000000000000000000000000%,10000000000000000000000000000000000%
|
||||
|
||||
REGION
|
||||
id:19
|
||||
regionanchor: 100%,100%
|
||||
regionanchor :100%,100%
|
||||
regionanchor:100% ,100%
|
||||
regionanchor:100%, 100%
|
||||
regionanchor:100 %,100%
|
||||
regionanchor:100%,100 %
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:0
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:1
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:2
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:3
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:4
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:5
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:6
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:7
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:8
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:9
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:10
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:11
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:12
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:13
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:14
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:15
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:16
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:17
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:18
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:19
|
||||
text
|
|
@ -0,0 +1,67 @@
|
|||
regions, scroll
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-webvtt-region-settings">
|
||||
|
||||
assert_equals(cues.length, 6);
|
||||
|
||||
var regions = Array.from(cues).map(function(cue) {
|
||||
return cue.region;
|
||||
});
|
||||
|
||||
var valid_lines = [
|
||||
'',
|
||||
'up',
|
||||
'up',
|
||||
'',
|
||||
'',
|
||||
'up',
|
||||
].forEach(function(valid, index) {
|
||||
assert_equals(regions[index].scroll, valid, 'Failed with region ' + index);
|
||||
});
|
||||
|
||||
===
|
||||
WEBVTT
|
||||
|
||||
REGION
|
||||
id:0
|
||||
|
||||
REGION
|
||||
id:1
|
||||
scroll:up
|
||||
|
||||
REGION
|
||||
id:2
|
||||
scroll:up scroll:up scroll:up scroll:up scroll:up scroll:up scroll:up scroll:up
|
||||
scroll:up scroll:up scroll:up scroll:up scroll:up scroll:up scroll:up scroll:up
|
||||
|
||||
REGION
|
||||
id:3
|
||||
scroll:down
|
||||
scroll:left
|
||||
scroll:right
|
||||
|
||||
REGION
|
||||
id:4
|
||||
scroll: up
|
||||
scroll :up
|
||||
|
||||
REGION
|
||||
id:5
|
||||
scroll:up scroll:
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:0
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:1
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:2
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:3
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:4
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:5
|
||||
text
|
|
@ -0,0 +1,182 @@
|
|||
regions, viewportanchor
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-webvtt-region-settings">
|
||||
|
||||
assert_equals(cues.length, 20);
|
||||
|
||||
var regions = Array.from(cues).map(function(cue) {
|
||||
return cue.region;
|
||||
});
|
||||
|
||||
var valid_anchors = [
|
||||
[0, 100],
|
||||
[0, 0],
|
||||
[1, 1],
|
||||
[100, 0],
|
||||
[0, 100],
|
||||
[100, 100],
|
||||
];
|
||||
valid_anchors.forEach(function(pair, index) {
|
||||
var anchorX = pair[0];
|
||||
var anchorY = pair[1];
|
||||
|
||||
assert_equals(regions[index].viewportAnchorX, anchorX, 'Failed with region ' + index);
|
||||
assert_equals(regions[index].viewportAnchorY, anchorY, 'Failed with region ' + index);
|
||||
});
|
||||
|
||||
for (var i = 0; i < 14; i++) {
|
||||
var index = valid_anchors.length + i;
|
||||
|
||||
assert_equals(regions[index].viewportAnchorX, 0, 'Failed with region ' + index);
|
||||
assert_equals(regions[index].viewportAnchorY, 100, 'Failed with region ' + index);
|
||||
}
|
||||
|
||||
===
|
||||
WEBVTT
|
||||
|
||||
NOTE valid
|
||||
|
||||
REGION
|
||||
id:0
|
||||
|
||||
REGION
|
||||
id:1
|
||||
viewportanchor:0%,0%
|
||||
|
||||
REGION
|
||||
id:2
|
||||
viewportanchor:1%,1%
|
||||
|
||||
REGION
|
||||
id:3
|
||||
viewportanchor:100%,0%
|
||||
|
||||
REGION
|
||||
id:4
|
||||
viewportanchor:0%,100%
|
||||
|
||||
REGION
|
||||
id:5
|
||||
viewportanchor:100%,100%
|
||||
|
||||
NOTE invalid
|
||||
|
||||
REGION
|
||||
id:6
|
||||
viewportanchor:0,0
|
||||
|
||||
REGION
|
||||
id:7
|
||||
viewportanchor:0%,0
|
||||
|
||||
REGION
|
||||
id:8
|
||||
viewportanchor:0,0%
|
||||
|
||||
REGION
|
||||
id:9
|
||||
viewportanchor:1%
|
||||
|
||||
REGION
|
||||
id:10
|
||||
viewportanchor:,1%
|
||||
|
||||
REGION
|
||||
id:11
|
||||
viewportanchor:101%,1%
|
||||
|
||||
REGION
|
||||
id:12
|
||||
viewportanchor:1%,101%
|
||||
|
||||
REGION
|
||||
id:13
|
||||
viewportanchor:-0%,0%
|
||||
|
||||
REGION
|
||||
id:14
|
||||
viewportanchor:0%,-0%
|
||||
|
||||
REGION
|
||||
id:15
|
||||
viewportanchor:65536%,65536%
|
||||
|
||||
REGION
|
||||
id:16
|
||||
viewportanchor:4294967296%,4294967296%
|
||||
|
||||
REGION
|
||||
id:17
|
||||
viewportanchor:18446744073709552000%,18446744073709552000%
|
||||
|
||||
REGION
|
||||
id:18
|
||||
viewportanchor:10000000000000000000000000000000000%,10000000000000000000000000000000000%
|
||||
|
||||
REGION
|
||||
id:19
|
||||
viewportanchor: 100%,100%
|
||||
viewportanchor :100%,100%
|
||||
viewportanchor:100% ,100%
|
||||
viewportanchor:100%, 100%
|
||||
viewportanchor:100 %,100%
|
||||
viewportanchor:100%,100 %
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:0
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:1
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:2
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:3
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:4
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:5
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:6
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:7
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:8
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:9
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:10
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:11
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:12
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:13
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:14
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:15
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:16
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:17
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:18
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:19
|
||||
text
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,223 @@
|
|||
settings, line
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-webvtt-cue-timings-and-settings">
|
||||
|
||||
assert_equals(cues.length, 46);
|
||||
|
||||
// Test starts with simple valid values
|
||||
var valid_values = [
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
100,
|
||||
101,
|
||||
65536,
|
||||
4294967296,
|
||||
18446744073709552000,
|
||||
10000000000000000000000000000000000,
|
||||
1.5,
|
||||
Number.MAX_VALUE,
|
||||
-1 * Number.MAX_VALUE,
|
||||
Number.MIN_VALUE,
|
||||
0, // Less than Number.MIN_VALUE
|
||||
];
|
||||
valid_values.forEach(function(valid, index) {
|
||||
assert_equals(cues[index].line, valid, 'Failed with cue ' + index);
|
||||
assert_true(cues[index].snapToLines, 'Failed with cue ' + index);
|
||||
});
|
||||
|
||||
// Then a set of invalid ones
|
||||
var invalid_length = 23;
|
||||
for (var i = 0; i < invalid_length; i++) {
|
||||
var index = valid_values.length + i;
|
||||
|
||||
assert_equals(cues[index].line, 'auto', 'Failed with cue ' + index);
|
||||
assert_true(cues[index].snapToLines, 'Failed with cue ' + index);
|
||||
}
|
||||
|
||||
// Then more specific tests
|
||||
var index = valid_values.length + invalid_length;
|
||||
|
||||
assert_equals(cues[index].line, 0);
|
||||
assert_false(cues[index].snapToLines);
|
||||
|
||||
assert_equals(cues[index + 1].line, 0);
|
||||
assert_false(cues[index + 1].snapToLines);
|
||||
|
||||
assert_equals(cues[index + 2].line, 100);
|
||||
assert_false(cues[index + 2].snapToLines);
|
||||
assert_equals(cues[index + 2].lineAlign, 'start');
|
||||
|
||||
assert_equals(cues[index + 3].line, 100);
|
||||
assert_false(cues[index + 3].snapToLines);
|
||||
assert_equals(cues[index + 3].lineAlign, 'start');
|
||||
|
||||
assert_equals(cues[index + 4].line, 100);
|
||||
assert_false(cues[index + 4].snapToLines);
|
||||
assert_equals(cues[index + 4].lineAlign, 'center');
|
||||
|
||||
assert_equals(cues[index + 5].line, 100);
|
||||
assert_false(cues[index + 5].snapToLines);
|
||||
assert_equals(cues[index + 5].lineAlign, 'end');
|
||||
|
||||
assert_equals(cues[index + 6].line, Number.MIN_VALUE);
|
||||
assert_false(cues[index + 6].snapToLines);
|
||||
|
||||
assert_equals(cues[index + 7].line, 0);
|
||||
assert_false(cues[index + 7].snapToLines);
|
||||
|
||||
===
|
||||
WEBVTT
|
||||
|
||||
NOTE valid
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:-1
|
||||
valid0
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:0
|
||||
valid1
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:-0
|
||||
valid2
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:1
|
||||
valid3
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:100
|
||||
valid4
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:101
|
||||
valid5
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:65536
|
||||
valid6
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:4294967296
|
||||
valid7
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:18446744073709552000
|
||||
valid8
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:10000000000000000000000000000000000
|
||||
valid9
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:1.5
|
||||
valid10
|
||||
|
||||
Number.MAX_VALUE
|
||||
00:00:00.000 --> 00:00:01.000 line:179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
valid11
|
||||
|
||||
-1 * Number.MAX_VALUE
|
||||
00:00:00.000 --> 00:00:01.000 line:-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
valid12
|
||||
|
||||
Number.MIN_VALUE
|
||||
00:00:00.000 --> 00:00:01.000 line:0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005
|
||||
valid13
|
||||
|
||||
Less than Number.MIN_VALUE
|
||||
00:00:00.000 --> 00:00:01.000 line:0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002
|
||||
valid14
|
||||
|
||||
NOTE invalid
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:65536%
|
||||
invalid15
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:4294967296%
|
||||
invalid16
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:18446744073709552000%
|
||||
invalid17
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:10000000000000000000000000000000000%
|
||||
invalid18
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:-0%
|
||||
invalid19
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:101%
|
||||
invalid20
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:1%-
|
||||
invalid21
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:1-
|
||||
invalid22
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:%1
|
||||
invalid23
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:1%%
|
||||
invalid24
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:0%0
|
||||
invalid25
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line: 0%
|
||||
invalid26
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:0%x
|
||||
invalid27
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:-
|
||||
invalid28
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:%
|
||||
invalid29
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:1..5
|
||||
invalid30
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:.5
|
||||
invalid31
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:5.
|
||||
invalid32
|
||||
|
||||
Greater than Number.MAX_VALUE
|
||||
00:00:00.000 --> 00:00:01.000 line:179769313486231590000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
invalid33
|
||||
|
||||
Less than -1 * Number.MAX_VALUE
|
||||
00:00:00.000 --> 00:00:01.000 line:-179769313486231590000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
invalid34
|
||||
|
||||
exponential notation
|
||||
00:00:00.000 --> 00:00:01.000 line:1e2
|
||||
invalid35
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:100%,middle
|
||||
invalid36
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:100%,
|
||||
invalid37
|
||||
|
||||
NOTE extra
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:0%
|
||||
text38
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:00%
|
||||
text39
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:100%
|
||||
text40
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:100%,start
|
||||
text41
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:100%,center
|
||||
text42
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:100%,end
|
||||
text43
|
||||
|
||||
Number.MIN_VALUE %
|
||||
00:00:00.000 --> 00:00:01.000 line:0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005%
|
||||
text44
|
||||
|
||||
Less than Number.MIN_VALUE %
|
||||
00:00:00.000 --> 00:00:01.000 line:0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002%
|
||||
text45
|
|
@ -0,0 +1,34 @@
|
|||
settings, multiple
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-webvtt-cue-timings-and-settings">
|
||||
|
||||
assert_equals(cues.length, 2);
|
||||
|
||||
var cue = cues[0];
|
||||
assert_equals(cue.id, 'id0');
|
||||
assert_equals(cue.text, 'text0');
|
||||
assert_equals(cue.align, 'start');
|
||||
assert_equals(cue.line, 1);
|
||||
assert_equals(cue.snapToLines, false);
|
||||
assert_equals(cue.vertical, 'lr');
|
||||
assert_equals(cue.size, 50);
|
||||
assert_equals(cue.position, 25);
|
||||
|
||||
var cue = cues[1];
|
||||
assert_equals(cue.id, 'id1');
|
||||
assert_equals(cue.text, 'text1');
|
||||
assert_equals(cue.align, 'center');
|
||||
assert_equals(cue.line, 1);
|
||||
assert_equals(cue.vertical, 'rl');
|
||||
assert_equals(cue.size, 0);
|
||||
assert_equals(cue.position, 100);
|
||||
|
||||
===
|
||||
WEBVTT
|
||||
|
||||
id0
|
||||
00:00:00.000 --> 00:00:01.000 align:start line:1% vertical:lr size:50% position:25%
|
||||
text0
|
||||
|
||||
id1
|
||||
00:00:00.000 --> 00:00:01.000 align:center line:1 vertical:rl size:0% position:100%
|
||||
text1
|
|
@ -0,0 +1,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
|
|
@ -0,0 +1,71 @@
|
|||
settings, region
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-webvtt-cue-timings-and-settings">
|
||||
|
||||
assert_equals(cues.length, 9);
|
||||
|
||||
var fooRegion = cues[0].region;
|
||||
assert_true(!!fooRegion, 'Cue 0 has invalid region');
|
||||
|
||||
var barRegion = cues[1].region;
|
||||
assert_true(!!barRegion, 'Cue 1 has invalid region');
|
||||
|
||||
assert_not_equals(fooRegion, barRegion);
|
||||
|
||||
var valid_regions = [
|
||||
fooRegion,
|
||||
barRegion,
|
||||
barRegion,
|
||||
null,
|
||||
fooRegion
|
||||
];
|
||||
valid_regions.forEach(function(valid, index) {
|
||||
assert_equals(cues[index].region, valid, 'Failed with cue ' + index);
|
||||
});
|
||||
|
||||
for (var i = 0; i < 4; i++) {
|
||||
var index = valid_regions.length + i;
|
||||
|
||||
assert_equals(cues[index].region, null);
|
||||
}
|
||||
|
||||
===
|
||||
WEBVTT
|
||||
|
||||
REGION
|
||||
id:foo
|
||||
|
||||
REGION
|
||||
id:bar
|
||||
|
||||
REGION
|
||||
id:foo
|
||||
|
||||
REGION
|
||||
width:10%
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:foo
|
||||
text0
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:bar
|
||||
text1
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:foo region:bar
|
||||
text2
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:invalid
|
||||
text3
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:invalid region:foo
|
||||
text4
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:
|
||||
invalid5
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:\x20
|
||||
invalid6
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region: foo
|
||||
invalid7
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region :foo
|
||||
invalid8
|
|
@ -0,0 +1,78 @@
|
|||
settings, size
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-webvtt-cue-timings-and-settings">
|
||||
|
||||
assert_equals(cues.length, 16);
|
||||
|
||||
var valid_sizes = [
|
||||
100,
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
100,
|
||||
50,
|
||||
1.5,
|
||||
];
|
||||
valid_sizes.forEach(function(valid, index) {
|
||||
assert_equals(cues[index].size, valid, 'Failed with cue ' + index);
|
||||
});
|
||||
|
||||
for (var i = 0; i < 9; i++) {
|
||||
var index = valid_sizes.length + i;
|
||||
|
||||
assert_equals(cues[index].size, 100, 'Failed with cue ' + index);
|
||||
}
|
||||
|
||||
===
|
||||
WEBVTT
|
||||
|
||||
NOTE valid
|
||||
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text0
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 size:1xx size:2%
|
||||
text1
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 size:0%
|
||||
text2
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 size:00%
|
||||
text3
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 size:50% size:100%
|
||||
text4
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 size:50% size:101%
|
||||
text5
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 size:1.5%
|
||||
text6
|
||||
|
||||
NOTE invalid
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 size:
|
||||
invalid7
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 size:x
|
||||
invalid8
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 size:%
|
||||
invalid9
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 size:%%
|
||||
invalid10
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 size:1%%
|
||||
invalid11
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 size:1%x
|
||||
invalid12
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 size:101%
|
||||
invalid13
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 size:-3%
|
||||
invalid14
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 size:200%
|
||||
invalid15
|
|
@ -0,0 +1,47 @@
|
|||
settings, size
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-webvtt-cue-timings-and-settings">
|
||||
|
||||
assert_equals(cues.length, 8);
|
||||
|
||||
var valid_vertical = [
|
||||
'',
|
||||
'lr',
|
||||
'rl',
|
||||
'lr',
|
||||
];
|
||||
valid_vertical.forEach(function(valid, index) {
|
||||
assert_equals(cues[index].vertical, valid, 'Failed with cue ' + index);
|
||||
});
|
||||
|
||||
for (var i = 0; i < 4; i++) {
|
||||
var index = valid_vertical.length + i;
|
||||
|
||||
assert_equals(cues[index].vertical, '', 'Failed with cue ' + index);
|
||||
}
|
||||
|
||||
===
|
||||
WEBVTT
|
||||
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text0
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 vertical:lr
|
||||
text1
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 vertical:rl
|
||||
text2
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 vertical:rl vertical:lr
|
||||
text3
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 vertical:
|
||||
invalid4
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 vertical:RL
|
||||
invalid5
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 vertical: rl
|
||||
invalid6
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 vertical:vertical-rl
|
||||
invalid7
|
|
@ -0,0 +1,7 @@
|
|||
signature, bom
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#webvtt-parser-algorithm">
|
||||
|
||||
assert_equals(cues.length, 0);
|
||||
|
||||
===
|
||||
\ufeffWEBVTT
|
|
@ -0,0 +1 @@
|
|||
WEBVTT
|
|
@ -0,0 +1 @@
|
|||
WEBVTT foo
|
|
@ -0,0 +1 @@
|
|||
VTTWEB
|
|
@ -0,0 +1 @@
|
|||
webvtt
|
|
@ -0,0 +1 @@
|
|||
WEBVTTfoo
|
|
@ -0,0 +1,2 @@
|
|||
00:00:00.000 --> 00:00:01.000
|
||||
invalid
|
|
@ -0,0 +1,7 @@
|
|||
signature, no newline
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#webvtt-parser-algorithm">
|
||||
|
||||
assert_equals(cues.length, 0);
|
||||
|
||||
===
|
||||
WEBVTT
|
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
WEBVT
|
|
@ -0,0 +1,7 @@
|
|||
signature, space, no newline
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#webvtt-parser-algorithm">
|
||||
|
||||
assert_equals(cues.length, 0);
|
||||
|
||||
===
|
||||
WEBVTT\x20
|
|
@ -0,0 +1,7 @@
|
|||
signature, space
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#webvtt-parser-algorithm">
|
||||
|
||||
assert_equals(cues.length, 0);
|
||||
|
||||
===
|
||||
WEBVTT\x20
|
|
@ -0,0 +1,7 @@
|
|||
signature, tab, no newline
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#webvtt-parser-algorithm">
|
||||
|
||||
assert_equals(cues.length, 0);
|
||||
|
||||
===
|
||||
WEBVTT\t
|
|
@ -0,0 +1,7 @@
|
|||
signature, tab
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#webvtt-parser-algorithm">
|
||||
|
||||
assert_equals(cues.length, 0);
|
||||
|
||||
===
|
||||
WEBVTT\t
|
|
@ -0,0 +1,8 @@
|
|||
signature, timings
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#webvtt-parser-algorithm">
|
||||
|
||||
assert_equals(cues.length, 0);
|
||||
|
||||
===
|
||||
WEBVTT 00:00:00.000 --> 00:00:01.000
|
||||
text
|
|
@ -0,0 +1 @@
|
|||
WEBVTT
|
|
@ -0,0 +1 @@
|
|||
WEBSRT
|
|
@ -0,0 +1,36 @@
|
|||
stylesheets, rules
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-a-webvtt-block">
|
||||
|
||||
// There's no way to test the actual style from js
|
||||
assert_equals(document.styleSheets.length, 0);
|
||||
|
||||
===
|
||||
WEBVTT
|
||||
|
||||
STYLE
|
||||
::cue(#foo) {
|
||||
width: 20px;
|
||||
} /*
|
||||
NOTE hello
|
||||
00:00:00.000 -- > 00:00:01.000
|
||||
*/
|
||||
.foo {
|
||||
width: 19px;
|
||||
}
|
||||
|
||||
.bar {
|
||||
width: 18px;
|
||||
}
|
||||
|
||||
foo
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text
|
||||
|
||||
STYLE
|
||||
::cue(::bar) {
|
||||
width: 18px;
|
||||
}
|
||||
|
||||
bar
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text
|
|
@ -0,0 +1,33 @@
|
|||
timings, 60
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-a-webvtt-timestamp">
|
||||
|
||||
assert_equals(cues.length, 2);
|
||||
|
||||
assert_equals(cues[0].text, 'text1');
|
||||
assert_equals(cues[0].startTime, 0);
|
||||
assert_equals(cues[0].endTime, 216001);
|
||||
|
||||
assert_equals(cues[1].text, 'text2');
|
||||
assert_equals(cues[1].startTime, 216000);
|
||||
assert_equals(cues[1].endTime, 216001);
|
||||
|
||||
===
|
||||
WEBVTT
|
||||
|
||||
00:00:60.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:60:00.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:00:60.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:60:00.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 60:00:01.000
|
||||
text1
|
||||
|
||||
60:00:00.000 --> 60:00:01.000
|
||||
text2
|
|
@ -0,0 +1,9 @@
|
|||
timings, eof
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-a-webvtt-timestamp">
|
||||
|
||||
assert_equals(cues.length, 0);
|
||||
|
||||
===
|
||||
WEBVTT
|
||||
|
||||
00:00:00.000 -->
|
|
@ -0,0 +1,197 @@
|
|||
timings, garbage
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-a-webvtt-timestamp">
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-webvtt-cue-timings-and-settings">
|
||||
|
||||
assert_equals(cues.length, 0);
|
||||
|
||||
===
|
||||
WEBVTT
|
||||
|
||||
x00:00:00.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
0x0:00:00.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00x:00:00.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:x00:00.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:0x0:00.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00x:00.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:x00.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:0x0.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00x.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.x000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.0x00 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.00x0 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000x --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 x--> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 -x-> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --x> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 -->x 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> x00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 0x0:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00x:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:x00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:0x0:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:00x:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:00:x01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:00:0x1.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:00:01x.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:00:01.x000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:00:01.0x00
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:00:01.00x0
|
||||
invalid
|
||||
|
||||
x0:00:00.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
0x:00:00.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00x00:00.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:x0:00.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:0x:00.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00x00.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:x0.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:0x.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00x000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.x00 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.0x0 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.00x --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000x--> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 x-> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 -x> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --x 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 -->x00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> x0:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 0x:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00x00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:x0:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:0x:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:00x01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:00:x1.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:00:0x.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:00:01x000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:00:01.x00
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:00:01.0x0
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 00:00:01.00x
|
||||
invalid
|
||||
|
||||
00.00:00.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00.00.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00:000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00.00:000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00,000 --> 00:00:01,000
|
||||
invalid
|
|
@ -0,0 +1,33 @@
|
|||
timings, negative
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-a-webvtt-timestamp">
|
||||
|
||||
assert_equals(cues.length, 4);
|
||||
|
||||
[
|
||||
[0, 0],
|
||||
[1, 0.999],
|
||||
[60, 59.999],
|
||||
[3600, 3599.999],
|
||||
].forEach(function(pair, index) {
|
||||
var startTime = pair[0];
|
||||
var endTime = pair[1];
|
||||
|
||||
assert_equals(cues[index].text, 'text' + index, 'Failed with cue ' + index);
|
||||
assert_equals(cues[index].startTime, startTime, 'Failed with cue ' + index);
|
||||
assert_equals(cues[index].endTime, endTime, 'Failed with cue ' + index);
|
||||
});
|
||||
|
||||
===
|
||||
WEBVTT
|
||||
|
||||
00:00:00.000 --> 00:00:00.000
|
||||
text0
|
||||
|
||||
00:00:01.000 --> 00:00:00.999
|
||||
text1
|
||||
|
||||
00:01:00.000 --> 00:00:59.999
|
||||
text2
|
||||
|
||||
01:00:00.000 --> 00:59:59.999
|
||||
text3
|
|
@ -0,0 +1,22 @@
|
|||
timings, omitted hours
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-a-webvtt-timestamp">
|
||||
|
||||
assert_equals(cues.length, 3);
|
||||
|
||||
Array.from(cues).forEach(function(cue, index) {
|
||||
assert_equals(cue.text, 'text' + index, 'Failed with cue ' + index);
|
||||
assert_equals(cue.startTime, 0, 'Failed with cue ' + index);
|
||||
assert_equals(cue.endTime, 1, 'Failed with cue ' + index);
|
||||
});
|
||||
|
||||
===
|
||||
WEBVTT
|
||||
|
||||
00:00.000 --> 00:00:01.000
|
||||
text0
|
||||
|
||||
00:00:00.000 --> 00:01.000
|
||||
text1
|
||||
|
||||
00:00.000 --> 00:01.000
|
||||
text2
|
|
@ -0,0 +1,60 @@
|
|||
timings, too long
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-a-webvtt-timestamp">
|
||||
|
||||
assert_equals(cues.length, 2);
|
||||
|
||||
assert_equals(cues[0].text, 'text0');
|
||||
assert_equals(cues[0].startTime, 0);
|
||||
assert_equals(cues[0].endTime, 1);
|
||||
|
||||
assert_equals(cues[1].text, 'text1');
|
||||
assert_equals(cues[1].startTime, 0);
|
||||
assert_equals(cues[1].endTime, 1);
|
||||
|
||||
===
|
||||
WEBVTT
|
||||
|
||||
000:00:00.000 --> 00:00:01.000
|
||||
text0
|
||||
|
||||
00::00:00.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:000:00.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00::00.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:000.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00..000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.0000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00.0000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
000:00.000 --> 00:01.000
|
||||
invalid
|
||||
|
||||
00::00.000 --> 00:01.000
|
||||
invalid
|
||||
|
||||
00:000.000 --> 00:01.000
|
||||
invalid
|
||||
|
||||
00:00..000 --> 00:01.000
|
||||
invalid
|
||||
|
||||
00:00.0000 --> 00:01.000
|
||||
invalid
|
||||
|
||||
00:00.000 --> 000:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 000:00:01.000
|
||||
text1
|
|
@ -0,0 +1,111 @@
|
|||
timings, too short
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-a-webvtt-timestamp">
|
||||
|
||||
assert_equals(cues.length, 2);
|
||||
|
||||
assert_equals(cues[0].text, 'text0');
|
||||
assert_equals(cues[0].startTime, 0);
|
||||
assert_equals(cues[0].endTime, 1);
|
||||
|
||||
assert_equals(cues[1].text, 'text1');
|
||||
assert_equals(cues[1].startTime, 0);
|
||||
assert_equals(cues[1].endTime, 1);
|
||||
|
||||
===
|
||||
WEBVTT
|
||||
|
||||
0:00:00.000 --> 00:00:01.000
|
||||
text0
|
||||
|
||||
0000:00.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:0:00.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:0000.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:0.000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00000 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.00 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.0 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00. --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:00 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00:0 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00: --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:00 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00:0 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00: --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
00 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
0 --> 00:00:01.000
|
||||
invalid
|
||||
|
||||
--> 00:00:01.000
|
||||
invalid
|
||||
|
||||
0:00.000 --> 00:01.000
|
||||
invalid
|
||||
|
||||
0000.000 --> 00:01.000
|
||||
invalid
|
||||
|
||||
00:0.000 --> 00:01.000
|
||||
invalid
|
||||
|
||||
00:00000 --> 00:01.000
|
||||
invalid
|
||||
|
||||
00:00.00 --> 00:01.000
|
||||
invalid
|
||||
|
||||
00:00.0 --> 00:01.000
|
||||
invalid
|
||||
|
||||
00:00. --> 00:01.000
|
||||
invalid
|
||||
|
||||
0:00. --> 00:01.000
|
||||
invalid
|
||||
|
||||
:00. --> 00:01.000
|
||||
invalid
|
||||
|
||||
00. --> 00:01.000
|
||||
invalid
|
||||
|
||||
0. --> 00:01.000
|
||||
invalid
|
||||
|
||||
. --> 00:01.000
|
||||
invalid
|
||||
|
||||
00:00.000 --> 0:01.000
|
||||
invalid
|
||||
|
||||
00:00:00.000 --> 0:00:01.000
|
||||
text1
|
|
@ -0,0 +1,32 @@
|
|||
whitespace chars
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-a-webvtt-block">
|
||||
|
||||
assert_equals(cues.length, 3);
|
||||
|
||||
assert_equals(cues[0].id, 'spaces');
|
||||
assert_equals(cues[0].text, ' text0');
|
||||
|
||||
assert_equals(cues[1].id, 'tabs');
|
||||
assert_equals(cues[1].text, 'text1');
|
||||
|
||||
assert_equals(cues[2].id, 'form feed');
|
||||
assert_equals(cues[2].text, 'text2');
|
||||
|
||||
===
|
||||
WEBVTT
|
||||
|
||||
spaces
|
||||
00:00:00.000 --> 00:00:01.000\x20
|
||||
text0
|
||||
|
||||
tabs
|
||||
\t\t\t00:00:00.000\t\t\t\t-->\t\t00:00:01.000\t
|
||||
text1
|
||||
|
||||
form feed
|
||||
\f\f\f00:00:00.000\f\f\f\f-->\f\f00:00:01.000\f
|
||||
text2
|
||||
|
||||
vertical tab
|
||||
\v\v\v00:00:00.000\v\v\v\v-->\v\v00:00:01.000\v
|
||||
invalid
|
|
@ -0,0 +1,44 @@
|
|||
<!doctype html>
|
||||
<!-- DO NOT EDIT! This file and support/arrows.vtt are generated. -->
|
||||
<!-- See /webvtt/parsing/file-parsing/README.md -->
|
||||
<meta charset=utf-8>
|
||||
<title>WebVTT parser test: arrows</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#cue-timings-and-settings-parsing">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
var t = async_test('arrows');
|
||||
t.step(function(){
|
||||
var video = document.createElement('video');
|
||||
var track = document.createElement('track');
|
||||
assert_true('src' in track, 'track element not supported');
|
||||
track.src = 'support/arrows.vtt';
|
||||
track['default'] = true;
|
||||
track.kind = 'subtitles';
|
||||
track.onload = this.step_func(trackLoaded);
|
||||
track.onerror = this.step_func(trackError);
|
||||
video.appendChild(track);
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
|
||||
function trackLoaded(event) {
|
||||
var track = event.target;
|
||||
var video = track.parentNode;
|
||||
var cues = video.textTracks[0].cues;
|
||||
{
|
||||
assert_equals(cues.length, 6);
|
||||
|
||||
for (var i = 0; i < cues.length; i++) {
|
||||
assert_equals(cues[i].id, '', 'Failed with cue ' + i);
|
||||
assert_equals(cues[i].text, 'text' + i, 'Failed with cue ' + i);
|
||||
}
|
||||
|
||||
}
|
||||
this.done();
|
||||
}
|
||||
|
||||
function trackError(e) {
|
||||
assert_unreached('got unexpected error event');
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"arrows.html": "cues",
|
||||
"ids.html": "cues",
|
||||
"settings-*.html": "cues",
|
||||
"signature-timings.html": "cues",
|
||||
"timings-*.html": "cues",
|
||||
"regions-*.html": "regions",
|
||||
"stylesheets-*.html": "stylesheets"
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
<!doctype html>
|
||||
<!-- DO NOT EDIT! This file and support/header-garbage.vtt are generated. -->
|
||||
<!-- See /webvtt/parsing/file-parsing/README.md -->
|
||||
<meta charset=utf-8>
|
||||
<title>WebVTT parser test: header, garbage</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-a-webvtt-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
var t = async_test('header, garbage');
|
||||
t.step(function(){
|
||||
var video = document.createElement('video');
|
||||
var track = document.createElement('track');
|
||||
assert_true('src' in track, 'track element not supported');
|
||||
track.src = 'support/header-garbage.vtt';
|
||||
track['default'] = true;
|
||||
track.kind = 'subtitles';
|
||||
track.onload = this.step_func(trackLoaded);
|
||||
track.onerror = this.step_func(trackError);
|
||||
video.appendChild(track);
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
|
||||
function trackLoaded(event) {
|
||||
var track = event.target;
|
||||
var video = track.parentNode;
|
||||
var cues = video.textTracks[0].cues;
|
||||
{
|
||||
assert_equals(cues.length, 1);
|
||||
|
||||
assert_equals(cues[0].text, 'text');
|
||||
assert_equals(cues[0].startTime, 0);
|
||||
assert_equals(cues[0].endTime, 1);
|
||||
|
||||
}
|
||||
this.done();
|
||||
}
|
||||
|
||||
function trackError(e) {
|
||||
assert_unreached('got unexpected error event');
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,43 @@
|
|||
<!doctype html>
|
||||
<!-- DO NOT EDIT! This file and support/header-space.vtt are generated. -->
|
||||
<!-- See /webvtt/parsing/file-parsing/README.md -->
|
||||
<meta charset=utf-8>
|
||||
<title>WebVTT parser test: header, space</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-a-webvtt-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
var t = async_test('header, space');
|
||||
t.step(function(){
|
||||
var video = document.createElement('video');
|
||||
var track = document.createElement('track');
|
||||
assert_true('src' in track, 'track element not supported');
|
||||
track.src = 'support/header-space.vtt';
|
||||
track['default'] = true;
|
||||
track.kind = 'subtitles';
|
||||
track.onload = this.step_func(trackLoaded);
|
||||
track.onerror = this.step_func(trackError);
|
||||
video.appendChild(track);
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
|
||||
function trackLoaded(event) {
|
||||
var track = event.target;
|
||||
var video = track.parentNode;
|
||||
var cues = video.textTracks[0].cues;
|
||||
{
|
||||
assert_equals(cues.length, 1);
|
||||
|
||||
assert_equals(cues[0].text, 'text');
|
||||
assert_equals(cues[0].startTime, 0);
|
||||
assert_equals(cues[0].endTime, 1);
|
||||
|
||||
}
|
||||
this.done();
|
||||
}
|
||||
|
||||
function trackError(e) {
|
||||
assert_unreached('got unexpected error event');
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,43 @@
|
|||
<!doctype html>
|
||||
<!-- DO NOT EDIT! This file and support/header-tab.vtt are generated. -->
|
||||
<!-- See /webvtt/parsing/file-parsing/README.md -->
|
||||
<meta charset=utf-8>
|
||||
<title>WebVTT parser test: header, tab</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-a-webvtt-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
var t = async_test('header, tab');
|
||||
t.step(function(){
|
||||
var video = document.createElement('video');
|
||||
var track = document.createElement('track');
|
||||
assert_true('src' in track, 'track element not supported');
|
||||
track.src = 'support/header-tab.vtt';
|
||||
track['default'] = true;
|
||||
track.kind = 'subtitles';
|
||||
track.onload = this.step_func(trackLoaded);
|
||||
track.onerror = this.step_func(trackError);
|
||||
video.appendChild(track);
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
|
||||
function trackLoaded(event) {
|
||||
var track = event.target;
|
||||
var video = track.parentNode;
|
||||
var cues = video.textTracks[0].cues;
|
||||
{
|
||||
assert_equals(cues.length, 1);
|
||||
|
||||
assert_equals(cues[0].text, 'text');
|
||||
assert_equals(cues[0].startTime, 0);
|
||||
assert_equals(cues[0].endTime, 1);
|
||||
|
||||
}
|
||||
this.done();
|
||||
}
|
||||
|
||||
function trackError(e) {
|
||||
assert_unreached('got unexpected error event');
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,43 @@
|
|||
<!doctype html>
|
||||
<!-- DO NOT EDIT! This file and support/header-timings.vtt are generated. -->
|
||||
<!-- See /webvtt/parsing/file-parsing/README.md -->
|
||||
<meta charset=utf-8>
|
||||
<title>WebVTT parser test: header, timings</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-a-webvtt-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
var t = async_test('header, timings');
|
||||
t.step(function(){
|
||||
var video = document.createElement('video');
|
||||
var track = document.createElement('track');
|
||||
assert_true('src' in track, 'track element not supported');
|
||||
track.src = 'support/header-timings.vtt';
|
||||
track['default'] = true;
|
||||
track.kind = 'subtitles';
|
||||
track.onload = this.step_func(trackLoaded);
|
||||
track.onerror = this.step_func(trackError);
|
||||
video.appendChild(track);
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
|
||||
function trackLoaded(event) {
|
||||
var track = event.target;
|
||||
var video = track.parentNode;
|
||||
var cues = video.textTracks[0].cues;
|
||||
{
|
||||
assert_equals(cues.length, 1);
|
||||
|
||||
assert_equals(cues[0].text, 'text');
|
||||
assert_equals(cues[0].startTime, 0);
|
||||
assert_equals(cues[0].endTime, 1);
|
||||
|
||||
}
|
||||
this.done();
|
||||
}
|
||||
|
||||
function trackError(e) {
|
||||
assert_unreached('got unexpected error event');
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,44 @@
|
|||
<!doctype html>
|
||||
<!-- DO NOT EDIT! This file and support/ids.vtt are generated. -->
|
||||
<!-- See /webvtt/parsing/file-parsing/README.md -->
|
||||
<meta charset=utf-8>
|
||||
<title>WebVTT parser test: ids</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-a-webvtt-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
var t = async_test('ids');
|
||||
t.step(function(){
|
||||
var video = document.createElement('video');
|
||||
var track = document.createElement('track');
|
||||
assert_true('src' in track, 'track element not supported');
|
||||
track.src = 'support/ids.vtt';
|
||||
track['default'] = true;
|
||||
track.kind = 'subtitles';
|
||||
track.onload = this.step_func(trackLoaded);
|
||||
track.onerror = this.step_func(trackError);
|
||||
video.appendChild(track);
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
|
||||
function trackLoaded(event) {
|
||||
var track = event.target;
|
||||
var video = track.parentNode;
|
||||
var cues = video.textTracks[0].cues;
|
||||
{
|
||||
assert_equals(cues.length, 5);
|
||||
assert_equals(cues[0].id, " leading space");
|
||||
assert_equals(cues[1].id, "trailing space ");
|
||||
assert_equals(cues[2].id, "-- >");
|
||||
assert_equals(cues[3].id, "->");
|
||||
assert_equals(cues[4].id, " ");
|
||||
|
||||
}
|
||||
this.done();
|
||||
}
|
||||
|
||||
function trackError(e) {
|
||||
assert_unreached('got unexpected error event');
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,51 @@
|
|||
<!doctype html>
|
||||
<!-- DO NOT EDIT! This file and support/newlines.vtt are generated. -->
|
||||
<!-- See /webvtt/parsing/file-parsing/README.md -->
|
||||
<meta charset=utf-8>
|
||||
<title>WebVTT parser test: newlines</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#webvtt-parser-algorithm">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
var t = async_test('newlines');
|
||||
t.step(function(){
|
||||
var video = document.createElement('video');
|
||||
var track = document.createElement('track');
|
||||
assert_true('src' in track, 'track element not supported');
|
||||
track.src = 'support/newlines.vtt';
|
||||
track['default'] = true;
|
||||
track.kind = 'subtitles';
|
||||
track.onload = this.step_func(trackLoaded);
|
||||
track.onerror = this.step_func(trackError);
|
||||
video.appendChild(track);
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
|
||||
function trackLoaded(event) {
|
||||
var track = event.target;
|
||||
var video = track.parentNode;
|
||||
var cues = video.textTracks[0].cues;
|
||||
{
|
||||
assert_equals(cues.length, 4);
|
||||
|
||||
assert_equals(cues[0].id, "cr");
|
||||
assert_equals(cues[0].text, "text0");
|
||||
|
||||
assert_equals(cues[1].id, "lf");
|
||||
assert_equals(cues[1].text, "text1");
|
||||
|
||||
assert_equals(cues[2].id, "crlf");
|
||||
assert_equals(cues[2].text, "text2");
|
||||
|
||||
assert_equals(cues[3].id, "lfcr");
|
||||
assert_equals(cues[3].text, "text3");
|
||||
|
||||
}
|
||||
this.done();
|
||||
}
|
||||
|
||||
function trackError(e) {
|
||||
assert_unreached('got unexpected error event');
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,60 @@
|
|||
<!doctype html>
|
||||
<!-- DO NOT EDIT! This file and support/nulls.vtt are generated. -->
|
||||
<!-- See /webvtt/parsing/file-parsing/README.md -->
|
||||
<meta charset=utf-8>
|
||||
<title>WebVTT parser test: nulls</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#webvtt-parser-algorithm">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
var t = async_test('nulls');
|
||||
t.step(function(){
|
||||
var video = document.createElement('video');
|
||||
var track = document.createElement('track');
|
||||
assert_true('src' in track, 'track element not supported');
|
||||
track.src = 'support/nulls.vtt';
|
||||
track['default'] = true;
|
||||
track.kind = 'subtitles';
|
||||
track.onload = this.step_func(trackLoaded);
|
||||
track.onerror = this.step_func(trackError);
|
||||
video.appendChild(track);
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
|
||||
function trackLoaded(event) {
|
||||
var track = event.target;
|
||||
var video = track.parentNode;
|
||||
var cues = video.textTracks[0].cues;
|
||||
{
|
||||
assert_equals(cues.length, 7, cues);
|
||||
|
||||
assert_equals(cues[0].id, "");
|
||||
assert_equals(cues[0].text, "text0");
|
||||
|
||||
assert_equals(cues[1].id, "\uFFFD (null in id)");
|
||||
assert_equals(cues[1].text, "text1");
|
||||
|
||||
assert_equals(cues[2].id, "\uFFFD (null in cue data)");
|
||||
assert_equals(cues[2].text, "\uFFFDtext\uFFFD2");
|
||||
|
||||
assert_equals(cues[3].align, "center");
|
||||
assert_equals(cues[3].text, "text3");
|
||||
|
||||
assert_equals(cues[4].align, "center");
|
||||
assert_equals(cues[4].text, "text4");
|
||||
|
||||
assert_equals(cues[5].align, "center");
|
||||
assert_equals(cues[5].text, "text5");
|
||||
|
||||
assert_equals(cues[6].align, "end");
|
||||
assert_equals(cues[6].text, "text6");
|
||||
|
||||
}
|
||||
this.done();
|
||||
}
|
||||
|
||||
function trackError(e) {
|
||||
assert_unreached('got unexpected error event');
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,51 @@
|
|||
<!doctype html>
|
||||
<!-- DO NOT EDIT! This file and support/regions-id.vtt are generated. -->
|
||||
<!-- See /webvtt/parsing/file-parsing/README.md -->
|
||||
<meta charset=utf-8>
|
||||
<title>WebVTT parser test: regions, id</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-webvtt-region-settings">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
var t = async_test('regions, id');
|
||||
t.step(function(){
|
||||
var video = document.createElement('video');
|
||||
var track = document.createElement('track');
|
||||
assert_true('src' in track, 'track element not supported');
|
||||
track.src = 'support/regions-id.vtt';
|
||||
track['default'] = true;
|
||||
track.kind = 'subtitles';
|
||||
track.onload = this.step_func(trackLoaded);
|
||||
track.onerror = this.step_func(trackError);
|
||||
video.appendChild(track);
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
|
||||
function trackLoaded(event) {
|
||||
var track = event.target;
|
||||
var video = track.parentNode;
|
||||
var cues = video.textTracks[0].cues;
|
||||
{
|
||||
assert_equals(cues.length, 4);
|
||||
|
||||
var region1 = cues[0].region;
|
||||
assert_equals(region1.lines, 2);
|
||||
|
||||
var region2 = cues[1].region;
|
||||
assert_equals(region2.lines, 1);
|
||||
|
||||
var region3 = cues[2].region;
|
||||
assert_equals(region3.lines, 3);
|
||||
|
||||
var region4 = cues[3].region;
|
||||
assert_equals(region4.lines, 4);
|
||||
|
||||
}
|
||||
this.done();
|
||||
}
|
||||
|
||||
function trackError(e) {
|
||||
assert_unreached('got unexpected error event');
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,64 @@
|
|||
<!doctype html>
|
||||
<!-- DO NOT EDIT! This file and support/regions-lines.vtt are generated. -->
|
||||
<!-- See /webvtt/parsing/file-parsing/README.md -->
|
||||
<meta charset=utf-8>
|
||||
<title>WebVTT parser test: regions, lines</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-webvtt-region-settings">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
var t = async_test('regions, lines');
|
||||
t.step(function(){
|
||||
var video = document.createElement('video');
|
||||
var track = document.createElement('track');
|
||||
assert_true('src' in track, 'track element not supported');
|
||||
track.src = 'support/regions-lines.vtt';
|
||||
track['default'] = true;
|
||||
track.kind = 'subtitles';
|
||||
track.onload = this.step_func(trackLoaded);
|
||||
track.onerror = this.step_func(trackError);
|
||||
video.appendChild(track);
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
|
||||
function trackLoaded(event) {
|
||||
var track = event.target;
|
||||
var video = track.parentNode;
|
||||
var cues = video.textTracks[0].cues;
|
||||
{
|
||||
assert_equals(cues.length, 13);
|
||||
|
||||
var regions = Array.from(cues).map(function(cue) {
|
||||
return cue.region;
|
||||
});
|
||||
|
||||
var valid_lines = [
|
||||
0,
|
||||
1,
|
||||
100,
|
||||
101,
|
||||
65536,
|
||||
4294967296,
|
||||
18446744073709552000,
|
||||
10000000000000000000000000000000000,
|
||||
2,
|
||||
];
|
||||
valid_lines.forEach(function(valid, index) {
|
||||
assert_equals(regions[index].lines, valid, 'Failed with region ' + index);
|
||||
});
|
||||
|
||||
for (var i = 0; i < 4; i++) {
|
||||
var index = valid_lines.length + i;
|
||||
|
||||
assert_equals(regions[index].lines, 3, 'Failed with region ' + index);
|
||||
}
|
||||
|
||||
}
|
||||
this.done();
|
||||
}
|
||||
|
||||
function trackError(e) {
|
||||
assert_unreached('got unexpected error event');
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,42 @@
|
|||
<!doctype html>
|
||||
<!-- DO NOT EDIT! This file and support/regions-old.vtt are generated. -->
|
||||
<!-- See /webvtt/parsing/file-parsing/README.md -->
|
||||
<meta charset=utf-8>
|
||||
<title>WebVTT parser test: regions, old</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-webvtt-region-settings">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
var t = async_test('regions, old');
|
||||
t.step(function(){
|
||||
var video = document.createElement('video');
|
||||
var track = document.createElement('track');
|
||||
assert_true('src' in track, 'track element not supported');
|
||||
track.src = 'support/regions-old.vtt';
|
||||
track['default'] = true;
|
||||
track.kind = 'subtitles';
|
||||
track.onload = this.step_func(trackLoaded);
|
||||
track.onerror = this.step_func(trackError);
|
||||
video.appendChild(track);
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
|
||||
function trackLoaded(event) {
|
||||
var track = event.target;
|
||||
var video = track.parentNode;
|
||||
var cues = video.textTracks[0].cues;
|
||||
{
|
||||
assert_equals(cues.length, 2);
|
||||
|
||||
assert_equals(cues[0].region, null);
|
||||
assert_equals(cues[1].region, null);
|
||||
|
||||
}
|
||||
this.done();
|
||||
}
|
||||
|
||||
function trackError(e) {
|
||||
assert_unreached('got unexpected error event');
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,66 @@
|
|||
<!doctype html>
|
||||
<!-- DO NOT EDIT! This file and support/regions-regionanchor.vtt are generated. -->
|
||||
<!-- See /webvtt/parsing/file-parsing/README.md -->
|
||||
<meta charset=utf-8>
|
||||
<title>WebVTT parser test: regions, regionanchor</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-webvtt-region-settings">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
var t = async_test('regions, regionanchor');
|
||||
t.step(function(){
|
||||
var video = document.createElement('video');
|
||||
var track = document.createElement('track');
|
||||
assert_true('src' in track, 'track element not supported');
|
||||
track.src = 'support/regions-regionanchor.vtt';
|
||||
track['default'] = true;
|
||||
track.kind = 'subtitles';
|
||||
track.onload = this.step_func(trackLoaded);
|
||||
track.onerror = this.step_func(trackError);
|
||||
video.appendChild(track);
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
|
||||
function trackLoaded(event) {
|
||||
var track = event.target;
|
||||
var video = track.parentNode;
|
||||
var cues = video.textTracks[0].cues;
|
||||
{
|
||||
assert_equals(cues.length, 20);
|
||||
|
||||
var regions = Array.from(cues).map(function(cue) {
|
||||
return cue.region;
|
||||
});
|
||||
|
||||
var valid_anchors = [
|
||||
[0, 100],
|
||||
[0, 0],
|
||||
[1, 1],
|
||||
[100, 0],
|
||||
[0, 100],
|
||||
[100, 100],
|
||||
];
|
||||
valid_anchors.forEach(function(pair, index) {
|
||||
var anchorX = pair[0];
|
||||
var anchorY = pair[1];
|
||||
|
||||
assert_equals(regions[index].regionAnchorX, anchorX, 'Failed with region ' + index);
|
||||
assert_equals(regions[index].regionAnchorY, anchorY, 'Failed with region ' + index);
|
||||
});
|
||||
|
||||
for (var i = 0; i < 14; i++) {
|
||||
var index = valid_anchors.length + i;
|
||||
|
||||
assert_equals(regions[index].regionAnchorX, 0, 'Failed with region ' + index);
|
||||
assert_equals(regions[index].regionAnchorY, 100, 'Failed with region ' + index);
|
||||
}
|
||||
|
||||
}
|
||||
this.done();
|
||||
}
|
||||
|
||||
function trackError(e) {
|
||||
assert_unreached('got unexpected error event');
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,54 @@
|
|||
<!doctype html>
|
||||
<!-- DO NOT EDIT! This file and support/regions-scroll.vtt are generated. -->
|
||||
<!-- See /webvtt/parsing/file-parsing/README.md -->
|
||||
<meta charset=utf-8>
|
||||
<title>WebVTT parser test: regions, scroll</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-webvtt-region-settings">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
var t = async_test('regions, scroll');
|
||||
t.step(function(){
|
||||
var video = document.createElement('video');
|
||||
var track = document.createElement('track');
|
||||
assert_true('src' in track, 'track element not supported');
|
||||
track.src = 'support/regions-scroll.vtt';
|
||||
track['default'] = true;
|
||||
track.kind = 'subtitles';
|
||||
track.onload = this.step_func(trackLoaded);
|
||||
track.onerror = this.step_func(trackError);
|
||||
video.appendChild(track);
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
|
||||
function trackLoaded(event) {
|
||||
var track = event.target;
|
||||
var video = track.parentNode;
|
||||
var cues = video.textTracks[0].cues;
|
||||
{
|
||||
assert_equals(cues.length, 6);
|
||||
|
||||
var regions = Array.from(cues).map(function(cue) {
|
||||
return cue.region;
|
||||
});
|
||||
|
||||
var valid_lines = [
|
||||
'',
|
||||
'up',
|
||||
'up',
|
||||
'',
|
||||
'',
|
||||
'up',
|
||||
].forEach(function(valid, index) {
|
||||
assert_equals(regions[index].scroll, valid, 'Failed with region ' + index);
|
||||
});
|
||||
|
||||
}
|
||||
this.done();
|
||||
}
|
||||
|
||||
function trackError(e) {
|
||||
assert_unreached('got unexpected error event');
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,66 @@
|
|||
<!doctype html>
|
||||
<!-- DO NOT EDIT! This file and support/regions-viewportanchor.vtt are generated. -->
|
||||
<!-- See /webvtt/parsing/file-parsing/README.md -->
|
||||
<meta charset=utf-8>
|
||||
<title>WebVTT parser test: regions, viewportanchor</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-webvtt-region-settings">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
var t = async_test('regions, viewportanchor');
|
||||
t.step(function(){
|
||||
var video = document.createElement('video');
|
||||
var track = document.createElement('track');
|
||||
assert_true('src' in track, 'track element not supported');
|
||||
track.src = 'support/regions-viewportanchor.vtt';
|
||||
track['default'] = true;
|
||||
track.kind = 'subtitles';
|
||||
track.onload = this.step_func(trackLoaded);
|
||||
track.onerror = this.step_func(trackError);
|
||||
video.appendChild(track);
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
|
||||
function trackLoaded(event) {
|
||||
var track = event.target;
|
||||
var video = track.parentNode;
|
||||
var cues = video.textTracks[0].cues;
|
||||
{
|
||||
assert_equals(cues.length, 20);
|
||||
|
||||
var regions = Array.from(cues).map(function(cue) {
|
||||
return cue.region;
|
||||
});
|
||||
|
||||
var valid_anchors = [
|
||||
[0, 100],
|
||||
[0, 0],
|
||||
[1, 1],
|
||||
[100, 0],
|
||||
[0, 100],
|
||||
[100, 100],
|
||||
];
|
||||
valid_anchors.forEach(function(pair, index) {
|
||||
var anchorX = pair[0];
|
||||
var anchorY = pair[1];
|
||||
|
||||
assert_equals(regions[index].viewportAnchorX, anchorX, 'Failed with region ' + index);
|
||||
assert_equals(regions[index].viewportAnchorY, anchorY, 'Failed with region ' + index);
|
||||
});
|
||||
|
||||
for (var i = 0; i < 14; i++) {
|
||||
var index = valid_anchors.length + i;
|
||||
|
||||
assert_equals(regions[index].viewportAnchorX, 0, 'Failed with region ' + index);
|
||||
assert_equals(regions[index].viewportAnchorY, 100, 'Failed with region ' + index);
|
||||
}
|
||||
|
||||
}
|
||||
this.done();
|
||||
}
|
||||
|
||||
function trackError(e) {
|
||||
assert_unreached('got unexpected error event');
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,57 @@
|
|||
<!doctype html>
|
||||
<!-- DO NOT EDIT! This file and support/settings-align.vtt are generated. -->
|
||||
<!-- See /webvtt/parsing/file-parsing/README.md -->
|
||||
<meta charset=utf-8>
|
||||
<title>WebVTT parser test: settings, align</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-webvtt-cue-timings-and-settings">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
var t = async_test('settings, align');
|
||||
t.step(function(){
|
||||
var video = document.createElement('video');
|
||||
var track = document.createElement('track');
|
||||
assert_true('src' in track, 'track element not supported');
|
||||
track.src = 'support/settings-align.vtt';
|
||||
track['default'] = true;
|
||||
track.kind = 'subtitles';
|
||||
track.onload = this.step_func(trackLoaded);
|
||||
track.onerror = this.step_func(trackError);
|
||||
video.appendChild(track);
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
|
||||
function trackLoaded(event) {
|
||||
var track = event.target;
|
||||
var video = track.parentNode;
|
||||
var cues = video.textTracks[0].cues;
|
||||
{
|
||||
assert_equals(cues.length, 13);
|
||||
|
||||
[
|
||||
'center',
|
||||
'start',
|
||||
'center',
|
||||
'end',
|
||||
'left',
|
||||
'right',
|
||||
'end',
|
||||
'end',
|
||||
'end',
|
||||
'end',
|
||||
'end',
|
||||
'end',
|
||||
'center',
|
||||
].forEach(function(valid, index) {
|
||||
assert_equals(cues[index].align, valid, 'Failed with cue ' + index);
|
||||
});
|
||||
|
||||
}
|
||||
this.done();
|
||||
}
|
||||
|
||||
function trackError(e) {
|
||||
assert_unreached('got unexpected error event');
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,102 @@
|
|||
<!doctype html>
|
||||
<!-- DO NOT EDIT! This file and support/settings-line.vtt are generated. -->
|
||||
<!-- See /webvtt/parsing/file-parsing/README.md -->
|
||||
<meta charset=utf-8>
|
||||
<title>WebVTT parser test: settings, line</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-webvtt-cue-timings-and-settings">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
var t = async_test('settings, line');
|
||||
t.step(function(){
|
||||
var video = document.createElement('video');
|
||||
var track = document.createElement('track');
|
||||
assert_true('src' in track, 'track element not supported');
|
||||
track.src = 'support/settings-line.vtt';
|
||||
track['default'] = true;
|
||||
track.kind = 'subtitles';
|
||||
track.onload = this.step_func(trackLoaded);
|
||||
track.onerror = this.step_func(trackError);
|
||||
video.appendChild(track);
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
|
||||
function trackLoaded(event) {
|
||||
var track = event.target;
|
||||
var video = track.parentNode;
|
||||
var cues = video.textTracks[0].cues;
|
||||
{
|
||||
assert_equals(cues.length, 46);
|
||||
|
||||
// Test starts with simple valid values
|
||||
var valid_values = [
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
100,
|
||||
101,
|
||||
65536,
|
||||
4294967296,
|
||||
18446744073709552000,
|
||||
10000000000000000000000000000000000,
|
||||
1.5,
|
||||
Number.MAX_VALUE,
|
||||
-1 * Number.MAX_VALUE,
|
||||
Number.MIN_VALUE,
|
||||
0, // Less than Number.MIN_VALUE
|
||||
];
|
||||
valid_values.forEach(function(valid, index) {
|
||||
assert_equals(cues[index].line, valid, 'Failed with cue ' + index);
|
||||
assert_true(cues[index].snapToLines, 'Failed with cue ' + index);
|
||||
});
|
||||
|
||||
// Then a set of invalid ones
|
||||
var invalid_length = 23;
|
||||
for (var i = 0; i < invalid_length; i++) {
|
||||
var index = valid_values.length + i;
|
||||
|
||||
assert_equals(cues[index].line, 'auto', 'Failed with cue ' + index);
|
||||
assert_true(cues[index].snapToLines, 'Failed with cue ' + index);
|
||||
}
|
||||
|
||||
// Then more specific tests
|
||||
var index = valid_values.length + invalid_length;
|
||||
|
||||
assert_equals(cues[index].line, 0);
|
||||
assert_false(cues[index].snapToLines);
|
||||
|
||||
assert_equals(cues[index + 1].line, 0);
|
||||
assert_false(cues[index + 1].snapToLines);
|
||||
|
||||
assert_equals(cues[index + 2].line, 100);
|
||||
assert_false(cues[index + 2].snapToLines);
|
||||
assert_equals(cues[index + 2].lineAlign, 'start');
|
||||
|
||||
assert_equals(cues[index + 3].line, 100);
|
||||
assert_false(cues[index + 3].snapToLines);
|
||||
assert_equals(cues[index + 3].lineAlign, 'start');
|
||||
|
||||
assert_equals(cues[index + 4].line, 100);
|
||||
assert_false(cues[index + 4].snapToLines);
|
||||
assert_equals(cues[index + 4].lineAlign, 'center');
|
||||
|
||||
assert_equals(cues[index + 5].line, 100);
|
||||
assert_false(cues[index + 5].snapToLines);
|
||||
assert_equals(cues[index + 5].lineAlign, 'end');
|
||||
|
||||
assert_equals(cues[index + 6].line, Number.MIN_VALUE);
|
||||
assert_false(cues[index + 6].snapToLines);
|
||||
|
||||
assert_equals(cues[index + 7].line, 0);
|
||||
assert_false(cues[index + 7].snapToLines);
|
||||
|
||||
}
|
||||
this.done();
|
||||
}
|
||||
|
||||
function trackError(e) {
|
||||
assert_unreached('got unexpected error event');
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,58 @@
|
|||
<!doctype html>
|
||||
<!-- DO NOT EDIT! This file and support/settings-multiple.vtt are generated. -->
|
||||
<!-- See /webvtt/parsing/file-parsing/README.md -->
|
||||
<meta charset=utf-8>
|
||||
<title>WebVTT parser test: settings, multiple</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-webvtt-cue-timings-and-settings">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
var t = async_test('settings, multiple');
|
||||
t.step(function(){
|
||||
var video = document.createElement('video');
|
||||
var track = document.createElement('track');
|
||||
assert_true('src' in track, 'track element not supported');
|
||||
track.src = 'support/settings-multiple.vtt';
|
||||
track['default'] = true;
|
||||
track.kind = 'subtitles';
|
||||
track.onload = this.step_func(trackLoaded);
|
||||
track.onerror = this.step_func(trackError);
|
||||
video.appendChild(track);
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
|
||||
function trackLoaded(event) {
|
||||
var track = event.target;
|
||||
var video = track.parentNode;
|
||||
var cues = video.textTracks[0].cues;
|
||||
{
|
||||
assert_equals(cues.length, 2);
|
||||
|
||||
var cue = cues[0];
|
||||
assert_equals(cue.id, 'id0');
|
||||
assert_equals(cue.text, 'text0');
|
||||
assert_equals(cue.align, 'start');
|
||||
assert_equals(cue.line, 1);
|
||||
assert_equals(cue.snapToLines, false);
|
||||
assert_equals(cue.vertical, 'lr');
|
||||
assert_equals(cue.size, 50);
|
||||
assert_equals(cue.position, 25);
|
||||
|
||||
var cue = cues[1];
|
||||
assert_equals(cue.id, 'id1');
|
||||
assert_equals(cue.text, 'text1');
|
||||
assert_equals(cue.align, 'center');
|
||||
assert_equals(cue.line, 1);
|
||||
assert_equals(cue.vertical, 'rl');
|
||||
assert_equals(cue.size, 0);
|
||||
assert_equals(cue.position, 100);
|
||||
|
||||
}
|
||||
this.done();
|
||||
}
|
||||
|
||||
function trackError(e) {
|
||||
assert_unreached('got unexpected error event');
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,64 @@
|
|||
<!doctype html>
|
||||
<!-- DO NOT EDIT! This file and support/settings-position.vtt are generated. -->
|
||||
<!-- See /webvtt/parsing/file-parsing/README.md -->
|
||||
<meta charset=utf-8>
|
||||
<title>WebVTT parser test: settings, position</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-webvtt-cue-timings-and-settings">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
var t = async_test('settings, position');
|
||||
t.step(function(){
|
||||
var video = document.createElement('video');
|
||||
var track = document.createElement('track');
|
||||
assert_true('src' in track, 'track element not supported');
|
||||
track.src = 'support/settings-position.vtt';
|
||||
track['default'] = true;
|
||||
track.kind = 'subtitles';
|
||||
track.onload = this.step_func(trackLoaded);
|
||||
track.onerror = this.step_func(trackError);
|
||||
video.appendChild(track);
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
|
||||
function trackLoaded(event) {
|
||||
var track = event.target;
|
||||
var video = track.parentNode;
|
||||
var cues = video.textTracks[0].cues;
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
this.done();
|
||||
}
|
||||
|
||||
function trackError(e) {
|
||||
assert_unreached('got unexpected error event');
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,64 @@
|
|||
<!doctype html>
|
||||
<!-- DO NOT EDIT! This file and support/settings-region.vtt are generated. -->
|
||||
<!-- See /webvtt/parsing/file-parsing/README.md -->
|
||||
<meta charset=utf-8>
|
||||
<title>WebVTT parser test: settings, region</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-webvtt-cue-timings-and-settings">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
var t = async_test('settings, region');
|
||||
t.step(function(){
|
||||
var video = document.createElement('video');
|
||||
var track = document.createElement('track');
|
||||
assert_true('src' in track, 'track element not supported');
|
||||
track.src = 'support/settings-region.vtt';
|
||||
track['default'] = true;
|
||||
track.kind = 'subtitles';
|
||||
track.onload = this.step_func(trackLoaded);
|
||||
track.onerror = this.step_func(trackError);
|
||||
video.appendChild(track);
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
|
||||
function trackLoaded(event) {
|
||||
var track = event.target;
|
||||
var video = track.parentNode;
|
||||
var cues = video.textTracks[0].cues;
|
||||
{
|
||||
assert_equals(cues.length, 9);
|
||||
|
||||
var fooRegion = cues[0].region;
|
||||
assert_true(!!fooRegion, 'Cue 0 has invalid region');
|
||||
|
||||
var barRegion = cues[1].region;
|
||||
assert_true(!!barRegion, 'Cue 1 has invalid region');
|
||||
|
||||
assert_not_equals(fooRegion, barRegion);
|
||||
|
||||
var valid_regions = [
|
||||
fooRegion,
|
||||
barRegion,
|
||||
barRegion,
|
||||
null,
|
||||
fooRegion
|
||||
];
|
||||
valid_regions.forEach(function(valid, index) {
|
||||
assert_equals(cues[index].region, valid, 'Failed with cue ' + index);
|
||||
});
|
||||
|
||||
for (var i = 0; i < 4; i++) {
|
||||
var index = valid_regions.length + i;
|
||||
|
||||
assert_equals(cues[index].region, null);
|
||||
}
|
||||
|
||||
}
|
||||
this.done();
|
||||
}
|
||||
|
||||
function trackError(e) {
|
||||
assert_unreached('got unexpected error event');
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,58 @@
|
|||
<!doctype html>
|
||||
<!-- DO NOT EDIT! This file and support/settings-size.vtt are generated. -->
|
||||
<!-- See /webvtt/parsing/file-parsing/README.md -->
|
||||
<meta charset=utf-8>
|
||||
<title>WebVTT parser test: settings, size</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-webvtt-cue-timings-and-settings">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
var t = async_test('settings, size');
|
||||
t.step(function(){
|
||||
var video = document.createElement('video');
|
||||
var track = document.createElement('track');
|
||||
assert_true('src' in track, 'track element not supported');
|
||||
track.src = 'support/settings-size.vtt';
|
||||
track['default'] = true;
|
||||
track.kind = 'subtitles';
|
||||
track.onload = this.step_func(trackLoaded);
|
||||
track.onerror = this.step_func(trackError);
|
||||
video.appendChild(track);
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
|
||||
function trackLoaded(event) {
|
||||
var track = event.target;
|
||||
var video = track.parentNode;
|
||||
var cues = video.textTracks[0].cues;
|
||||
{
|
||||
assert_equals(cues.length, 16);
|
||||
|
||||
var valid_sizes = [
|
||||
100,
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
100,
|
||||
50,
|
||||
1.5,
|
||||
];
|
||||
valid_sizes.forEach(function(valid, index) {
|
||||
assert_equals(cues[index].size, valid, 'Failed with cue ' + index);
|
||||
});
|
||||
|
||||
for (var i = 0; i < 9; i++) {
|
||||
var index = valid_sizes.length + i;
|
||||
|
||||
assert_equals(cues[index].size, 100, 'Failed with cue ' + index);
|
||||
}
|
||||
|
||||
}
|
||||
this.done();
|
||||
}
|
||||
|
||||
function trackError(e) {
|
||||
assert_unreached('got unexpected error event');
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,55 @@
|
|||
<!doctype html>
|
||||
<!-- DO NOT EDIT! This file and support/settings-vertical.vtt are generated. -->
|
||||
<!-- See /webvtt/parsing/file-parsing/README.md -->
|
||||
<meta charset=utf-8>
|
||||
<title>WebVTT parser test: settings, size</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-webvtt-cue-timings-and-settings">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
var t = async_test('settings, size');
|
||||
t.step(function(){
|
||||
var video = document.createElement('video');
|
||||
var track = document.createElement('track');
|
||||
assert_true('src' in track, 'track element not supported');
|
||||
track.src = 'support/settings-vertical.vtt';
|
||||
track['default'] = true;
|
||||
track.kind = 'subtitles';
|
||||
track.onload = this.step_func(trackLoaded);
|
||||
track.onerror = this.step_func(trackError);
|
||||
video.appendChild(track);
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
|
||||
function trackLoaded(event) {
|
||||
var track = event.target;
|
||||
var video = track.parentNode;
|
||||
var cues = video.textTracks[0].cues;
|
||||
{
|
||||
assert_equals(cues.length, 8);
|
||||
|
||||
var valid_vertical = [
|
||||
'',
|
||||
'lr',
|
||||
'rl',
|
||||
'lr',
|
||||
];
|
||||
valid_vertical.forEach(function(valid, index) {
|
||||
assert_equals(cues[index].vertical, valid, 'Failed with cue ' + index);
|
||||
});
|
||||
|
||||
for (var i = 0; i < 4; i++) {
|
||||
var index = valid_vertical.length + i;
|
||||
|
||||
assert_equals(cues[index].vertical, '', 'Failed with cue ' + index);
|
||||
}
|
||||
|
||||
}
|
||||
this.done();
|
||||
}
|
||||
|
||||
function trackError(e) {
|
||||
assert_unreached('got unexpected error event');
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,39 @@
|
|||
<!doctype html>
|
||||
<!-- DO NOT EDIT! This file and support/signature-bom.vtt are generated. -->
|
||||
<!-- See /webvtt/parsing/file-parsing/README.md -->
|
||||
<meta charset=utf-8>
|
||||
<title>WebVTT parser test: signature, bom</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#webvtt-parser-algorithm">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
var t = async_test('signature, bom');
|
||||
t.step(function(){
|
||||
var video = document.createElement('video');
|
||||
var track = document.createElement('track');
|
||||
assert_true('src' in track, 'track element not supported');
|
||||
track.src = 'support/signature-bom.vtt';
|
||||
track['default'] = true;
|
||||
track.kind = 'subtitles';
|
||||
track.onload = this.step_func(trackLoaded);
|
||||
track.onerror = this.step_func(trackError);
|
||||
video.appendChild(track);
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
|
||||
function trackLoaded(event) {
|
||||
var track = event.target;
|
||||
var video = track.parentNode;
|
||||
var cues = video.textTracks[0].cues;
|
||||
{
|
||||
assert_equals(cues.length, 0);
|
||||
|
||||
}
|
||||
this.done();
|
||||
}
|
||||
|
||||
function trackError(e) {
|
||||
assert_unreached('got unexpected error event');
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,39 @@
|
|||
<!doctype html>
|
||||
<!-- DO NOT EDIT! This file and support/signature-no-newline.vtt are generated. -->
|
||||
<!-- See /webvtt/parsing/file-parsing/README.md -->
|
||||
<meta charset=utf-8>
|
||||
<title>WebVTT parser test: signature, no newline</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#webvtt-parser-algorithm">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
var t = async_test('signature, no newline');
|
||||
t.step(function(){
|
||||
var video = document.createElement('video');
|
||||
var track = document.createElement('track');
|
||||
assert_true('src' in track, 'track element not supported');
|
||||
track.src = 'support/signature-no-newline.vtt';
|
||||
track['default'] = true;
|
||||
track.kind = 'subtitles';
|
||||
track.onload = this.step_func(trackLoaded);
|
||||
track.onerror = this.step_func(trackError);
|
||||
video.appendChild(track);
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
|
||||
function trackLoaded(event) {
|
||||
var track = event.target;
|
||||
var video = track.parentNode;
|
||||
var cues = video.textTracks[0].cues;
|
||||
{
|
||||
assert_equals(cues.length, 0);
|
||||
|
||||
}
|
||||
this.done();
|
||||
}
|
||||
|
||||
function trackError(e) {
|
||||
assert_unreached('got unexpected error event');
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,39 @@
|
|||
<!doctype html>
|
||||
<!-- DO NOT EDIT! This file and support/signature-space-no-newline.vtt are generated. -->
|
||||
<!-- See /webvtt/parsing/file-parsing/README.md -->
|
||||
<meta charset=utf-8>
|
||||
<title>WebVTT parser test: signature, space, no newline</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#webvtt-parser-algorithm">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
var t = async_test('signature, space, no newline');
|
||||
t.step(function(){
|
||||
var video = document.createElement('video');
|
||||
var track = document.createElement('track');
|
||||
assert_true('src' in track, 'track element not supported');
|
||||
track.src = 'support/signature-space-no-newline.vtt';
|
||||
track['default'] = true;
|
||||
track.kind = 'subtitles';
|
||||
track.onload = this.step_func(trackLoaded);
|
||||
track.onerror = this.step_func(trackError);
|
||||
video.appendChild(track);
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
|
||||
function trackLoaded(event) {
|
||||
var track = event.target;
|
||||
var video = track.parentNode;
|
||||
var cues = video.textTracks[0].cues;
|
||||
{
|
||||
assert_equals(cues.length, 0);
|
||||
|
||||
}
|
||||
this.done();
|
||||
}
|
||||
|
||||
function trackError(e) {
|
||||
assert_unreached('got unexpected error event');
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,39 @@
|
|||
<!doctype html>
|
||||
<!-- DO NOT EDIT! This file and support/signature-space.vtt are generated. -->
|
||||
<!-- See /webvtt/parsing/file-parsing/README.md -->
|
||||
<meta charset=utf-8>
|
||||
<title>WebVTT parser test: signature, space</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#webvtt-parser-algorithm">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
var t = async_test('signature, space');
|
||||
t.step(function(){
|
||||
var video = document.createElement('video');
|
||||
var track = document.createElement('track');
|
||||
assert_true('src' in track, 'track element not supported');
|
||||
track.src = 'support/signature-space.vtt';
|
||||
track['default'] = true;
|
||||
track.kind = 'subtitles';
|
||||
track.onload = this.step_func(trackLoaded);
|
||||
track.onerror = this.step_func(trackError);
|
||||
video.appendChild(track);
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
|
||||
function trackLoaded(event) {
|
||||
var track = event.target;
|
||||
var video = track.parentNode;
|
||||
var cues = video.textTracks[0].cues;
|
||||
{
|
||||
assert_equals(cues.length, 0);
|
||||
|
||||
}
|
||||
this.done();
|
||||
}
|
||||
|
||||
function trackError(e) {
|
||||
assert_unreached('got unexpected error event');
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,39 @@
|
|||
<!doctype html>
|
||||
<!-- DO NOT EDIT! This file and support/signature-tab-no-newline.vtt are generated. -->
|
||||
<!-- See /webvtt/parsing/file-parsing/README.md -->
|
||||
<meta charset=utf-8>
|
||||
<title>WebVTT parser test: signature, tab, no newline</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#webvtt-parser-algorithm">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
var t = async_test('signature, tab, no newline');
|
||||
t.step(function(){
|
||||
var video = document.createElement('video');
|
||||
var track = document.createElement('track');
|
||||
assert_true('src' in track, 'track element not supported');
|
||||
track.src = 'support/signature-tab-no-newline.vtt';
|
||||
track['default'] = true;
|
||||
track.kind = 'subtitles';
|
||||
track.onload = this.step_func(trackLoaded);
|
||||
track.onerror = this.step_func(trackError);
|
||||
video.appendChild(track);
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
|
||||
function trackLoaded(event) {
|
||||
var track = event.target;
|
||||
var video = track.parentNode;
|
||||
var cues = video.textTracks[0].cues;
|
||||
{
|
||||
assert_equals(cues.length, 0);
|
||||
|
||||
}
|
||||
this.done();
|
||||
}
|
||||
|
||||
function trackError(e) {
|
||||
assert_unreached('got unexpected error event');
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,39 @@
|
|||
<!doctype html>
|
||||
<!-- DO NOT EDIT! This file and support/signature-tab.vtt are generated. -->
|
||||
<!-- See /webvtt/parsing/file-parsing/README.md -->
|
||||
<meta charset=utf-8>
|
||||
<title>WebVTT parser test: signature, tab</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#webvtt-parser-algorithm">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
var t = async_test('signature, tab');
|
||||
t.step(function(){
|
||||
var video = document.createElement('video');
|
||||
var track = document.createElement('track');
|
||||
assert_true('src' in track, 'track element not supported');
|
||||
track.src = 'support/signature-tab.vtt';
|
||||
track['default'] = true;
|
||||
track.kind = 'subtitles';
|
||||
track.onload = this.step_func(trackLoaded);
|
||||
track.onerror = this.step_func(trackError);
|
||||
video.appendChild(track);
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
|
||||
function trackLoaded(event) {
|
||||
var track = event.target;
|
||||
var video = track.parentNode;
|
||||
var cues = video.textTracks[0].cues;
|
||||
{
|
||||
assert_equals(cues.length, 0);
|
||||
|
||||
}
|
||||
this.done();
|
||||
}
|
||||
|
||||
function trackError(e) {
|
||||
assert_unreached('got unexpected error event');
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,39 @@
|
|||
<!doctype html>
|
||||
<!-- DO NOT EDIT! This file and support/signature-timings.vtt are generated. -->
|
||||
<!-- See /webvtt/parsing/file-parsing/README.md -->
|
||||
<meta charset=utf-8>
|
||||
<title>WebVTT parser test: signature, timings</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#webvtt-parser-algorithm">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
var t = async_test('signature, timings');
|
||||
t.step(function(){
|
||||
var video = document.createElement('video');
|
||||
var track = document.createElement('track');
|
||||
assert_true('src' in track, 'track element not supported');
|
||||
track.src = 'support/signature-timings.vtt';
|
||||
track['default'] = true;
|
||||
track.kind = 'subtitles';
|
||||
track.onload = this.step_func(trackLoaded);
|
||||
track.onerror = this.step_func(trackError);
|
||||
video.appendChild(track);
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
|
||||
function trackLoaded(event) {
|
||||
var track = event.target;
|
||||
var video = track.parentNode;
|
||||
var cues = video.textTracks[0].cues;
|
||||
{
|
||||
assert_equals(cues.length, 0);
|
||||
|
||||
}
|
||||
this.done();
|
||||
}
|
||||
|
||||
function trackError(e) {
|
||||
assert_unreached('got unexpected error event');
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,40 @@
|
|||
<!doctype html>
|
||||
<!-- DO NOT EDIT! This file and support/stylesheets.vtt are generated. -->
|
||||
<!-- See /webvtt/parsing/file-parsing/README.md -->
|
||||
<meta charset=utf-8>
|
||||
<title>WebVTT parser test: stylesheets, rules</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#collect-a-webvtt-block">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
var t = async_test('stylesheets, rules');
|
||||
t.step(function(){
|
||||
var video = document.createElement('video');
|
||||
var track = document.createElement('track');
|
||||
assert_true('src' in track, 'track element not supported');
|
||||
track.src = 'support/stylesheets.vtt';
|
||||
track['default'] = true;
|
||||
track.kind = 'subtitles';
|
||||
track.onload = this.step_func(trackLoaded);
|
||||
track.onerror = this.step_func(trackError);
|
||||
video.appendChild(track);
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
|
||||
function trackLoaded(event) {
|
||||
var track = event.target;
|
||||
var video = track.parentNode;
|
||||
var cues = video.textTracks[0].cues;
|
||||
{
|
||||
// There's no way to test the actual style from js
|
||||
assert_equals(document.styleSheets.length, 0);
|
||||
|
||||
}
|
||||
this.done();
|
||||
}
|
||||
|
||||
function trackError(e) {
|
||||
assert_unreached('got unexpected error event');
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,27 @@
|
|||
WEBVTT
|
||||
|
||||
-->
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text0
|
||||
foo-->
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text1
|
||||
-->foo
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text2
|
||||
--->
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text3
|
||||
-->-->
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text4
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text5
|
||||
|
||||
00:00:00.000 -a -->
|
||||
|
||||
00:00:00.000 --a -->
|
||||
|
||||
00:00:00.000 - -->
|
||||
|
||||
00:00:00.000 -- -->
|
|
@ -0,0 +1,5 @@
|
|||
WEBVTT
|
||||
foobar
|
||||
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text
|
|
@ -0,0 +1,4 @@
|
|||
WEBVTT
|
||||
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text
|
|
@ -0,0 +1,4 @@
|
|||
WEBVTT
|
||||
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text
|
|
@ -0,0 +1,3 @@
|
|||
WEBVTT
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text
|
|
@ -0,0 +1,21 @@
|
|||
WEBVTT
|
||||
|
||||
leading space
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text0
|
||||
|
||||
trailing space
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text1
|
||||
|
||||
-- >
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text2
|
||||
|
||||
->
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text3
|
||||
|
||||
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text4
|
|
@ -0,0 +1,12 @@
|
|||
WEBVTT
cr
00:00:00.000 --> 00:00:01.000
text0
|
||||
|
||||
lf
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text1
|
||||
|
||||
crlf
|
||||
00:00:00.000 --> 00:00:01.000
|
||||
text2
|
||||
lfcr
00:00:00.000 --> 00:00:01.000
|
||||
text3
|
||||
|
Binary file not shown.
|
@ -0,0 +1,34 @@
|
|||
WEBVTT
|
||||
|
||||
NOTE No API for accessing region ids, so using lines to uniquely identify regions
|
||||
|
||||
REGION
|
||||
id:foo
|
||||
id:bar
|
||||
lines:1
|
||||
|
||||
REGION
|
||||
id:bar id:foo
|
||||
lines:2
|
||||
|
||||
REGION
|
||||
id:id
|
||||
id: foo
|
||||
id :bar
|
||||
lines:3
|
||||
|
||||
REGION
|
||||
id:
|
||||
lines:4
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:foo
|
||||
valid
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:bar
|
||||
valid
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:id
|
||||
valid
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:
|
||||
valid
|
|
@ -0,0 +1,98 @@
|
|||
WEBVTT
|
||||
|
||||
NOTE valid
|
||||
|
||||
REGION
|
||||
id:1
|
||||
lines:0
|
||||
|
||||
REGION
|
||||
id:2
|
||||
lines:1
|
||||
|
||||
REGION
|
||||
id:3
|
||||
lines:100
|
||||
|
||||
REGION
|
||||
id:4
|
||||
lines:101
|
||||
|
||||
REGION
|
||||
id:5
|
||||
lines:65536
|
||||
|
||||
REGION
|
||||
id:6
|
||||
lines:4294967296
|
||||
|
||||
REGION
|
||||
id:7
|
||||
lines:18446744073709552000
|
||||
|
||||
REGION
|
||||
id:8
|
||||
lines:10000000000000000000000000000000000
|
||||
|
||||
REGION
|
||||
id:9
|
||||
lines:1 lines:3
|
||||
lines:2
|
||||
|
||||
NOTE invalid
|
||||
|
||||
REGION
|
||||
id:10
|
||||
lines:-0
|
||||
|
||||
REGION
|
||||
id:11
|
||||
lines:1.5
|
||||
|
||||
REGION
|
||||
id:12
|
||||
lines:-1
|
||||
|
||||
REGION
|
||||
id:13
|
||||
lines: 1
|
||||
lines :1
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:1
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:2
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:3
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:4
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:5
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:6
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:7
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:8
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:9
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:10
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:11
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:12
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:13
|
||||
text
|
|
@ -0,0 +1,9 @@
|
|||
WEBVTT
|
||||
Region: id=foo width=40% lines=3 regionanchor=0%,100% viewportanchor=10%,90% scroll=up
|
||||
Region: id=bar width=40% lines=3 regionanchor=100%,100% viewportanchor=90%,90% scroll=up
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:foo
|
||||
text0
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:bar
|
||||
text1
|
|
@ -0,0 +1,149 @@
|
|||
WEBVTT
|
||||
|
||||
NOTE valid
|
||||
|
||||
REGION
|
||||
id:0
|
||||
|
||||
REGION
|
||||
id:1
|
||||
regionanchor:0%,0%
|
||||
|
||||
REGION
|
||||
id:2
|
||||
regionanchor:1%,1%
|
||||
|
||||
REGION
|
||||
id:3
|
||||
regionanchor:100%,0%
|
||||
|
||||
REGION
|
||||
id:4
|
||||
regionanchor:0%,100%
|
||||
|
||||
REGION
|
||||
id:5
|
||||
regionanchor:100%,100%
|
||||
|
||||
NOTE invalid
|
||||
|
||||
REGION
|
||||
id:6
|
||||
regionanchor:0,0
|
||||
|
||||
REGION
|
||||
id:7
|
||||
regionanchor:0%,0
|
||||
|
||||
REGION
|
||||
id:8
|
||||
regionanchor:0,0%
|
||||
|
||||
REGION
|
||||
id:9
|
||||
regionanchor:1%
|
||||
|
||||
REGION
|
||||
id:10
|
||||
regionanchor:,1%
|
||||
|
||||
REGION
|
||||
id:11
|
||||
regionanchor:101%,1%
|
||||
|
||||
REGION
|
||||
id:12
|
||||
regionanchor:1%,101%
|
||||
|
||||
REGION
|
||||
id:13
|
||||
regionanchor:-0%,0%
|
||||
|
||||
REGION
|
||||
id:14
|
||||
regionanchor:0%,-0%
|
||||
|
||||
REGION
|
||||
id:15
|
||||
regionanchor:65536%,65536%
|
||||
|
||||
REGION
|
||||
id:16
|
||||
regionanchor:4294967296%,4294967296%
|
||||
|
||||
REGION
|
||||
id:17
|
||||
regionanchor:18446744073709552000%,18446744073709552000%
|
||||
|
||||
REGION
|
||||
id:18
|
||||
regionanchor:10000000000000000000000000000000000%,10000000000000000000000000000000000%
|
||||
|
||||
REGION
|
||||
id:19
|
||||
regionanchor: 100%,100%
|
||||
regionanchor :100%,100%
|
||||
regionanchor:100% ,100%
|
||||
regionanchor:100%, 100%
|
||||
regionanchor:100 %,100%
|
||||
regionanchor:100%,100 %
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:0
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:1
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:2
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:3
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:4
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:5
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:6
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:7
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:8
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:9
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:10
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:11
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:12
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:13
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:14
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:15
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:16
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:17
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:18
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:19
|
||||
text
|
|
@ -0,0 +1,46 @@
|
|||
WEBVTT
|
||||
|
||||
REGION
|
||||
id:0
|
||||
|
||||
REGION
|
||||
id:1
|
||||
scroll:up
|
||||
|
||||
REGION
|
||||
id:2
|
||||
scroll:up scroll:up scroll:up scroll:up scroll:up scroll:up scroll:up scroll:up
|
||||
scroll:up scroll:up scroll:up scroll:up scroll:up scroll:up scroll:up scroll:up
|
||||
|
||||
REGION
|
||||
id:3
|
||||
scroll:down
|
||||
scroll:left
|
||||
scroll:right
|
||||
|
||||
REGION
|
||||
id:4
|
||||
scroll: up
|
||||
scroll :up
|
||||
|
||||
REGION
|
||||
id:5
|
||||
scroll:up scroll:
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:0
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:1
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:2
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:3
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:4
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:5
|
||||
text
|
|
@ -0,0 +1,149 @@
|
|||
WEBVTT
|
||||
|
||||
NOTE valid
|
||||
|
||||
REGION
|
||||
id:0
|
||||
|
||||
REGION
|
||||
id:1
|
||||
viewportanchor:0%,0%
|
||||
|
||||
REGION
|
||||
id:2
|
||||
viewportanchor:1%,1%
|
||||
|
||||
REGION
|
||||
id:3
|
||||
viewportanchor:100%,0%
|
||||
|
||||
REGION
|
||||
id:4
|
||||
viewportanchor:0%,100%
|
||||
|
||||
REGION
|
||||
id:5
|
||||
viewportanchor:100%,100%
|
||||
|
||||
NOTE invalid
|
||||
|
||||
REGION
|
||||
id:6
|
||||
viewportanchor:0,0
|
||||
|
||||
REGION
|
||||
id:7
|
||||
viewportanchor:0%,0
|
||||
|
||||
REGION
|
||||
id:8
|
||||
viewportanchor:0,0%
|
||||
|
||||
REGION
|
||||
id:9
|
||||
viewportanchor:1%
|
||||
|
||||
REGION
|
||||
id:10
|
||||
viewportanchor:,1%
|
||||
|
||||
REGION
|
||||
id:11
|
||||
viewportanchor:101%,1%
|
||||
|
||||
REGION
|
||||
id:12
|
||||
viewportanchor:1%,101%
|
||||
|
||||
REGION
|
||||
id:13
|
||||
viewportanchor:-0%,0%
|
||||
|
||||
REGION
|
||||
id:14
|
||||
viewportanchor:0%,-0%
|
||||
|
||||
REGION
|
||||
id:15
|
||||
viewportanchor:65536%,65536%
|
||||
|
||||
REGION
|
||||
id:16
|
||||
viewportanchor:4294967296%,4294967296%
|
||||
|
||||
REGION
|
||||
id:17
|
||||
viewportanchor:18446744073709552000%,18446744073709552000%
|
||||
|
||||
REGION
|
||||
id:18
|
||||
viewportanchor:10000000000000000000000000000000000%,10000000000000000000000000000000000%
|
||||
|
||||
REGION
|
||||
id:19
|
||||
viewportanchor: 100%,100%
|
||||
viewportanchor :100%,100%
|
||||
viewportanchor:100% ,100%
|
||||
viewportanchor:100%, 100%
|
||||
viewportanchor:100 %,100%
|
||||
viewportanchor:100%,100 %
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:0
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:1
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:2
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:3
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:4
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:5
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:6
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:7
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:8
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:9
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:10
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:11
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:12
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:13
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:14
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:15
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:16
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:17
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:18
|
||||
text
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:19
|
||||
text
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,154 @@
|
|||
WEBVTT
|
||||
|
||||
NOTE valid
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:-1
|
||||
valid0
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:0
|
||||
valid1
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:-0
|
||||
valid2
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:1
|
||||
valid3
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:100
|
||||
valid4
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:101
|
||||
valid5
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:65536
|
||||
valid6
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:4294967296
|
||||
valid7
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:18446744073709552000
|
||||
valid8
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:10000000000000000000000000000000000
|
||||
valid9
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:1.5
|
||||
valid10
|
||||
|
||||
Number.MAX_VALUE
|
||||
00:00:00.000 --> 00:00:01.000 line:179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
valid11
|
||||
|
||||
-1 * Number.MAX_VALUE
|
||||
00:00:00.000 --> 00:00:01.000 line:-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
valid12
|
||||
|
||||
Number.MIN_VALUE
|
||||
00:00:00.000 --> 00:00:01.000 line:0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005
|
||||
valid13
|
||||
|
||||
Less than Number.MIN_VALUE
|
||||
00:00:00.000 --> 00:00:01.000 line:0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002
|
||||
valid14
|
||||
|
||||
NOTE invalid
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:65536%
|
||||
invalid15
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:4294967296%
|
||||
invalid16
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:18446744073709552000%
|
||||
invalid17
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:10000000000000000000000000000000000%
|
||||
invalid18
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:-0%
|
||||
invalid19
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:101%
|
||||
invalid20
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:1%-
|
||||
invalid21
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:1-
|
||||
invalid22
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:%1
|
||||
invalid23
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:1%%
|
||||
invalid24
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:0%0
|
||||
invalid25
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line: 0%
|
||||
invalid26
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:0%x
|
||||
invalid27
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:-
|
||||
invalid28
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:%
|
||||
invalid29
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:1..5
|
||||
invalid30
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:.5
|
||||
invalid31
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:5.
|
||||
invalid32
|
||||
|
||||
Greater than Number.MAX_VALUE
|
||||
00:00:00.000 --> 00:00:01.000 line:179769313486231590000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
invalid33
|
||||
|
||||
Less than -1 * Number.MAX_VALUE
|
||||
00:00:00.000 --> 00:00:01.000 line:-179769313486231590000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
invalid34
|
||||
|
||||
exponential notation
|
||||
00:00:00.000 --> 00:00:01.000 line:1e2
|
||||
invalid35
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:100%,middle
|
||||
invalid36
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:100%,
|
||||
invalid37
|
||||
|
||||
NOTE extra
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:0%
|
||||
text38
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:00%
|
||||
text39
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:100%
|
||||
text40
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:100%,start
|
||||
text41
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:100%,center
|
||||
text42
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 line:100%,end
|
||||
text43
|
||||
|
||||
Number.MIN_VALUE %
|
||||
00:00:00.000 --> 00:00:01.000 line:0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005%
|
||||
text44
|
||||
|
||||
Less than Number.MIN_VALUE %
|
||||
00:00:00.000 --> 00:00:01.000 line:0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002%
|
||||
text45
|
|
@ -0,0 +1,9 @@
|
|||
WEBVTT
|
||||
|
||||
id0
|
||||
00:00:00.000 --> 00:00:01.000 align:start line:1% vertical:lr size:50% position:25%
|
||||
text0
|
||||
|
||||
id1
|
||||
00:00:00.000 --> 00:00:01.000 align:center line:1 vertical:rl size:0% position:100%
|
||||
text1
|
|
@ -0,0 +1,71 @@
|
|||
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
|
|
@ -0,0 +1,40 @@
|
|||
WEBVTT
|
||||
|
||||
REGION
|
||||
id:foo
|
||||
|
||||
REGION
|
||||
id:bar
|
||||
|
||||
REGION
|
||||
id:foo
|
||||
|
||||
REGION
|
||||
width:10%
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:foo
|
||||
text0
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:bar
|
||||
text1
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:foo region:bar
|
||||
text2
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:invalid
|
||||
text3
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:invalid region:foo
|
||||
text4
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:
|
||||
invalid5
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region:
|
||||
invalid6
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region: foo
|
||||
invalid7
|
||||
|
||||
00:00:00.000 --> 00:00:01.000 region :foo
|
||||
invalid8
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue