mirror of
https://github.com/servo/servo.git
synced 2025-08-15 10:25:32 +01:00
Update web-platform-tests to revision c26470dac73f2df9d4822a0d3482f7eb1ebf57d9
This commit is contained in:
parent
7de87c487b
commit
4d3c932c47
648 changed files with 9014 additions and 4821 deletions
|
@ -0,0 +1,50 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Tests proper parsing of various regions present in WebVTT header area.</title>
|
||||
<script src="/common/media.js"></script>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
const regionDefaults = {
|
||||
width: 100,
|
||||
lines: 3,
|
||||
regionAnchorX: 0,
|
||||
regionAnchorY: 100,
|
||||
viewportAnchorX: 0,
|
||||
viewportAnchorY: 100,
|
||||
scroll: ''
|
||||
};
|
||||
|
||||
function checkProperties(region, expected, i) {
|
||||
for (var prop in regionDefaults) {
|
||||
if (!(prop in expected))
|
||||
expected[prop] = regionDefaults[prop];
|
||||
assert_equals(region[prop], expected[prop], prop + ' (cue ' + ( i + 1 ) + ')');
|
||||
}
|
||||
}
|
||||
|
||||
function checkCueRegions(cues) {
|
||||
for (let i = 0; i < cues.length; ++i) {
|
||||
let cue = cues[i];
|
||||
let expected = JSON.parse(cue.text);
|
||||
if (cue.region)
|
||||
checkProperties(cue.region, expected, i);
|
||||
else
|
||||
assert_equals(expected, 'no region');
|
||||
}
|
||||
}
|
||||
|
||||
async_test(function(t) {
|
||||
var video = document.createElement('video');
|
||||
video.src = getVideoURI('/media/test');
|
||||
var testTrack = document.createElement('track');
|
||||
testTrack.onload = t.step_func_done(function() {
|
||||
var track = testTrack.track;
|
||||
assert_equals(track.cues.length, 9);
|
||||
checkCueRegions(track.cues);
|
||||
});
|
||||
testTrack.src = 'support/header-regions.vtt';
|
||||
testTrack.kind = 'captions';
|
||||
testTrack.default = true;
|
||||
video.appendChild(testTrack);
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,52 @@
|
|||
WEBVTT FILE
|
||||
|
||||
REGION
|
||||
id:region_without_settings
|
||||
|
||||
REGION
|
||||
id:region_with_all_settings width:32%
|
||||
lines:5
|
||||
regionanchor:41%,20% viewportanchor:31%,84%
|
||||
scroll:up
|
||||
|
||||
REGION
|
||||
id:region_floating_point_anchor
|
||||
regionanchor:41.125%,20.25% viewportanchor:32.75%,32.5%
|
||||
|
||||
REGION
|
||||
id:not_unique_id width:42%
|
||||
|
||||
REGION
|
||||
id:not_unique_id
|
||||
width:67%
|
||||
|
||||
REGION
|
||||
invalid_settings values but region still created
|
||||
: Invalid Header
|
||||
|
||||
00:00:00.000 --> 00:00:02.500 region:someregionattributeid
|
||||
"no region"
|
||||
|
||||
00:00:00.000 --> 00:00:02.500 line:5 region:ignored_attribute_value
|
||||
"no region"
|
||||
|
||||
00:00:00.000 --> 00:00:02.500 size:10% region:ignored_attribute_value
|
||||
"no region"
|
||||
|
||||
00:00:00.000 --> 00:00:02.500 vertical:lr region:ignored_attribute_value
|
||||
"no region"
|
||||
|
||||
00:00:03.000 --> 00:00:04.000 region:region_without_settings
|
||||
{}
|
||||
|
||||
00:00:04.000 --> 00:00:05.000 region:region_with_all_settings
|
||||
{"width":32,"lines":5,"regionAnchorX":41,"regionAnchorY":20,"viewportAnchorX":31,"viewportAnchorY":84,"scroll":"up"}
|
||||
|
||||
00:00:05.000 --> 00:00:06.000 region:region_floating_point_anchor
|
||||
{"regionAnchorX":41.125,"regionAnchorY":20.25,"viewportAnchorX":32.75,"viewportAnchorY":32.5}
|
||||
|
||||
00:00:06.000 --> 00:00:07.000 region:not_unique_id
|
||||
{"width":67}
|
||||
|
||||
00:00:07.000 --> 00:00:08.000 region:
|
||||
"no region"
|
Loading…
Add table
Add a link
Reference in a new issue