mirror of
https://github.com/servo/servo.git
synced 2025-08-25 07:08:21 +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
|
@ -7,12 +7,53 @@
|
|||
<script>
|
||||
test(function() {
|
||||
var region = new VTTRegion();
|
||||
assert_equals(region.width, 100);
|
||||
assert_equals(region.lines, 3);
|
||||
assert_equals(region.regionAnchorX, 0);
|
||||
assert_equals(region.regionAnchorY, 100);
|
||||
assert_true(region instanceof VTTRegion, "instanceof");
|
||||
|
||||
assert_equals(region.scroll, "");
|
||||
assert_equals(region.viewportAnchorX, 0);
|
||||
assert_equals(region.viewportAnchorY, 100);
|
||||
assert_equals(region.scroll, '');
|
||||
}, document.title + ' initial values');
|
||||
assert_equals(region.regionAnchorX, 0);
|
||||
assert_equals(region.regionAnchorY, 100);
|
||||
assert_equals(region.lines, 3);
|
||||
assert_equals(region.width, 100);
|
||||
}, document.title + " initial values");
|
||||
|
||||
test(function() {
|
||||
var region = new VTTRegion();
|
||||
region.scroll = "invalid-scroll-value";
|
||||
assert_equals(region.scroll, "");
|
||||
|
||||
checkValues([-1, 101], "IndexSizeError");
|
||||
checkValues([-Infinity, Infinity, NaN], new TypeError);
|
||||
function checkValues(invalidValues, exception) {
|
||||
for (var value of invalidValues) {
|
||||
assert_throws(exception, function() { region.viewportAnchorX = value; });
|
||||
assert_equals(region.viewportAnchorX, 0);
|
||||
assert_throws(exception, function() { region.viewportAnchorY = value; });
|
||||
assert_equals(region.viewportAnchorY, 100);
|
||||
assert_throws(exception, function() { region.regionAnchorX = value; });
|
||||
assert_equals(region.regionAnchorX, 0);
|
||||
assert_throws(exception, function() { region.regionAnchorY = value; });
|
||||
assert_equals(region.regionAnchorY, 100);
|
||||
assert_throws(exception, function() { region.width = value; });
|
||||
assert_equals(region.width, 100);
|
||||
}
|
||||
}
|
||||
|
||||
assert_throws("IndexSizeError", function() { region.lines = -1; });
|
||||
assert_equals(region.lines, 3);
|
||||
|
||||
region.lines = 130;
|
||||
assert_equals(region.lines, 130);
|
||||
region.viewportAnchorX = 64;
|
||||
assert_equals(region.viewportAnchorX, 64);
|
||||
region.viewportAnchorY = 32;
|
||||
assert_equals(region.viewportAnchorY, 32);
|
||||
region.regionAnchorX = 16;
|
||||
assert_equals(region.regionAnchorX, 16);
|
||||
region.regionAnchorY = 8;
|
||||
assert_equals(region.regionAnchorY, 8);
|
||||
region.width = 42;
|
||||
assert_equals(region.width, 42);
|
||||
}, document.title + " mutations");
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Box-less VTTCue attached to VTTRegion</title>
|
||||
<script src="/common/media.js"></script>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<video></video>
|
||||
<script>
|
||||
setup(function() {
|
||||
window.video = document.querySelector('video');
|
||||
video.src = getVideoURI('/media/test');
|
||||
});
|
||||
async_test(function(t) {
|
||||
let track = video.addTextTrack('subtitles');
|
||||
let cue = new VTTCue(0, 1, '');
|
||||
cue.region = new VTTRegion();
|
||||
cue.onexit = t.step_func_done(function() {
|
||||
video.pause();
|
||||
});
|
||||
track.addCue(cue);
|
||||
video.onloadedmetadata = t.step_func(function() {
|
||||
video.currentTime = 0.8;
|
||||
video.play();
|
||||
});
|
||||
video.onended = t.unreached_func('test ends before video');
|
||||
});
|
||||
</script>
|
|
@ -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