mirror of
https://github.com/servo/servo.git
synced 2025-09-16 18:08:23 +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
66
tests/wpt/web-platform-tests/webvtt/api/VTTCue/align.html
Normal file
66
tests/wpt/web-platform-tests/webvtt/api/VTTCue/align.html
Normal file
|
@ -0,0 +1,66 @@
|
|||
<!doctype html>
|
||||
<title>VTTCue.align</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#dom-vttcue-align">
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function(){
|
||||
var video = document.createElement('video');
|
||||
document.body.appendChild(video);
|
||||
|
||||
var cue = new VTTCue(0, 1, 'text');
|
||||
assert_true('align' in cue, 'align is not supported');
|
||||
assert_equals(cue.align, 'center');
|
||||
|
||||
var track = document.createElement('track');
|
||||
var t = track.track;
|
||||
t.addCue(cue);
|
||||
|
||||
assert_equals(cue.align, 'center');
|
||||
|
||||
video.appendChild(track);
|
||||
assert_equals(cue.align, 'center');
|
||||
|
||||
t.mode = 'showing';
|
||||
assert_equals(cue.align, 'center');
|
||||
|
||||
cue.align = 'start';
|
||||
assert_equals(cue.align, 'start');
|
||||
|
||||
cue.align = 'end';
|
||||
assert_equals(cue.align, 'end');
|
||||
|
||||
['start\u0000', 'centre', 'middle'].forEach(function(invalid) {
|
||||
cue.align = invalid;
|
||||
assert_equals(cue.align, 'end');
|
||||
});
|
||||
}, document.title+', script-created cue');
|
||||
|
||||
var t_parsed = async_test(document.title+', parsed cue');
|
||||
t_parsed.step(function(){
|
||||
var video = document.createElement('video');
|
||||
document.body.appendChild(video);
|
||||
var t = document.createElement('track');
|
||||
t.onload = this.step_func(function(){
|
||||
var c1 = t.track.cues[0];
|
||||
var c2 = t.track.cues[1];
|
||||
var c3 = t.track.cues[2];
|
||||
var c4 = t.track.cues[3];
|
||||
assert_equals(c1.align, 'center');
|
||||
assert_equals(c2.align, 'start');
|
||||
assert_equals(c3.align, 'center');
|
||||
assert_equals(c4.align, 'end');
|
||||
this.done();
|
||||
});
|
||||
t.onerror = this.step_func(function() {
|
||||
assert_unreached('got error event');
|
||||
});
|
||||
t.src = 'data:text/vtt,'+encodeURIComponent('WEBVTT\n\n00:00:00.000 --> 00:00:00.001\ntest\n\n'+
|
||||
'00:00:00.000 --> 00:00:00.001 align:start\ntest\n\n'+
|
||||
'00:00:00.000 --> 00:00:00.001 align:center\ntest\n\n'+
|
||||
'00:00:00.000 --> 00:00:00.001 align:end\ntest');
|
||||
t.track.mode = 'showing';
|
||||
video.appendChild(t);
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"region.html": "regions"
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
<!doctype html>
|
||||
<title>VTTCue()</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#dom-vttcue-vttcue">
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var cue = new VTTCue(3, 12, 'foo bar');
|
||||
|
||||
assert_equals(cue.startTime, 3);
|
||||
assert_equals(cue.endTime, 12);
|
||||
assert_equals(cue.text, 'foo bar');
|
||||
assert_equals(cue.id, '');
|
||||
assert_equals(cue.region, null);
|
||||
assert_equals(cue.pauseOnExit, false);
|
||||
assert_equals(cue.snapToLines, true);
|
||||
assert_equals(cue.line, 'auto');
|
||||
assert_equals(cue.lineAlign, 'start');
|
||||
assert_equals(cue.position, 'auto');
|
||||
assert_equals(cue.positionAlign, 'auto');
|
||||
assert_equals(cue.size, 100);
|
||||
assert_equals(cue.align, 'center');
|
||||
}, document.title + ', initial values');
|
||||
|
||||
test(function() {
|
||||
var cue = new VTTCue(-1, 12, 'foo bar');
|
||||
|
||||
assert_equals(cue.startTime, -1);
|
||||
assert_equals(cue.endTime, 12);
|
||||
}, document.title + ', bad start time');
|
||||
|
||||
|
||||
test(function() {
|
||||
var cue = new VTTCue(2, -1, 'foo bar');
|
||||
|
||||
assert_equals(cue.startTime, 2);
|
||||
assert_equals(cue.endTime, -1);
|
||||
}, document.title + ', bad end time');
|
||||
|
||||
test(function() {
|
||||
var cue = new VTTCue(3, 12, '<i>foo bar</i>');
|
||||
|
||||
var frag = cue.getCueAsHTML();
|
||||
assert_equals(frag.childNodes.length, 1);
|
||||
assert_equals(frag.childNodes[0].localName, 'i');
|
||||
assert_equals(frag.childNodes[0].textContent, 'foo bar');
|
||||
}, document.title + ', text formatting');
|
||||
</script>
|
|
@ -0,0 +1,93 @@
|
|||
<!doctype html>
|
||||
<title>VTTCue.getCueAsHTML()</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#dom-vttcue-getcueashtml">
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function(){
|
||||
var video = document.createElement('video');
|
||||
var t1 = video.addTextTrack('subtitles');
|
||||
document.body.appendChild(video);
|
||||
var c1 = new VTTCue(0, 1, '<c></c><c.a.b></c><i></i><b></b><u></u><ruby><rt></rt></ruby><v></v><v a b></v><1:00:00.500>x\0');
|
||||
t1.addCue(c1);
|
||||
window.frag = c1.getCueAsHTML();
|
||||
assert_equals(frag.childNodes.length, 10, 'childNodes.length');
|
||||
assert_true(frag instanceof DocumentFragment, 'getCueAsHTML() should return DocumentFragment');
|
||||
}, document.title+', creating the cue');
|
||||
test(function(){
|
||||
assert_equals(frag.childNodes[0].namespaceURI, 'http://www.w3.org/1999/xhtml', 'namespaceURI');
|
||||
assert_equals(frag.childNodes[0].localName, 'span', 'localName');
|
||||
assert_equals(frag.childNodes[0].attributes.length, 0, 'attributes');
|
||||
assert_false(frag.childNodes[0].hasChildNodes(), 'hasChildNodes()');
|
||||
assert_true(frag.childNodes[0] instanceof HTMLElement, 'instanceof');
|
||||
}, document.title+', <c>');
|
||||
test(function(){
|
||||
assert_equals(frag.childNodes[1].namespaceURI, 'http://www.w3.org/1999/xhtml', 'namespaceURI');
|
||||
assert_equals(frag.childNodes[1].localName, 'span', 'localName');
|
||||
assert_equals(frag.childNodes[1].attributes.length, 1, 'attributes');
|
||||
assert_equals(frag.childNodes[1].getAttributeNS('', 'class'), 'a b', 'class attribute');
|
||||
assert_false(frag.childNodes[1].hasChildNodes(), 'hasChildNodes()');
|
||||
assert_true(frag.childNodes[1] instanceof HTMLElement, 'instanceof');
|
||||
}, document.title+', <c.a.b>');
|
||||
test(function(){
|
||||
assert_equals(frag.childNodes[2].namespaceURI, 'http://www.w3.org/1999/xhtml', 'namespaceURI');
|
||||
assert_equals(frag.childNodes[2].localName, 'i', 'localName');
|
||||
assert_equals(frag.childNodes[2].attributes.length, 0, 'attributes');
|
||||
assert_false(frag.childNodes[2].hasChildNodes(), 'hasChildNodes()');
|
||||
assert_true(frag.childNodes[2] instanceof HTMLElement, 'instanceof');
|
||||
}, document.title+', <i>');
|
||||
test(function(){
|
||||
assert_equals(frag.childNodes[3].namespaceURI, 'http://www.w3.org/1999/xhtml', 'namespaceURI');
|
||||
assert_equals(frag.childNodes[3].localName, 'b', 'localName');
|
||||
assert_equals(frag.childNodes[3].attributes.length, 0, 'attributes');
|
||||
assert_false(frag.childNodes[3].hasChildNodes(), 'hasChildNodes()');
|
||||
assert_true(frag.childNodes[3] instanceof HTMLElement, 'instanceof');
|
||||
}, document.title+', <b>');
|
||||
test(function(){
|
||||
assert_equals(frag.childNodes[4].namespaceURI, 'http://www.w3.org/1999/xhtml', 'namespaceURI');
|
||||
assert_equals(frag.childNodes[4].localName, 'u', 'localName');
|
||||
assert_equals(frag.childNodes[4].attributes.length, 0, 'attributes');
|
||||
assert_false(frag.childNodes[4].hasChildNodes(), 'hasChildNodes()');
|
||||
assert_true(frag.childNodes[4] instanceof HTMLElement, 'instanceof');
|
||||
}, document.title+', <u>');
|
||||
test(function(){
|
||||
assert_equals(frag.childNodes[5].namespaceURI, 'http://www.w3.org/1999/xhtml', 'namespaceURI');
|
||||
assert_equals(frag.childNodes[5].localName, 'ruby', 'localName');
|
||||
assert_equals(frag.childNodes[5].attributes.length, 0, 'attributes');
|
||||
assert_true(frag.childNodes[5].hasChildNodes(), 'hasChildNodes()');
|
||||
assert_true(frag.childNodes[5] instanceof HTMLElement, 'instanceof');
|
||||
}, document.title+', <ruby>');
|
||||
test(function(){
|
||||
assert_equals(frag.childNodes[5].firstChild.namespaceURI, 'http://www.w3.org/1999/xhtml', 'namespaceURI');
|
||||
assert_equals(frag.childNodes[5].firstChild.localName, 'rt', 'localName');
|
||||
assert_equals(frag.childNodes[5].firstChild.attributes.length, 0, 'attributes');
|
||||
assert_false(frag.childNodes[5].firstChild.hasChildNodes(), 'hasChildNodes()');
|
||||
assert_true(frag.childNodes[5].firstChild instanceof HTMLElement, 'instanceof');
|
||||
}, document.title+', <rt>');
|
||||
test(function(){
|
||||
assert_equals(frag.childNodes[6].namespaceURI, 'http://www.w3.org/1999/xhtml', 'namespaceURI');
|
||||
assert_equals(frag.childNodes[6].localName, 'span', 'localName');
|
||||
assert_equals(frag.childNodes[6].attributes.length, 1, 'attributes');
|
||||
assert_equals(frag.childNodes[6].getAttributeNS('', 'title'), '', 'title attribute');
|
||||
assert_false(frag.childNodes[6].hasChildNodes(), 'hasChildNodes()');
|
||||
assert_true(frag.childNodes[6] instanceof HTMLElement, 'instanceof');
|
||||
}, document.title+', <v>');
|
||||
test(function(){
|
||||
assert_equals(frag.childNodes[7].namespaceURI, 'http://www.w3.org/1999/xhtml', 'namespaceURI');
|
||||
assert_equals(frag.childNodes[7].localName, 'span', 'localName');
|
||||
assert_equals(frag.childNodes[7].attributes.length, 1, 'attributes');
|
||||
assert_equals(frag.childNodes[7].getAttributeNS('', 'title'), 'a b', 'title attribute');
|
||||
assert_false(frag.childNodes[7].hasChildNodes(), 'hasChildNodes()');
|
||||
assert_true(frag.childNodes[7] instanceof HTMLElement, 'instanceof');
|
||||
}, document.title+', <v a b>');
|
||||
test(function(){
|
||||
assert_equals(frag.childNodes[8].target, 'timestamp', 'target');
|
||||
assert_equals(frag.childNodes[8].data, '01:00:00.500', 'data');
|
||||
assert_true(frag.childNodes[8] instanceof ProcessingInstruction, 'instanceof');
|
||||
}, document.title+', <1:00:00.500>');
|
||||
test(function(){
|
||||
assert_equals(frag.childNodes[9].data, 'x\0', 'data');
|
||||
assert_true(frag.childNodes[9] instanceof Text, 'instanceof');
|
||||
}, document.title+', x\\0');
|
||||
</script>
|
64
tests/wpt/web-platform-tests/webvtt/api/VTTCue/line.html
Normal file
64
tests/wpt/web-platform-tests/webvtt/api/VTTCue/line.html
Normal file
|
@ -0,0 +1,64 @@
|
|||
<!doctype html>
|
||||
<title>VTTCue.line</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#dom-vttcue-line">
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function(){
|
||||
var video = document.createElement('video');
|
||||
document.body.appendChild(video);
|
||||
var c1 = new VTTCue(0, 1, 'text1');
|
||||
assert_true('line' in c1, 'line is not supported');
|
||||
assert_equals(c1.line, "auto");
|
||||
var track = document.createElement('track');
|
||||
var t = track.track;
|
||||
t.addCue(c1);
|
||||
assert_equals(c1.line, "auto");
|
||||
video.appendChild(track);
|
||||
assert_equals(c1.line, "auto");
|
||||
t.mode = 'showing';
|
||||
assert_equals(c1.line, "auto");
|
||||
var c2 = new VTTCue(0, 1, 'text2');
|
||||
var track2 = document.createElement('track');
|
||||
var t2 = track2.track;
|
||||
t2.addCue(c2);
|
||||
assert_equals(c2.line, "auto");
|
||||
video.appendChild(track2);
|
||||
t2.mode = 'showing';
|
||||
assert_equals(c2.line, "auto");
|
||||
assert_equals(c1.line, "auto");
|
||||
c1.line = -5;
|
||||
assert_equals(c1.line, -5);
|
||||
assert_equals(c2.line, "auto");
|
||||
c1.line = 0;
|
||||
c1.snapToLines = false;
|
||||
assert_equals(c1.line, 0);
|
||||
assert_equals(c2.line, "auto");
|
||||
}, document.title+', script-created cue');
|
||||
|
||||
var t_parsed = async_test(document.title+', parsed cue');
|
||||
t_parsed.step(function(){
|
||||
var video = document.createElement('video');
|
||||
document.body.appendChild(video);
|
||||
var t = document.createElement('track');
|
||||
t.onload = this.step_func(function(){
|
||||
var c1 = t.track.cues[0];
|
||||
var c2 = t.track.cues[1];
|
||||
var c3 = t.track.cues[2];
|
||||
assert_equals(c1.line, "auto");
|
||||
assert_equals(c2.line, 0);
|
||||
assert_equals(c3.line, 0);
|
||||
|
||||
this.done();
|
||||
});
|
||||
t.onerror = this.step_func(function() {
|
||||
assert_unreached('got error event');
|
||||
});
|
||||
t.src = 'data:text/vtt,'+encodeURIComponent('WEBVTT\n\n00:00:00.000 --> 00:00:00.001\ntest\n\n'+
|
||||
'00:00:00.000 --> 00:00:00.001 line:0\ntest\n\n'+
|
||||
'00:00:00.000 --> 00:00:00.001 line:0%\ntest');
|
||||
t.track.mode = 'showing';
|
||||
video.appendChild(t);
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,39 @@
|
|||
<!doctype html>
|
||||
<title>VTTCue.lineAlign</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#dom-vttcue-linealign">
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function(){
|
||||
var video = document.createElement('video');
|
||||
document.body.appendChild(video);
|
||||
|
||||
var cue = new VTTCue(0, 1, 'text');
|
||||
assert_true('lineAlign' in cue, 'lineAlign is not supported');
|
||||
assert_equals(cue.lineAlign, 'start');
|
||||
|
||||
var track = document.createElement('track');
|
||||
var t = track.track;
|
||||
t.addCue(cue);
|
||||
|
||||
assert_equals(cue.lineAlign, 'start');
|
||||
|
||||
video.appendChild(track);
|
||||
assert_equals(cue.lineAlign, 'start');
|
||||
|
||||
t.mode = 'showing';
|
||||
assert_equals(cue.lineAlign, 'start');
|
||||
|
||||
cue.lineAlign = 'center';
|
||||
assert_equals(cue.lineAlign, 'center');
|
||||
|
||||
cue.lineAlign = 'end';
|
||||
assert_equals(cue.lineAlign, 'end');
|
||||
|
||||
['start\u0000', 'centre', 'middle'].forEach(function(invalid) {
|
||||
cue.lineAlign = invalid;
|
||||
assert_equals(cue.lineAlign, 'end');
|
||||
});
|
||||
}, document.title+', script-created cue');
|
||||
</script>
|
32
tests/wpt/web-platform-tests/webvtt/api/VTTCue/position.html
Normal file
32
tests/wpt/web-platform-tests/webvtt/api/VTTCue/position.html
Normal file
|
@ -0,0 +1,32 @@
|
|||
<!doctype html>
|
||||
<title>VTTCue.position</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#dom-vttcue-position">
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function(){
|
||||
var cue = new VTTCue(0, 1, 'text');
|
||||
assert_true('position' in cue, 'position is not supported');
|
||||
|
||||
cue.position = 'auto';
|
||||
assert_equals(cue.position, 'auto');
|
||||
|
||||
for (i = 0; i <= 100; i++) {
|
||||
cue.position = i;
|
||||
assert_equals(cue.position, i);
|
||||
}
|
||||
|
||||
[-1, -100, -101, 101, 200, 201].forEach(function(invalid) {
|
||||
assert_throws('IndexSizeError', function() {
|
||||
cue.position = invalid;
|
||||
});
|
||||
});
|
||||
|
||||
cue.position = 1.5;
|
||||
assert_equals(cue.position, 1.5);
|
||||
|
||||
cue.position = 'auto';
|
||||
assert_equals(cue.position, 'auto');
|
||||
}, document.title+', script-created cue');
|
||||
</script>
|
|
@ -0,0 +1,23 @@
|
|||
<!doctype html>
|
||||
<title>VTTCue.positionAlign</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#dom-vttcue-positionalign">
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function(){
|
||||
var cue = new VTTCue(0, 1, 'text');
|
||||
assert_true('positionAlign' in cue, 'positionAlign is not supported');
|
||||
|
||||
['line-left', 'center', 'line-right', 'auto'].forEach(function(valid) {
|
||||
cue.positionAlign = valid;
|
||||
assert_equals(cue.positionAlign, valid);
|
||||
});
|
||||
|
||||
cue.positionAlign = 'center';
|
||||
['auto\u0000', 'centre', 'middle'].forEach(function(invalid) {
|
||||
cue.positionAlign = invalid;
|
||||
assert_equals(cue.positionAlign, 'center');
|
||||
});
|
||||
}, document.title+', script-created cue');
|
||||
</script>
|
38
tests/wpt/web-platform-tests/webvtt/api/VTTCue/region.html
Normal file
38
tests/wpt/web-platform-tests/webvtt/api/VTTCue/region.html
Normal file
|
@ -0,0 +1,38 @@
|
|||
<!doctype html>
|
||||
<title>VTTCue.region</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#dom-vttcue-region">
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function(){
|
||||
var video = document.createElement('video');
|
||||
document.body.appendChild(video);
|
||||
|
||||
var cue = new VTTCue(0, 1, 'text');
|
||||
assert_true('region' in cue, 'region is not supported');
|
||||
assert_equals(cue.region, null);
|
||||
|
||||
var track = document.createElement('track');
|
||||
var t = track.track;
|
||||
t.addCue(cue);
|
||||
|
||||
assert_equals(cue.region, null);
|
||||
|
||||
video.appendChild(track);
|
||||
assert_equals(cue.region, null);
|
||||
|
||||
t.mode = 'showing';
|
||||
assert_equals(cue.region, null);
|
||||
|
||||
var region = new VTTRegion();
|
||||
cue.region = region;
|
||||
assert_equals(cue.region, region);
|
||||
|
||||
cue.region = 'foo';
|
||||
assert_equals(cue.region, region);
|
||||
|
||||
cue.region = null;
|
||||
assert_equals(cue.region, null);
|
||||
}, document.title+', script-created cue');
|
||||
</script>
|
26
tests/wpt/web-platform-tests/webvtt/api/VTTCue/size.html
Normal file
26
tests/wpt/web-platform-tests/webvtt/api/VTTCue/size.html
Normal file
|
@ -0,0 +1,26 @@
|
|||
<!doctype html>
|
||||
<title>VTTCue.size</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#dom-vttcue-size">
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function(){
|
||||
var cue = new VTTCue(0, 1, 'text');
|
||||
assert_true('size' in cue, 'size is not supported');
|
||||
|
||||
for (i = 0; i <= 100; i++) {
|
||||
cue.size = i;
|
||||
assert_equals(cue.size, i);
|
||||
}
|
||||
|
||||
[-1, -100, -101, 101, 200, 201].forEach(function(invalid) {
|
||||
assert_throws('IndexSizeError', function() {
|
||||
cue.size = invalid;
|
||||
});
|
||||
});
|
||||
|
||||
cue.size = 1.5;
|
||||
assert_equals(cue.size, 1.5);
|
||||
}, document.title+', script-created cue');
|
||||
</script>
|
|
@ -0,0 +1,99 @@
|
|||
<!doctype html>
|
||||
<title>VTTCue.snapToLines</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#dom-vttcue-snaptolines">
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup(function(){
|
||||
window.video = document.createElement('video');
|
||||
window.t1 = video.addTextTrack('subtitles');
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
test(function(){
|
||||
var c1 = new VTTCue(0, 1, 'text1');
|
||||
assert_true('snapToLines' in c1, 'snapToLines is not supported');
|
||||
assert_true(c1.snapToLines);
|
||||
c1.line = 101;
|
||||
c1.snapToLines = false;
|
||||
assert_false(c1.snapToLines);
|
||||
c1.snapToLines = true;
|
||||
assert_true(c1.snapToLines);
|
||||
c1.line = -1;
|
||||
c1.snapToLines = false;
|
||||
assert_false(c1.snapToLines);
|
||||
c1.snapToLines = true;
|
||||
assert_true(c1.snapToLines);
|
||||
c1.line = 0;
|
||||
c1.snapToLines = false;
|
||||
assert_false(c1.snapToLines);
|
||||
}, document.title+', script-created cue');
|
||||
|
||||
var t_parsed = async_test(document.title+', parsed cue');
|
||||
t_parsed.step(function(){
|
||||
var t = document.createElement('track');
|
||||
t.onload = this.step_func(function(){
|
||||
var c1 = t.track.cues[0];
|
||||
assert_true(c1.snapToLines);
|
||||
c1.line = 101;
|
||||
c1.snapToLines = false;
|
||||
assert_false(c1.snapToLines);
|
||||
c1.snapToLines = true;
|
||||
assert_true(c1.snapToLines);
|
||||
c1.line = -1;
|
||||
c1.snapToLines = false;
|
||||
assert_false(c1.snapToLines);
|
||||
c1.snapToLines = true;
|
||||
assert_true(c1.snapToLines);
|
||||
c1.line = 0;
|
||||
c1.snapToLines = false;
|
||||
assert_false(c1.snapToLines);
|
||||
|
||||
var c2 = t.track.cues[1];
|
||||
assert_true(c2.snapToLines);
|
||||
c2.line = 101;
|
||||
c2.snapToLines = false;
|
||||
assert_false(c2.snapToLines);
|
||||
c2.snapToLines = true;
|
||||
assert_true(c2.snapToLines);
|
||||
c2.line = -1;
|
||||
c2.snapToLines = false;
|
||||
assert_false(c2.snapToLines);
|
||||
c2.snapToLines = true;
|
||||
assert_true(c2.snapToLines);
|
||||
c2.line = 0;
|
||||
c2.snapToLines = false;
|
||||
assert_false(c2.snapToLines);
|
||||
|
||||
var c3 = t.track.cues[2];
|
||||
assert_false(c3.snapToLines);
|
||||
c3.snapToLines = false;
|
||||
assert_false(c3.snapToLines);
|
||||
c3.snapToLines = true;
|
||||
assert_true(c3.snapToLines);
|
||||
c3.line = 101;
|
||||
c3.snapToLines = false;
|
||||
assert_false(c3.snapToLines);
|
||||
c3.snapToLines = true;
|
||||
assert_true(c3.snapToLines);
|
||||
c3.line = -1;
|
||||
c3.snapToLines = false;
|
||||
assert_false(c3.snapToLines);
|
||||
c3.snapToLines = true;
|
||||
assert_true(c3.snapToLines);
|
||||
c3.line = 0;
|
||||
c3.snapToLines = false;
|
||||
assert_false(c3.snapToLines);
|
||||
|
||||
this.done();
|
||||
});
|
||||
t.onerror = this.step_func(function() {
|
||||
assert_unreached('got error event');
|
||||
});
|
||||
t.src = 'data:text/vtt,'+encodeURIComponent('WEBVTT\n\n00:00:00.000 --> 00:00:00.001\ntest\n\n'+
|
||||
'00:00:00.000 --> 00:00:00.001 line:0\ntest\n\n'+
|
||||
'00:00:00.000 --> 00:00:00.001 line:0%\ntest');
|
||||
t.track.mode = 'showing';
|
||||
video.appendChild(t);
|
||||
});
|
||||
</script>
|
40
tests/wpt/web-platform-tests/webvtt/api/VTTCue/text.html
Normal file
40
tests/wpt/web-platform-tests/webvtt/api/VTTCue/text.html
Normal file
|
@ -0,0 +1,40 @@
|
|||
<!doctype html>
|
||||
<title>VTTCue.text</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#dom-vttcue-text">
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup(function(){
|
||||
window.video = document.createElement('video');
|
||||
window.t1 = video.addTextTrack('subtitles');
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
test(function(){
|
||||
var c1 = new VTTCue(0, 1, 'text1\r\n\n\u0000');
|
||||
assert_true('text' in c1, 'text is not supported');
|
||||
assert_equals(c1.text, 'text1\r\n\n\u0000');
|
||||
c1.text = c1.text;
|
||||
assert_equals(c1.text, 'text1\r\n\n\u0000');
|
||||
c1.text = null;
|
||||
assert_equals(c1.text, 'null');
|
||||
}, document.title+', script-created cue');
|
||||
|
||||
var t_parsed = async_test(document.title+', parsed cue');
|
||||
t_parsed.step(function(){
|
||||
var t = document.createElement('track');
|
||||
t.onload = this.step_func(function(){
|
||||
var c = t.track.cues;
|
||||
assert_equals(c[0].text, '');
|
||||
assert_equals(c[1].text, 'test');
|
||||
this.done();
|
||||
});
|
||||
t.onerror = this.step_func(function() {
|
||||
assert_unreached('got error event');
|
||||
});
|
||||
t.src = 'data:text/vtt,'+encodeURIComponent('WEBVTT\n\n00:00:00.000 --> 00:00:00.001\n'+
|
||||
'\n\nfoobar\n00:00:00.000 --> 00:00:00.001\ntest');
|
||||
t.track.mode = 'showing';
|
||||
video.appendChild(t);
|
||||
});
|
||||
</script>
|
56
tests/wpt/web-platform-tests/webvtt/api/VTTCue/vertical.html
Normal file
56
tests/wpt/web-platform-tests/webvtt/api/VTTCue/vertical.html
Normal file
|
@ -0,0 +1,56 @@
|
|||
<!doctype html>
|
||||
<title>VTTCue.vertical</title>
|
||||
<link rel="help" href="https://w3c.github.io/webvtt/#dom-vttcue-vertical">
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
setup(function(){
|
||||
window.video = document.createElement('video');
|
||||
window.t1 = video.addTextTrack('subtitles');
|
||||
document.body.appendChild(video);
|
||||
});
|
||||
test(function(){
|
||||
var video = document.createElement('video');
|
||||
document.body.appendChild(video);
|
||||
var c1 = new VTTCue(0, 1, 'text1');
|
||||
assert_true('vertical' in c1, 'vertical is not supported');
|
||||
assert_equals(c1.vertical, '');
|
||||
var track = document.createElement('track');
|
||||
var t = track.track;
|
||||
t.addCue(c1);
|
||||
assert_equals(c1.vertical, '');
|
||||
video.appendChild(track);
|
||||
assert_equals(c1.vertical, '');
|
||||
t.mode = 'showing';
|
||||
assert_equals(c1.vertical, '');
|
||||
c1.vertical = 'rl';
|
||||
assert_equals(c1.vertical, 'rl');
|
||||
c1.vertical = 'lr';
|
||||
assert_equals(c1.vertical, 'lr');
|
||||
c1.vertical = 'rl\u0000';
|
||||
assert_equals(c1.vertical, 'lr');
|
||||
}, document.title+', script-created cue');
|
||||
|
||||
var t_parsed = async_test(document.title+', parsed cue');
|
||||
t_parsed.step(function(){
|
||||
var t = document.createElement('track');
|
||||
t.onload = this.step_func(function(){
|
||||
var c1 = t.track.cues[0];
|
||||
var c2 = t.track.cues[1];
|
||||
var c3 = t.track.cues[2];
|
||||
assert_equals(c1.vertical, '');
|
||||
assert_equals(c2.vertical, 'rl');
|
||||
assert_equals(c3.vertical, 'lr');
|
||||
this.done();
|
||||
});
|
||||
t.onerror = this.step_func(function() {
|
||||
assert_unreached('got error event');
|
||||
});
|
||||
t.src = 'data:text/vtt,'+encodeURIComponent('WEBVTT\n\n00:00:00.000 --> 00:00:00.001\ntest\n\n'+
|
||||
'00:00:00.000 --> 00:00:00.001 vertical:rl\ntest\n\n'+
|
||||
'00:00:00.000 --> 00:00:00.001 vertical:lr\ntest');
|
||||
t.track.mode = 'showing';
|
||||
video.appendChild(t);
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue