diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/webvtt/webvtt-api-for-browsers | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/webvtt/webvtt-api-for-browsers')
6 files changed, 397 insertions, 0 deletions
diff --git a/testing/web-platform/tests/webvtt/webvtt-api-for-browsers/vttcue-interface/align.html b/testing/web-platform/tests/webvtt/webvtt-api-for-browsers/vttcue-interface/align.html new file mode 100644 index 000000000..dcae64fca --- /dev/null +++ b/testing/web-platform/tests/webvtt/webvtt-api-for-browsers/vttcue-interface/align.html @@ -0,0 +1,54 @@ +<!doctype html> +<title>VTTCue.align</title> +<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_equals(c1.align, 'center'); + var track = document.createElement('track'); + var t = track.track; + t.addCue(c1); + assert_equals(c1.align, 'center'); + video.appendChild(track); + assert_equals(c1.align, 'center'); + t.mode = 'showing'; + assert_equals(c1.align, 'center'); + c1.align = 'start'; + assert_equals(c1.align, 'start'); + c1.align = 'end'; + assert_equals(c1.align, 'end'); + c1.align = 'start\u0000'; + assert_equals(c1.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> diff --git a/testing/web-platform/tests/webvtt/webvtt-api-for-browsers/vttcue-interface/getCueAsHTML.html b/testing/web-platform/tests/webvtt/webvtt-api-for-browsers/vttcue-interface/getCueAsHTML.html new file mode 100644 index 000000000..5be09a5d3 --- /dev/null +++ b/testing/web-platform/tests/webvtt/webvtt-api-for-browsers/vttcue-interface/getCueAsHTML.html @@ -0,0 +1,92 @@ +<!doctype html> +<title>VTTCue.getCueAsHTML()</title> +<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><00: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, '00:00:00.500', 'data'); + assert_true(frag.childNodes[8] instanceof ProcessingInstruction, 'instanceof'); +}, document.title+', <00: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> diff --git a/testing/web-platform/tests/webvtt/webvtt-api-for-browsers/vttcue-interface/line.html b/testing/web-platform/tests/webvtt/webvtt-api-for-browsers/vttcue-interface/line.html new file mode 100644 index 000000000..ae0bda9fa --- /dev/null +++ b/testing/web-platform/tests/webvtt/webvtt-api-for-browsers/vttcue-interface/line.html @@ -0,0 +1,62 @@ +<!doctype html> +<title>VTTCue.line</title> +<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_equals(c1.line, -1); + var track = document.createElement('track'); + var t = track.track; + t.addCue(c1); + assert_equals(c1.line, -1); + video.appendChild(track); + assert_equals(c1.line, -1); + t.mode = 'showing'; + assert_equals(c1.line, -1); + var c2 = new VTTCue(0, 1, 'text2'); + var track2 = document.createElement('track'); + var t2 = track2.track; + t2.addCue(c2); + assert_equals(c2.line, -1); + video.appendChild(track2); + t2.mode = 'showing'; + assert_equals(c2.line, -2); + assert_equals(c1.line, -1); + c1.line = -5; + assert_equals(c1.line, -5); + assert_equals(c2.line, -2); + c1.line = 0; + c1.snapToLines = false; + assert_equals(c1.line, 0); + assert_equals(c2.line, -2); +}, 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, -1); + 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> diff --git a/testing/web-platform/tests/webvtt/webvtt-api-for-browsers/vttcue-interface/snapToLines.html b/testing/web-platform/tests/webvtt/webvtt-api-for-browsers/vttcue-interface/snapToLines.html new file mode 100644 index 000000000..c28b9d064 --- /dev/null +++ b/testing/web-platform/tests/webvtt/webvtt-api-for-browsers/vttcue-interface/snapToLines.html @@ -0,0 +1,97 @@ +<!doctype html> +<title>VTTCue.snapToLines</title> +<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(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> diff --git a/testing/web-platform/tests/webvtt/webvtt-api-for-browsers/vttcue-interface/text.html b/testing/web-platform/tests/webvtt/webvtt-api-for-browsers/vttcue-interface/text.html new file mode 100644 index 000000000..ec317f828 --- /dev/null +++ b/testing/web-platform/tests/webvtt/webvtt-api-for-browsers/vttcue-interface/text.html @@ -0,0 +1,38 @@ +<!doctype html> +<title>VTTCue.text</title> +<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_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> diff --git a/testing/web-platform/tests/webvtt/webvtt-api-for-browsers/vttcue-interface/vertical.html b/testing/web-platform/tests/webvtt/webvtt-api-for-browsers/vttcue-interface/vertical.html new file mode 100644 index 000000000..51fd169ba --- /dev/null +++ b/testing/web-platform/tests/webvtt/webvtt-api-for-browsers/vttcue-interface/vertical.html @@ -0,0 +1,54 @@ +<!doctype html> +<title>VTTCue.vertical</title> +<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_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> |