1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/media/test/test_texttrackregion.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,63 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=917945 1.8 +--> 1.9 +<head> 1.10 + <meta charset='utf-8'> 1.11 + <title>Test for Bug 917945 - VTTRegion</title> 1.12 + <script type="text/javascript" src="/MochiKit/MochiKit.js"></script> 1.13 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.14 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.15 +</head> 1.16 +<body> 1.17 +<p id="display"></p> 1.18 +<div id="content"> 1.19 +</div> 1.20 +<pre id="test"> 1.21 +<script class="testbody" type="text/javascript"> 1.22 +SimpleTest.waitForExplicitFinish(); 1.23 +SpecialPowers.pushPrefEnv({"set": [["media.webvtt.enabled", true], 1.24 + ["media.webvtt.regions.enabled", true]]}, 1.25 + function() { 1.26 + var video = document.createElement("video"); 1.27 + video.src = "seek.webm"; 1.28 + video.preload = "auto"; 1.29 + var trackElement = document.createElement("track"); 1.30 + trackElement.src = "region.vtt"; 1.31 + trackElement.kind = "subtitles"; 1.32 + document.getElementById("content").appendChild(video); 1.33 + video.appendChild(trackElement); 1.34 + video.addEventListener("loadedmetadata", function run_tests() { 1.35 + // Re-que run_tests() at the end of the event loop until the track 1.36 + // element has loaded its data. 1.37 + if (trackElement.readyState == 1) { 1.38 + setTimeout(run_tests, 0); 1.39 + return; 1.40 + } 1.41 + is(trackElement.readyState, 2, "Track::ReadyState should be set to LOADED."); 1.42 + // Set mode to hidden so that the active cue lists are being updated. 1.43 + trackElement.track.mode = "hidden"; 1.44 + 1.45 + var cues = trackElement.track.cues; 1.46 + is(cues.length, 1, "Cue list length should be 1."); 1.47 + 1.48 + var region = cues[0].region; 1.49 + isnot(region, null, "Region should not be null."); 1.50 + is(region.width, 62, "Region width should be 50."); 1.51 + is(region.lines, 5, "Region lines should be 5."); 1.52 + is(region.regionAnchorX, 4, "Region regionAnchorX should be 4."); 1.53 + is(region.regionAnchorY, 78, "Region regionAnchorY should be 78."); 1.54 + is(region.viewportAnchorX, 10, "Region viewportAnchorX should be 10."); 1.55 + is(region.viewportAnchorY, 90, "Region viewportAnchorY should be 90."); 1.56 + is(region.scroll, "up", "Region scroll should be 'up'"); 1.57 + 1.58 + SimpleTest.finish(); 1.59 + }); 1.60 + } 1.61 +); 1.62 + 1.63 +</script> 1.64 +</pre> 1.65 +</body> 1.66 +</html>