blob: f6f0239f542d5b7271cd37b6a03916a657a7e92c [file] [log] [blame]
annacc@chromium.org334e0662011-11-13 00:47:57 +00001<!DOCTYPE html>
2<html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
6 <script src=../media-file.js></script>
7 <script src=../video-test.js></script>
8 <script>
9
10 var numberOfTrackTests = 2;
11
12 function trackLoaded()
13 {
14 numberOfTracksLoaded++;
15 if (numberOfTracksLoaded == numberOfTrackTests) {
16 testTrack(0);
17 testTrackError(1);
18 }
19 }
20
21 function testTrack(i)
22 {
23 findMediaElement();
24 testExpected("video.textTracks[" + i + "].cues.length", "3");
25
26 var fragment = document.createDocumentFragment();
commit-queue@webkit.org2d5d0272013-01-15 01:17:16 +000027 var cspan = document.createElement("span");
28 cspan.className = "blue";
29 cspan.title = "Speaker";
30 cspan.appendChild(document.createTextNode("Bear is Coming!!!!!"));
31 fragment.appendChild(cspan);
annacc@chromium.org334e0662011-11-13 00:47:57 +000032 fragment.appendChild(document.createTextNode("\nText span with a class and an annotation."));
33
34 testExpected(fragment.isEqualNode(video.textTracks[i].cues[0].getCueAsHTML()), true);
35
36 fragment = document.createDocumentFragment();
commit-queue@webkit.org2d5d0272013-01-15 01:17:16 +000037 cspan = document.createElement("span");
38 cspan.title = "Doe Hunter";
39 cspan.appendChild(document.createTextNode("I said Bear is coming!!!!"));
40 fragment.appendChild(cspan);
annacc@chromium.org334e0662011-11-13 00:47:57 +000041
42 testExpected(fragment.isEqualNode(video.textTracks[i].cues[1].getCueAsHTML()), true);
43
44
45 fragment = document.createDocumentFragment();
46 fragment.appendChild(document.createTextNode("I said "));
commit-queue@webkit.org2d5d0272013-01-15 01:17:16 +000047 cspan = document.createElement("span");
48 cspan.className = "blue";
49 cspan.title = "Speaker";
50 cspan.appendChild(document.createTextNode("Bear is coming now"));
51 fragment.appendChild(cspan);
annacc@chromium.org334e0662011-11-13 00:47:57 +000052 fragment.appendChild(document.createTextNode("!!!!"));
53
54 testExpected(fragment.isEqualNode(video.textTracks[i].cues[2].getCueAsHTML()), true);
55
56 allTestsEnded();
57 }
58
59 function testTrackError(i)
60 {
61 findMediaElement();
62 testExpected("video.textTracks[" + i + "].cues.length", "3");
63
64 var fragment = document.createDocumentFragment();
65 fragment.appendChild(document.createTextNode("Bear is Coming!!!!!"));
66 fragment.appendChild(document.createTextNode("\nThis is two annotations for an empty tag."));
67
68
69 testExpected(fragment.isEqualNode(video.textTracks[i].cues[0].getCueAsHTML()), true);
70
71 fragment = document.createDocumentFragment();
72 fragment.appendChild(document.createTextNode("I said Bear is coming!!!!"));
73 fragment.appendChild(document.createTextNode("\nThis does not parse as a voice tag."));
74
75 testExpected(fragment.isEqualNode(video.textTracks[i].cues[1].getCueAsHTML()), true);
76
77 fragment = document.createDocumentFragment();
78 fragment.appendChild(document.createTextNode("I said "));
79 fragment.appendChild(document.createTextNode("Bear is coming now"));
80 fragment.appendChild(document.createTextNode("!!!!\nThis does not parse as a voice tag."));
81
82 testExpected(fragment.isEqualNode(video.textTracks[i].cues[2].getCueAsHTML()), true);
83
84 allTestsEnded();
85 }
86 </script>
87 </head>
eric.carlson@apple.comc15ec232011-12-07 04:04:44 +000088 <body onload="enableAllTextTracks()">
annacc@chromium.org334e0662011-11-13 00:47:57 +000089 <p>Tests cues with voice markup &lt;v&gt;.</p>
90 <video>
91 <track src="captions-webvtt/tc026-voice.vtt" onload="trackLoaded()">
92 <track src="captions-webvtt/tc026-voice-bad.vtt" onload="trackLoaded()">
93 </video>
94 </body>
95</html>