blob: 5b44beda83e26b96a43b4d934ac4eb08d2eac7b2 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src=../media-file.js></script>
<script src=../video-test.js></script>
<script>
var cues;
function logSpecURL(url, description)
{
consoleWrite("<br><i>" + description + "</i>");
consoleWrite("<a href=" + url + ">" + url + "<" + "/a>");
}
function trackLoaded()
{
track = document.getElementById('captions');
cues = track.track.cues;
consoleWrite("** Test initial values.");
run("textCue = cues.getCueById('1')");
testExpected("textCue.startTime", 0);
testExpected("textCue.endTime", 1.0);
testExpected("textCue.pauseOnExit", false);
testExpected("textCue.vertical", "");
testExpected("textCue.snapToLines", true);
testExpected("textCue.line", -1);
testExpected("textCue.position", 'auto');
testExpected("textCue.size", 100);
testExpected("textCue.align", "center");
consoleWrite("<br>** Modify cue values.");
run("textCue.startTime = 1.1");
testExpected("textCue.startTime", 1.1);
consoleWrite("");
run("textCue.endTime = 3.9");
testExpected("textCue.endTime", 3.9);
consoleWrite("");
run("textCue.pauseOnExit = true");
testExpected("textCue.pauseOnExit", true);
logSpecURL("http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#dom-texttrackcue-vertical",
"On setting, the text track cue writing direction must be set to the value ... is a case-sensitive match for the new value, if any. If none of the values match, then the user agent must instead throw a SyntaxError exception.");
testDOMException("textCue.vertical = 'RL'", "DOMException.SYNTAX_ERR");
testExpected("textCue.vertical", "");
run("textCue.vertical = 'rl'");
testExpected("textCue.vertical", "rl");
consoleWrite("");
run("textCue.snapToLines = false");
testExpected("textCue.snapToLines", false);
logSpecURL("http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#dom-texttrackcue-line",
"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.");
testDOMException("textCue.line = -2", "DOMException.INDEX_SIZE_ERR");
testDOMException("textCue.line = 102", "DOMException.INDEX_SIZE_ERR");
testExpected("textCue.line", -1);
run("textCue.line = 42");
testExpected("textCue.line", 42);
run("textCue.snapToLines = true");
run("textCue.line = -2");
testExpected("textCue.line", -2);
run("textCue.line = 102");
testExpected("textCue.line", 102);
logSpecURL("http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#dom-texttrackcue-line",
"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.");
testDOMException("textCue.position = -200", "DOMException.INDEX_SIZE_ERR");
testDOMException("textCue.position = 110", "DOMException.INDEX_SIZE_ERR");
run("textCue.position = 11");
testExpected("textCue.position", 11);
logSpecURL("http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#dom-texttrackcue-size",
"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.");
testDOMException("textCue.size = -200", "DOMException.INDEX_SIZE_ERR");
testDOMException("textCue.size = 110", "DOMException.INDEX_SIZE_ERR");
run("textCue.size = 57");
testExpected("textCue.size", 57);
logSpecURL("http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#dom-texttrackcue-align",
"On setting, the text track cue alignment must be set to the value ... is a case-sensitive match for the new value, if any. If none of the values match, then the user agent must instead throw a SyntaxError exception.");
testDOMException("textCue.align = 'End'", "DOMException.SYNTAX_ERR");
testExpected("textCue.align", "center");
run("textCue.align = 'end'");
testExpected("textCue.align", "end");
consoleWrite("");
endTest();
}
setCaptionDisplayMode('Automatic');
</script>
</head>
<body>
<p>Tests modifying attributes of a TextTrackCue</p>
<video controls>
<track id="captions" src="captions-webvtt/captions.vtt" kind="captions" onload="trackLoaded()" default>
</video>
</body>
</html>