blob: 27267332334ee7d35c5672c839a7f325b1bd3a08 [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 src=../media-controls.js></script>
<style>
::cue(:lang(ru)) { color: lime; }
::cue(lang[lang="en"]) { color: purple; }
::cue(c[lang="ru"]) { color: red; } /* Shouldn't work, no attribute 'lang' for 'c'. */
</style>
<script>
var cueNode;
var seekedCount = 0;
var seekTimes = [0.1];
var info = [["rgb(128, 0, 128)", "rgb(0, 255, 0)", "rgb(128, 0, 128)"]];
function seeked()
{
if (testEnded)
return;
cueNode = textTrackDisplayElement(video, 'cue').firstElementChild.firstElementChild;
testExpected("getComputedStyle(cueNode).color", info[seekedCount][0]);
cueNode = cueNode.firstElementChild.firstElementChild;
testExpected("getComputedStyle(cueNode).color", info[seekedCount][1]);
cueNode = cueNode.firstElementChild.firstElementChild;
testExpected("getComputedStyle(cueNode).color", info[seekedCount][2]);
if (++seekedCount == info.length)
endTest();
else {
consoleWrite("");
run("video.currentTime = " + seekTimes[seekedCount]);
}
}
function loaded()
{
consoleWrite("Test that cues are being matched properly by the lang attribute and :lang() pseudo class.");
findMediaElement();
video.src = findMediaFile('video', '../content/test');
video.id = "testvideo";
waitForEvent('seeked', seeked);
waitForEvent('canplaythrough', function() { video.currentTime = seekTimes[0]; });
}
setCaptionDisplayMode('Automatic');
</script>
</head>
<body onload="loaded()">
<video controls >
<track src="captions-webvtt/styling-lang.vtt" kind="captions" default>
</video>
</body>
</html>