OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <title>Tests WebVTT settings.</title> |
3 <head> | 3 <script src="track-helpers.js"></script> |
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 4 <script src="../../resources/testharness.js"></script> |
| 5 <script src="../../resources/testharnessreport.js"></script> |
| 6 <script> |
| 7 check_cues_from_track("captions-webvtt/tc013-settings.vtt", function(track) { |
| 8 var expected = [ |
| 9 { line: 100, position: "auto", align: "start", vertical: "" }, |
| 10 { line: 15, position: 40, align: "middle", vertical: "rl" }, |
| 11 { line: "auto", position: 10, align: "middle", vertical: "" }, |
| 12 { line: 95, position: "auto", align: "end", vertical: "lr" } |
| 13 ]; |
5 | 14 |
6 <script src=../media-file.js></script> | 15 assert_cues_match(track.cues, expected); |
7 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 | 16 }); |
8 (Please avoid writing new tests using video-test.js) --> | |
9 <script src=../video-test.js></script> | |
10 <script> | |
11 | 17 |
12 numberOfTrackTests = 2; | 18 check_cues_from_track("captions-webvtt/tc013-settings-bad-separation.vtt", funct
ion(track) { |
| 19 var expected = [ |
| 20 { line: 43, position: 10, align: "middle", vertical: "" }, |
| 21 { line: "auto", position: 50, align: "end", vertical: "" }, |
| 22 { line: "auto", position: "auto", align: "middle", vertical: "" }, |
| 23 { line: "auto", position: 90, align: "middle", vertical: "lr" } |
| 24 ]; |
13 | 25 |
14 function trackLoaded() | 26 assert_cues_match(track.cues, expected); |
15 { | 27 }); |
16 numberOfTracksLoaded++; | 28 </script> |
17 if (numberOfTracksLoaded == numberOfTrackTests) { | |
18 for (var i = 0; i <= numberOfTrackTests; ++i) | |
19 testTrack(i); | |
20 } | |
21 } | |
22 | |
23 function testTrack(i) | |
24 { | |
25 findMediaElement(); | |
26 var expected = | |
27 [ | |
28 { | |
29 length : 4, | |
30 tests: | |
31 [ | |
32 { | |
33 property : "line", | |
34 values : [100, 15, "auto", 95], | |
35 }, | |
36 { | |
37 property : "position", | |
38 values : ["auto", 40, 10, "auto"], | |
39 }, | |
40 { | |
41 property : "align", | |
42 values : ["start", "middle", "middle", "end"], | |
43 }, | |
44 { | |
45 property : "vertical", | |
46 values : ["", "rl", "", "lr"], | |
47 }, | |
48 ], | |
49 }, | |
50 { | |
51 length : 4, | |
52 tests: | |
53 [ | |
54 { | |
55 property : "line", | |
56 values : [43, "auto", "auto", "auto"], | |
57 }, | |
58 { | |
59 property : "position", | |
60 values : [10, 50, "auto", 90], | |
61 }, | |
62 { | |
63 property : "align", | |
64 values : ["middle", "end", "middle", "middle"], | |
65 }, | |
66 { | |
67 property : "vertical", | |
68 values : ["", "", "", "lr"], | |
69 }, | |
70 ], | |
71 } | |
72 ] | |
73 testCues(i, expected[i]); | |
74 | |
75 allTestsEnded(); | |
76 } | |
77 </script> | |
78 </head> | |
79 <body onload="enableAllTextTracks()"> | |
80 <p>Tests WebVTT settings.</p> | |
81 <video> | |
82 <track src="captions-webvtt/tc013-settings.vtt" onload="trackLoaded(
)"> | |
83 <track src="captions-webvtt/tc013-settings-bad-separation.vtt" onloa
d="trackLoaded()"> | |
84 </video> | |
85 </body> | |
86 </html> | |
OLD | NEW |