OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>Tests modifying attributes of a VTTCue</title> | 2 <title>Tests modifying attributes of a VTTCue</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 <video> | 5 <video> |
6 <track id="captions" src="captions-webvtt/captions.vtt" kind="captions" defa
ult> | 6 <track id="captions" src="captions-webvtt/captions.vtt" kind="captions" defa
ult> |
7 </video> | 7 </video> |
8 <script> | 8 <script> |
9 async_test(function(t) { | 9 async_test(function(t) { |
10 var track = document.querySelector("track"); | 10 var track = document.querySelector("track"); |
11 | 11 |
12 track.onload = t.step_func_done(function() { | 12 track.onload = t.step_func_done(function() { |
13 var cues = track.track.cues; | 13 var cues = track.track.cues; |
14 | 14 |
15 // Test initial values. | 15 // Test initial values. |
16 textCue = cues.getCueById("1"); | 16 textCue = cues.getCueById("1"); |
17 | 17 |
18 assert_equals(textCue.startTime, 0); | 18 assert_equals(textCue.startTime, 0); |
19 assert_equals(textCue.endTime, 1.0); | 19 assert_equals(textCue.endTime, 1.0); |
20 assert_equals(textCue.pauseOnExit, false); | 20 assert_equals(textCue.pauseOnExit, false); |
21 assert_equals(textCue.vertical, ""); | 21 assert_equals(textCue.vertical, ""); |
22 assert_equals(textCue.snapToLines, true); | 22 assert_equals(textCue.snapToLines, true); |
23 assert_equals(textCue.line, "auto"); | 23 assert_equals(textCue.line, "auto"); |
24 assert_equals(textCue.position, "auto"); | 24 assert_equals(textCue.position, "auto"); |
25 assert_equals(textCue.size, 100); | 25 assert_equals(textCue.size, 100); |
26 assert_equals(textCue.align, "middle"); | 26 assert_equals(textCue.align, "center"); |
27 | 27 |
28 // Modify cue values. | 28 // Modify cue values. |
29 textCue.startTime = 1.1; | 29 textCue.startTime = 1.1; |
30 assert_equals(textCue.startTime, 1.1); | 30 assert_equals(textCue.startTime, 1.1); |
31 | 31 |
32 textCue.endTime = 3.9; | 32 textCue.endTime = 3.9; |
33 assert_equals(textCue.endTime, 3.9); | 33 assert_equals(textCue.endTime, 3.9); |
34 | 34 |
35 textCue.pauseOnExit = true; | 35 textCue.pauseOnExit = true; |
36 assert_equals(textCue.pauseOnExit, true); | 36 assert_equals(textCue.pauseOnExit, true); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // Otherwise, set the text track cue size to the new value. | 77 // Otherwise, set the text track cue size to the new value. |
78 assert_throws("IndexSizeError", function() { textCue.size = -200 }); | 78 assert_throws("IndexSizeError", function() { textCue.size = -200 }); |
79 assert_throws("IndexSizeError", function() { textCue.size = 110 }); | 79 assert_throws("IndexSizeError", function() { textCue.size = 110 }); |
80 textCue.size = 57; | 80 textCue.size = 57; |
81 assert_equals(textCue.size, 57); | 81 assert_equals(textCue.size, 57); |
82 | 82 |
83 // http://dev.w3.org/html5/webvtt/#dfn-dom-vttcue-align | 83 // http://dev.w3.org/html5/webvtt/#dfn-dom-vttcue-align |
84 // On setting, the text track cue text alignment must be set to the valu
e given in the first cell | 84 // On setting, the text track cue text alignment must be set to the valu
e given in the first cell |
85 // of the row in the table above whose second cell is a case-sensitive m
atch for the new value. | 85 // of the row in the table above whose second cell is a case-sensitive m
atch for the new value. |
86 textCue.align = "End"; | 86 textCue.align = "End"; |
87 assert_equals(textCue.align, "middle"); | 87 assert_equals(textCue.align, "center"); |
88 textCue.align = "end"; | 88 textCue.align = "end"; |
89 assert_equals(textCue.align, "end"); | 89 assert_equals(textCue.align, "end"); |
90 }); | 90 }); |
91 }); | 91 }); |
92 </script> | 92 </script> |
OLD | NEW |