blob: 07e68c6237501501934db2fc5965f6f79ba4e852 [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", 'auto');
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);
textCue.vertical = 'xyz';
testExpected("textCue.vertical", "");
run("textCue.vertical = 'rl'");
testExpected("textCue.vertical", "rl");
consoleWrite("");
run("textCue.snapToLines = false");
testExpected("textCue.snapToLines", false);
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);
run("textCue.align = 'End'");
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>