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 | 9 |
10 var cues; | 10 var cues; |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 consoleWrite("<br>*** Create a new cue, check values"); | 25 consoleWrite("<br>*** Create a new cue, check values"); |
26 run("textCue = new VTTCue(33, 3.4, 'Sausage?')"); | 26 run("textCue = new VTTCue(33, 3.4, 'Sausage?')"); |
27 testExpected("textCue.track", null); | 27 testExpected("textCue.track", null); |
28 testExpected("textCue.id", ''); | 28 testExpected("textCue.id", ''); |
29 testExpected("textCue.startTime", 33); | 29 testExpected("textCue.startTime", 33); |
30 testExpected("textCue.endTime", 3.4); | 30 testExpected("textCue.endTime", 3.4); |
31 testExpected("textCue.pauseOnExit", false); | 31 testExpected("textCue.pauseOnExit", false); |
32 testExpected("textCue.vertical", ""); | 32 testExpected("textCue.vertical", ""); |
33 testExpected("textCue.snapToLines", true); | 33 testExpected("textCue.snapToLines", true); |
34 testExpected("textCue.line", -1); | 34 testExpected("textCue.line", "auto"); |
35 testExpected("textCue.position", 50); | 35 testExpected("textCue.position", 50); |
36 testExpected("textCue.size", 100); | 36 testExpected("textCue.size", 100); |
37 testExpected("textCue.align", "middle"); | 37 testExpected("textCue.align", "middle"); |
38 | 38 |
39 consoleWrite("<br>*** Remove the unadded track, make sure it thr
ows correctly."); | 39 consoleWrite("<br>*** Remove the unadded track, make sure it thr
ows correctly."); |
40 testException("testTrack.track.removeCue(textCue)", '"NotFoundEr
ror: Failed to execute \'removeCue\' on \'TextTrack\': The specified cue is not
listed in the TextTrack\'s list of cues."'); | 40 testException("testTrack.track.removeCue(textCue)", '"NotFoundEr
ror: Failed to execute \'removeCue\' on \'TextTrack\': The specified cue is not
listed in the TextTrack\'s list of cues."'); |
41 | 41 |
42 consoleWrite("<br>*** Add the new cue to a track, make sure it i
s inserted correctly."); | 42 consoleWrite("<br>*** Add the new cue to a track, make sure it i
s inserted correctly."); |
43 run("testTrack.track.addCue(textCue)"); | 43 run("testTrack.track.addCue(textCue)"); |
44 testExpected("textCue.track", testTrack.track); | 44 testExpected("textCue.track", testTrack.track); |
45 testExpected("cues[1].startTime", 31); | 45 testExpected("cues[1].startTime", 31); |
46 testExpected("cues[2].startTime", 33); | 46 testExpected("cues[2].startTime", 33); |
47 testExpected("cues[3].startTime", 61); | 47 testExpected("cues[3].startTime", 61); |
48 | 48 |
49 consoleWrite("<br>*** create a new cue and add it to a track cre
ated with video.addTextTrack, make sure it is inserted correctly."); | 49 consoleWrite("<br>*** create a new cue and add it to a track cre
ated with video.addTextTrack, make sure it is inserted correctly."); |
50 findMediaElement(); | 50 findMediaElement(); |
51 run('newTrack = video.addTextTrack("subtitles", "French subtitle
s", "fr")'); | 51 run('newTrack = video.addTextTrack("subtitles", "French subtitle
s", "fr")'); |
52 newTrack.mode = 2; | 52 newTrack.mode = 2; |
53 run('newTrack.addCue(new VTTCue(0.0, 1.0, "Test!"))'); | 53 run('newTrack.addCue(new VTTCue(0.0, 1.0, "Test!"))'); |
54 run('newCue = newTrack.cues[0]'); | 54 run('newCue = newTrack.cues[0]'); |
55 testExpected("newCue.track", newTrack); | 55 testExpected("newCue.track", newTrack); |
56 testExpected("newCue.id", ""); | 56 testExpected("newCue.id", ""); |
57 testExpected("newCue.startTime", 0.0); | 57 testExpected("newCue.startTime", 0.0); |
58 testExpected("newCue.endTime", 1.0); | 58 testExpected("newCue.endTime", 1.0); |
59 testExpected("newCue.pauseOnExit", false); | 59 testExpected("newCue.pauseOnExit", false); |
60 testExpected("newCue.vertical", ""); | 60 testExpected("newCue.vertical", ""); |
61 testExpected("newCue.snapToLines", true); | 61 testExpected("newCue.snapToLines", true); |
62 testExpected("newCue.line", -1); | 62 testExpected("newCue.line", "auto"); |
63 testExpected("newCue.position", 50); | 63 testExpected("newCue.position", 50); |
64 testExpected("newCue.size", 100); | 64 testExpected("newCue.size", 100); |
65 testExpected("newCue.align", "middle"); | 65 testExpected("newCue.align", "middle"); |
66 | 66 |
67 consoleWrite("<br>*** Remove a cue created with addCue()."); | 67 consoleWrite("<br>*** Remove a cue created with addCue()."); |
68 run("testTrack.track.removeCue(textCue)"); | 68 run("testTrack.track.removeCue(textCue)"); |
69 testExpected("textCue.track", null); | 69 testExpected("textCue.track", null); |
70 testExpected("cues[1].startTime", 31); | 70 testExpected("cues[1].startTime", 31); |
71 testExpected("cues[2].startTime", 61); | 71 testExpected("cues[2].startTime", 61); |
72 | 72 |
(...skipping 19 matching lines...) Expand all Loading... |
92 | 92 |
93 </script> | 93 </script> |
94 </head> | 94 </head> |
95 <body> | 95 <body> |
96 <p>Tests TextTrack's addCue and removeCue</p> | 96 <p>Tests TextTrack's addCue and removeCue</p> |
97 <video> | 97 <video> |
98 <track id="testTrack" src="captions-webvtt/tc013-settings.vtt" kind=
"captions" onload="trackLoaded()" default> | 98 <track id="testTrack" src="captions-webvtt/tc013-settings.vtt" kind=
"captions" onload="trackLoaded()" default> |
99 </video> | 99 </video> |
100 </body> | 100 </body> |
101 </html> | 101 </html> |
OLD | NEW |