OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
5 | 5 |
6 <script src=../../media-file.js></script> | 6 <script src=../../media-file.js></script> |
7 <script src=../../video-test.js></script> | 7 <script src=../../video-test.js></script> |
8 <script> | 8 <script> |
9 var testTrack; | 9 var testTrack; |
10 var region; | 10 var region; |
11 var regions; | 11 var regions; |
12 var updatedRegion; | 12 var updatedRegion; |
13 | 13 |
14 function startTest() | 14 function startTest() |
15 { | 15 { |
16 testTrack = document.getElementsByTagName('track')[0]; | 16 testTrack = document.getElementsByTagName('track')[0]; |
17 | 17 |
18 consoleWrite("<br>** Implicit mode disabled and the regions attribut
e is null **"); | 18 consoleWrite("<br>** Implicit mode disabled and the regions attribut
e is null **"); |
19 testExpected("testTrack.track.mode", "disabled"); | 19 testExpected("testTrack.track.mode", "disabled"); |
20 testExpected("testTrack.track.regions", null); | 20 testExpected("testTrack.track.regions", null); |
21 | 21 |
22 testTrack.track.mode = "hidden"; | 22 testTrack.track.mode = "hidden"; |
23 regions = testTrack.track.regions; | 23 regions = testTrack.track.regions; |
24 | 24 |
25 consoleWrite("<br>** The regions attribute should be an empty TextTr
ackRegionList **"); | 25 consoleWrite("<br>** Test instanceof VTTRegionList **"); |
| 26 testExpected("regions instanceof VTTRegionList", true); |
| 27 |
| 28 consoleWrite("<br>** The regions attribute should be an empty VTTReg
ionList **"); |
26 testExpected("regions != null", true); | 29 testExpected("regions != null", true); |
27 testExpected("regions.length", 0); | 30 testExpected("regions.length", 0); |
28 | 31 |
29 region = new TextTrackRegion(); | 32 region = new VTTRegion(); |
30 region.id = "TestId"; | 33 region.id = "TestId"; |
31 | 34 |
32 consoleWrite("<br>** The default value of the track attribute of the
region is null**"); | 35 consoleWrite("<br>** The default value of the track attribute of the
region is null**"); |
33 testExpected("region.track", null); | 36 testExpected("region.track", null); |
34 | 37 |
35 testTrack.track.addRegion(region); | 38 testTrack.track.addRegion(region); |
36 | 39 |
37 consoleWrite("<br>** The addRegion() method properly updates the Tex
tTrackRegionList object **"); | 40 consoleWrite("<br>** The addRegion() method properly updates the VTT
RegionList object **"); |
38 testExpected("regions.length", 1); | 41 testExpected("regions.length", 1); |
39 testExpected("regions[0] == region", true); | 42 testExpected("regions[0] == region", true); |
40 testExpected("regions[0].track == testTrack.track", true); | 43 testExpected("regions[0].track == testTrack.track", true); |
41 | 44 |
42 consoleWrite("<br>** The track attribute should correctly reflect th
e track to which the region was added to**"); | 45 consoleWrite("<br>** The track attribute should correctly reflect th
e track to which the region was added to**"); |
43 testExpected("region.track == testTrack.track", true); | 46 testExpected("region.track == testTrack.track", true); |
44 | 47 |
45 updatedRegion = new TextTrackRegion(); | 48 updatedRegion = new VTTRegion(); |
46 updatedRegion.id = region.id; | 49 updatedRegion.id = region.id; |
47 updatedRegion.viewportAnchorX = 59; | 50 updatedRegion.viewportAnchorX = 59; |
48 updatedRegion.viewportAnchorY = 68; | 51 updatedRegion.viewportAnchorY = 68; |
49 updatedRegion.regionAnchorX = 20; | 52 updatedRegion.regionAnchorX = 20; |
50 updatedRegion.regionAnchorY = 30; | 53 updatedRegion.regionAnchorY = 30; |
51 updatedRegion.height = 5; | 54 updatedRegion.height = 5; |
52 updatedRegion.width = 87; | 55 updatedRegion.width = 87; |
53 updatedRegion.scroll = "up"; | 56 updatedRegion.scroll = "up"; |
54 | 57 |
55 consoleWrite("<br>** Adding a region with an existing id should upda
te the existing region **"); | 58 consoleWrite("<br>** Adding a region with an existing id should upda
te the existing region **"); |
(...skipping 27 matching lines...) Expand all Loading... |
83 endTest(); | 86 endTest(); |
84 } | 87 } |
85 | 88 |
86 function startTestWithDelay() | 89 function startTestWithDelay() |
87 { | 90 { |
88 setTimeout(startTest, 100); | 91 setTimeout(startTest, 100); |
89 } | 92 } |
90 </script> | 93 </script> |
91 </head> | 94 </head> |
92 <body onload="startTestWithDelay()"> | 95 <body onload="startTestWithDelay()"> |
93 <p>Tests TextTrackRegionList functionality: length, operator[], and getR
egionById()</p> | 96 <p>Tests VTTRegionList functionality: length, operator[], and getRegionB
yId()</p> |
94 <video> | 97 <video> |
95 <track id="testTrack" src="captions-webvtt/captions-fast.vtt"> | 98 <track id="testTrack" src="captions-webvtt/captions-fast.vtt"> |
96 </video> | 99 </video> |
97 </body> | 100 </body> |
98 </html> | 101 </html> |
OLD | NEW |