4 <title>Test for Bug
917945 - VTTRegion
</title>
5 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
6 <script type=
"text/javascript" src=
"manifest.js"></script>
7 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css"/>
10 <video id=
"v" src=
"seek.webm" preload=
"auto">
11 <track src=
"region.vtt" kind=
"subtitles" id=
"default" default
>
13 <script type=
"text/javascript">
15 * This test is used to ensure that we can parse VTT region attributes correctly
18 var trackElement
= document
.getElementById("default");
20 async
function runTest() {
21 await
waitUntiTrackLoaded();
22 checkRegionAttributes();
26 SimpleTest
.waitForExplicitFinish();
31 * The following are test helper functions.
33 async
function waitUntiTrackLoaded() {
34 if (trackElement
.readyState
!= 2) {
35 info(`wait until the track finishes loading`);
36 await
once(trackElement
, "load");
38 is(trackElement
.readyState
, 2, "Track::ReadyState should be set to LOADED.");
41 function checkRegionAttributes() {
42 let cues
= trackElement
.track
.cues
;
43 is(cues
.length
, 1, "Cue list length should be 1.");
45 let region
= cues
[0].region
;
46 isnot(region
, null, "Region should not be null.");
47 is(region
.width
, 62, "Region width should be 50.");
48 is(region
.lines
, 5, "Region lines should be 5.");
49 is(region
.regionAnchorX
, 4, "Region regionAnchorX should be 4.");
50 is(region
.regionAnchorY
, 78, "Region regionAnchorY should be 78.");
51 is(region
.viewportAnchorX
, 10, "Region viewportAnchorX should be 10.");
52 is(region
.viewportAnchorY
, 90, "Region viewportAnchorY should be 90.");
53 is(region
.scroll
, "up", "Region scroll should be 'up'");