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/vttcue-interface/snapToLines.html | |
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/vttcue-interface/snapToLines.html')
-rw-r--r-- | testing/web-platform/tests/webvtt/webvtt-api-for-browsers/vttcue-interface/snapToLines.html | 97 |
1 files changed, 97 insertions, 0 deletions
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> |