regions-regionanchor.test (2697B)
1 regions, regionanchor 2 <link rel="help" href="https://w3c.github.io/webvtt/#collect-webvtt-region-settings"> 3 4 assert_equals(cues.length, 20); 5 6 var regions = Array.from(cues).map(function(cue) { 7 return cue.region; 8 }); 9 10 var valid_anchors = [ 11 [0, 100], 12 [0, 0], 13 [1, 1], 14 [100, 0], 15 [0, 100], 16 [100, 100], 17 ]; 18 valid_anchors.forEach(function(pair, index) { 19 var anchorX = pair[0]; 20 var anchorY = pair[1]; 21 22 assert_equals(regions[index].regionAnchorX, anchorX, 'Failed with region ' + index); 23 assert_equals(regions[index].regionAnchorY, anchorY, 'Failed with region ' + index); 24 }); 25 26 for (var i = 0; i < 14; i++) { 27 var index = valid_anchors.length + i; 28 29 assert_equals(regions[index].regionAnchorX, 0, 'Failed with region ' + index); 30 assert_equals(regions[index].regionAnchorY, 100, 'Failed with region ' + index); 31 } 32 33 === 34 WEBVTT 35 36 NOTE valid 37 38 REGION 39 id:0 40 41 REGION 42 id:1 43 regionanchor:0%,0% 44 45 REGION 46 id:2 47 regionanchor:1%,1% 48 49 REGION 50 id:3 51 regionanchor:100%,0% 52 53 REGION 54 id:4 55 regionanchor:0%,100% 56 57 REGION 58 id:5 59 regionanchor:100%,100% 60 61 NOTE invalid 62 63 REGION 64 id:6 65 regionanchor:0,0 66 67 REGION 68 id:7 69 regionanchor:0%,0 70 71 REGION 72 id:8 73 regionanchor:0,0% 74 75 REGION 76 id:9 77 regionanchor:1% 78 79 REGION 80 id:10 81 regionanchor:,1% 82 83 REGION 84 id:11 85 regionanchor:101%,1% 86 87 REGION 88 id:12 89 regionanchor:1%,101% 90 91 REGION 92 id:13 93 regionanchor:-0%,0% 94 95 REGION 96 id:14 97 regionanchor:0%,-0% 98 99 REGION 100 id:15 101 regionanchor:65536%,65536% 102 103 REGION 104 id:16 105 regionanchor:4294967296%,4294967296% 106 107 REGION 108 id:17 109 regionanchor:18446744073709552000%,18446744073709552000% 110 111 REGION 112 id:18 113 regionanchor:10000000000000000000000000000000000%,10000000000000000000000000000000000% 114 115 REGION 116 id:19 117 regionanchor: 100%,100% 118 regionanchor :100%,100% 119 regionanchor:100% ,100% 120 regionanchor:100%, 100% 121 regionanchor:100 %,100% 122 regionanchor:100%,100 % 123 124 00:00:00.000 --> 00:00:01.000 region:0 125 text 126 127 00:00:00.000 --> 00:00:01.000 region:1 128 text 129 130 00:00:00.000 --> 00:00:01.000 region:2 131 text 132 133 00:00:00.000 --> 00:00:01.000 region:3 134 text 135 136 00:00:00.000 --> 00:00:01.000 region:4 137 text 138 139 00:00:00.000 --> 00:00:01.000 region:5 140 text 141 142 00:00:00.000 --> 00:00:01.000 region:6 143 text 144 145 00:00:00.000 --> 00:00:01.000 region:7 146 text 147 148 00:00:00.000 --> 00:00:01.000 region:8 149 text 150 151 00:00:00.000 --> 00:00:01.000 region:9 152 text 153 154 00:00:00.000 --> 00:00:01.000 region:10 155 text 156 157 00:00:00.000 --> 00:00:01.000 region:11 158 text 159 160 00:00:00.000 --> 00:00:01.000 region:12 161 text 162 163 00:00:00.000 --> 00:00:01.000 region:13 164 text 165 166 00:00:00.000 --> 00:00:01.000 region:14 167 text 168 169 00:00:00.000 --> 00:00:01.000 region:15 170 text 171 172 00:00:00.000 --> 00:00:01.000 region:16 173 text 174 175 00:00:00.000 --> 00:00:01.000 region:17 176 text 177 178 00:00:00.000 --> 00:00:01.000 region:18 179 text 180 181 00:00:00.000 --> 00:00:01.000 region:19 182 text