diff options
Diffstat (limited to 'testing/web-platform/tests/webvtt/webvtt-api-for-browsers/vttcue-interface/align.html')
-rw-r--r-- | testing/web-platform/tests/webvtt/webvtt-api-for-browsers/vttcue-interface/align.html | 54 |
1 files changed, 54 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> |