4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6 <script src=../media-file.js></script>
7 <script src=../video-test.js></script>
12 function logSpecURL(url, description)
14 consoleWrite("<br><i>" + description + "</i>");
15 consoleWrite("<a href=" + url + ">" + url + "<" + "/a>");
18 function trackLoaded()
20 track = document.getElementById('captions');
21 cues = track.track.cues;
23 consoleWrite("** Test initial values.");
24 run("textCue = cues.getCueById('1')");
26 testExpected("textCue.startTime", 0);
27 testExpected("textCue.endTime", 1.0);
28 testExpected("textCue.pauseOnExit", false);
29 testExpected("textCue.vertical", "");
30 testExpected("textCue.snapToLines", true);
31 testExpected("textCue.line", -1);
32 testExpected("textCue.position", 50);
33 testExpected("textCue.size", 100);
34 testExpected("textCue.align", "middle");
36 consoleWrite("<br>** Modify cue values.");
38 run("textCue.startTime = 1.1");
39 testExpected("textCue.startTime", 1.1);
42 run("textCue.endTime = 3.9");
43 testExpected("textCue.endTime", 3.9);
46 run("textCue.pauseOnExit = true");
47 testExpected("textCue.pauseOnExit", true);
49 logSpecURL("http://dev.w3.org/html5/webvtt/#dfn-dom-vttcue-vertical",
50 "On setting, the text track cue writing direction must be set to the value given in the first cell of the row in the table above whose second cell is a case-sensitive match for the new value.");
51 run("textCue.vertical = 'RL'");
52 testExpected("textCue.vertical", "");
53 run("textCue.vertical = 'rl'");
54 testExpected("textCue.vertical", "rl");
57 run("textCue.snapToLines = false");
58 testExpected("textCue.snapToLines", false);
60 logSpecURL("http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#dom-texttrackcue-line",
61 "On setting, if the text track cue snap-to-lines flag is not set, and the new value is negative or greater than 100, then throw an IndexSizeError exception.");
62 testDOMException("textCue.line = -2", "DOMException.INDEX_SIZE_ERR");
63 testDOMException("textCue.line = 102", "DOMException.INDEX_SIZE_ERR");
64 testExpected("textCue.line", -1);
65 run("textCue.line = 42");
66 testExpected("textCue.line", 42);
67 run("textCue.snapToLines = true");
68 run("textCue.line = -2");
69 testExpected("textCue.line", -2);
70 run("textCue.line = 102");
71 testExpected("textCue.line", 102);
73 logSpecURL("http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#dom-texttrackcue-line",
74 "On setting, if the new value is negative or greater than 100, then throw an IndexSizeError exception. Otherwise, set the text track cue text position to the new value.");
75 testDOMException("textCue.position = -200", "DOMException.INDEX_SIZE_ERR");
76 testDOMException("textCue.position = 110", "DOMException.INDEX_SIZE_ERR");
77 run("textCue.position = 11");
78 testExpected("textCue.position", 11);
80 logSpecURL("http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#dom-texttrackcue-size",
81 "On setting, if the new value is negative or greater than 100, then throw an IndexSizeError exception. Otherwise, set the text track cue size to the new value.");
82 testDOMException("textCue.size = -200", "DOMException.INDEX_SIZE_ERR");
83 testDOMException("textCue.size = 110", "DOMException.INDEX_SIZE_ERR");
84 run("textCue.size = 57");
85 testExpected("textCue.size", 57);
87 logSpecURL("http://dev.w3.org/html5/webvtt/#dfn-dom-vttcue-align",
88 "On setting, the text track cue text alignment must be set to the value given in the first cell of the row in the table above whose second cell is a case-sensitive match for the new value.");
89 run("textCue.align = 'End'");
90 testExpected("textCue.align", "middle");
91 run("textCue.align = 'end'");
92 testExpected("textCue.align", "end");
101 <p>Tests modifying attributes of a VTTCue</p>
103 <track id="captions" src="captions-webvtt/captions.vtt" kind="captions" onload="trackLoaded()" default>