Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Side by Side Diff: LayoutTests/media/track/opera/interfaces/VTTCue/position.html

Issue 851933003: WebVTT: Support 'auto' text position (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix test nits. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/media/track/opera/track/webvtt/parsing/001.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!doctype html> 1 <!doctype html>
2 <title>VTTCue.align</title> 2 <title>VTTCue.position</title>
3 <script src=../../../../../resources/testharness.js></script> 3 <script src=../../../../../resources/testharness.js></script>
4 <script src=../../../../../resources/testharnessreport.js></script> 4 <script src=../../../../../resources/testharnessreport.js></script>
5 <div id=log></div> 5 <div id=log></div>
6 <script> 6 <script>
7 test(function(){ 7 test(function() {
8 var video = document.createElement('video'); 8 var video = document.createElement('video');
9 document.body.appendChild(video); 9 document.body.appendChild(video);
10 var c1 = new VTTCue(0, 1, 'text1'); 10 var cue = new VTTCue(0, 1, 'text1');
11 assert_equals(c1.align, 'middle'); 11 assert_equals(cue.position, 'auto');
12 var track = document.createElement('track'); 12 var track = document.createElement('track');
13 var t = track.track; 13 var t = track.track;
14 t.addCue(c1); 14 t.addCue(cue);
15 assert_equals(c1.align, 'middle'); 15 assert_equals(cue.position, 'auto');
16 video.appendChild(track); 16 video.appendChild(track);
17 assert_equals(c1.align, 'middle'); 17 assert_equals(cue.position, 'auto');
18 t.mode = 'showing'; 18 t.mode = 'showing';
19 assert_equals(c1.align, 'middle'); 19 assert_equals(cue.position, 'auto');
20 c1.align = 'start'; 20 cue.position = 50;
21 assert_equals(c1.align, 'start'); 21 assert_equals(cue.position, 50);
22 c1.align = 'end'; 22 assert_throws(new TypeError, function() { cue.position = 'auto\u0000'; });
23 assert_equals(c1.align, 'end'); 23 assert_throws(new TypeError, function() { cue.position = NaN; });
24 c1.align = 'start\u0000'; 24 assert_throws(new TypeError, function() { cue.position = Infinity; });
25 assert_equals(c1.align, 'end'); 25 assert_equals(cue.position, 50);
26 cue.position = 'auto';
27 assert_equals(cue.position, 'auto');
26 }, document.title+', script-created cue'); 28 }, document.title+', script-created cue');
27 29
28 var t_parsed = async_test(document.title+', parsed cue'); 30 var t_parsed = async_test(document.title+', parsed cue');
29 t_parsed.step(function(){ 31 t_parsed.step(function() {
30 var video = document.createElement('video'); 32 var video = document.createElement('video');
31 document.body.appendChild(video); 33 document.body.appendChild(video);
32 var t = document.createElement('track'); 34 var t = document.createElement('track');
33 t.onload = this.step_func(function(){ 35 t.onload = this.step_func(function() {
34 var c1 = t.track.cues[0]; 36 var cues = t.track.cues;
35 var c2 = t.track.cues[1]; 37 assert_equals(cues[0].position, 'auto');
36 var c3 = t.track.cues[2]; 38 assert_equals(cues[1].position, 'auto');
37 var c4 = t.track.cues[3]; 39 assert_equals(cues[2].position, 25);
38 assert_equals(c1.align, 'middle'); 40 assert_equals(cues[3].position, 75);
39 assert_equals(c2.align, 'start');
40 assert_equals(c3.align, 'middle');
41 assert_equals(c4.align, 'end');
42 this.done(); 41 this.done();
43 }); 42 });
44 t.src = 'data:text/vtt,'+encodeURIComponent('WEBVTT\n\n00:00:00.000 --> 00:0 0:00.001\ntest\n\n'+ 43 t.src = 'data:text/vtt,'+encodeURIComponent('WEBVTT\n\n00:00:00.000 --> 00:0 0:00.001\ntest\n\n'+
45 '00:00:00.000 --> 00:00:00.001 a lign:start\ntest\n\n'+ 44 '00:00:00.000 --> 00:00:00.001 a lign:start\ntest\n\n'+
46 '00:00:00.000 --> 00:00:00.001 a lign:middle\ntest\n\n'+ 45 '00:00:00.000 --> 00:00:00.001 p osition:25%\ntest\n\n'+
47 '00:00:00.000 --> 00:00:00.001 a lign:end\ntest'); 46 '00:00:00.000 --> 00:00:00.001 a lign:start position:75%\ntest\n\n');
48 t.track.mode = 'showing'; 47 t.track.mode = 'showing';
49 video.appendChild(t); 48 video.appendChild(t);
50 }); 49 });
51 </script> 50 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/media/track/opera/track/webvtt/parsing/001.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698