mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Update web-platform-tests to revision 10168e9a5d44efbc6e7d416d1d454eb9c9f1396c
This commit is contained in:
parent
c88dc51d03
commit
0e1caebaf4
791 changed files with 23381 additions and 5501 deletions
|
@ -2,8 +2,13 @@
|
|||
<title>canPlayType</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<audio id="audio"></audio>
|
||||
<video id="video"></video>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
let VIDEO_ELEM = document.getElementById('video');
|
||||
let AUDIO_ELEM = document.getElementById('audio');
|
||||
|
||||
function t(type, expected) {
|
||||
assert_equals(canPlayType(type), expected, type);
|
||||
}
|
||||
|
@ -22,12 +27,13 @@ test(function() {
|
|||
}, 'utility code');
|
||||
|
||||
function canPlayType(type) {
|
||||
var canPlay = document.createElement('audio').canPlayType(type);
|
||||
assert_equals(canPlay, document.createElement('video').canPlayType(type),
|
||||
let audioCanPlay = AUDIO_ELEM.canPlayType(type);
|
||||
let videoCanPlay = VIDEO_ELEM.canPlayType(type);
|
||||
assert_equals(audioCanPlay, videoCanPlay,
|
||||
'audio.canPlayType() and video.canPlayType() agree');
|
||||
assert_in_array(canPlay, ['', 'maybe', 'probably'],
|
||||
assert_in_array(audioCanPlay, ['', 'maybe', 'probably'],
|
||||
'return value is one of "", "maybe" and "probably"');
|
||||
return canPlay;
|
||||
return audioCanPlay;
|
||||
}
|
||||
|
||||
test(function() {
|
||||
|
@ -37,20 +43,22 @@ test(function() {
|
|||
t('application/octet-stream; codecs="mp4a.40.2"', '');
|
||||
t('application/octet-stream; codecs="theora, vorbis"', '');
|
||||
t('application/octet-stream; codecs="avc1.42E01E, mp4a.40.2"', '');
|
||||
}, 'application/octet-stream');
|
||||
}, 'application/octet-stream not supported');
|
||||
|
||||
test(function() {
|
||||
t('application/marks-fantasmagorical-format', '');
|
||||
t('video/x-new-fictional-format', '');
|
||||
t('video/x-new-fictional-format;codecs="kittens,bunnies"', '');
|
||||
}, 'video/x-new-fictional-format');
|
||||
}, 'fictional formats and codecs not supported');
|
||||
|
||||
function type_codecs_test(type, audioCodecs, videoCodecs) {
|
||||
var typeSupported = false;
|
||||
var codecSupported = false;
|
||||
|
||||
// Test 'type' without codecs.
|
||||
// Spec: Generally, a user agent should never return "probably" for a type
|
||||
// that allows the codecs parameter if that parameter is not present.
|
||||
test(function() {
|
||||
// Spec: Generally, a user agent should never return "probably" for a type
|
||||
// that allows the codecs parameter if that parameter is not present.
|
||||
t(type, 'maybe');
|
||||
t(type + ';', 'maybe');
|
||||
t(type + ';codecs', 'maybe');
|
||||
|
@ -66,9 +74,11 @@ function type_codecs_test(type, audioCodecs, videoCodecs) {
|
|||
}, typeWithCodec + ' (optional)');
|
||||
}
|
||||
|
||||
// Test each audio and video codec separately.
|
||||
audioCodecs.forEach(test_codec);
|
||||
videoCodecs.forEach(test_codec);
|
||||
|
||||
// Test different pairings and orderings of audio+video codecs.
|
||||
if (audioCodecs.length > 0 && videoCodecs.length > 0) {
|
||||
test(function() {
|
||||
audioCodecs.forEach(function(ac) {
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<script src="/common/reftest-wait.js"></script>
|
||||
<title>Text track cue layout after controls are added (reference)</title>
|
||||
<style>
|
||||
::cue {
|
||||
font-size: 50px;
|
||||
}
|
||||
|
||||
/* Video width should be large enough to display all of the media controls. */
|
||||
video {
|
||||
border: 1px solid gray;
|
||||
width: 500px;
|
||||
}
|
||||
</style>
|
||||
<video controls onloadeddata="this.onloadeddata = null; takeScreenshot();">
|
||||
<source src="/media/white.webm" type="video/webm">
|
||||
<source src="/media/white.mp4" type="video/mp4">
|
||||
</video>
|
||||
<script>
|
||||
// Add a single cue at line -2, where it would be if there were controls visible
|
||||
// at the bottom. (This assumes that those controls are less than 50px high.)
|
||||
// cue at line -1.
|
||||
var video = document.querySelector("video");
|
||||
var track = video.addTextTrack("captions");
|
||||
var cue = new VTTCue(0, 1, "text");
|
||||
cue.line = -2;
|
||||
track.addCue(cue);
|
||||
track.mode = "showing";
|
||||
</script>
|
||||
</html>
|
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<script src="/common/reftest-wait.js"></script>
|
||||
<link rel="match" href="track-cue-rendering-after-controls-added-ref.html">
|
||||
<title>Text track cue layout after controls are added</title>
|
||||
<style>
|
||||
::cue {
|
||||
font-size: 50px;
|
||||
}
|
||||
</style>
|
||||
<!-- Width should be large enough to display all of the media controls. -->
|
||||
<video style="border:1px solid gray; width: 500px;">
|
||||
<source src="/media/white.webm" type="video/webm">
|
||||
<source src="/media/white.mp4" type="video/mp4">
|
||||
</video>
|
||||
<script>
|
||||
// Add a cue that will overlap with the video controls.
|
||||
var video = document.querySelector("video");
|
||||
var track = video.addTextTrack("captions");
|
||||
track.addCue(new VTTCue(0, 1, "text"));
|
||||
track.mode = "showing";
|
||||
|
||||
video.onloadeddata = function() {
|
||||
// Double nesting of requestAnimationFrame to
|
||||
// make sure cue layout and paint happens.
|
||||
window.requestAnimationFrame(function() {
|
||||
window.requestAnimationFrame(function() {
|
||||
video.controls = true;
|
||||
// Wait for the relayout before screenshot.
|
||||
window.requestAnimationFrame(function() {
|
||||
takeScreenshot();
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</html>
|
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<script src="/common/reftest-wait.js"></script>
|
||||
<title>Text track cue layout after controls are removed (reference)</title>
|
||||
<style>
|
||||
::cue {
|
||||
font-size: 50px;
|
||||
}
|
||||
|
||||
video {
|
||||
border: 1px solid gray;
|
||||
}
|
||||
</style>
|
||||
<video onloadeddata="this.onloadeddata = null; takeScreenshot();">
|
||||
<source src="/media/white.webm" type="video/webm">
|
||||
<source src="/media/white.mp4" type="video/mp4">
|
||||
</video>
|
||||
<script>
|
||||
// Add a single cue at line -2, where it would be if there were controls visible
|
||||
// at the bottom. (This assumes that those controls are less than 50px high.)
|
||||
// cue at line -1.
|
||||
var video = document.querySelector("video");
|
||||
var track = video.addTextTrack("captions");
|
||||
var cue = new VTTCue(0, 1, "text");
|
||||
cue.line = -2;
|
||||
track.addCue(cue);
|
||||
track.mode = "showing";
|
||||
</script>
|
||||
</html>
|
|
@ -0,0 +1,34 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<script src="/common/reftest-wait.js"></script>
|
||||
<link rel="match" href="track-cue-rendering-after-controls-removed-ref.html">
|
||||
<title>Text track cue layout after controls are removed</title>
|
||||
<style>
|
||||
::cue {
|
||||
font-size: 50px;
|
||||
}
|
||||
</style>
|
||||
<video controls style="border:1px solid gray">
|
||||
<source src="/media/white.webm" type="video/webm">
|
||||
<source src="/media/white.mp4" type="video/mp4">
|
||||
</video>
|
||||
<script>
|
||||
// Add a cue that will overlap with the video controls.
|
||||
var video = document.querySelector("video");
|
||||
var track = video.addTextTrack("captions");
|
||||
track.addCue(new VTTCue(0, 1, "text"));
|
||||
track.mode = "showing";
|
||||
|
||||
video.onloadeddata = function() {
|
||||
// Double nesting of requestAnimationFrame to
|
||||
// make sure cue layout and paint happens.
|
||||
window.requestAnimationFrame(function() {
|
||||
window.requestAnimationFrame(function() {
|
||||
// Remove the controls. The cue should not move.
|
||||
video.controls = false;
|
||||
takeScreenshot();
|
||||
});
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</html>
|
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<title>Reference test for track-webvtt-non-snap-to-lines.html</title>
|
||||
<script src="/common/reftest-wait.js"></script>
|
||||
<script src="/common/media.js"></script>
|
||||
<style>
|
||||
.container {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
}
|
||||
.cue {
|
||||
position: absolute;
|
||||
top: 48px;
|
||||
font-family: sans-serif;
|
||||
background: green;
|
||||
color: rgba(255, 255, 255, 1);
|
||||
font-size: 12px;
|
||||
padding: 0px 2px;
|
||||
}
|
||||
</style>
|
||||
<div class="container">
|
||||
<video autoplay onplaying="this.onplaying = null; this.pause(); takeScreenshot();">
|
||||
<script>
|
||||
document.currentScript.parentNode.src = getVideoURI("/media/test");
|
||||
</script>
|
||||
</video>
|
||||
<span class="cue">Bear is Coming!!!!!</span>
|
||||
</div>
|
||||
</html>
|
|
@ -0,0 +1,24 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<title>Position is not adjusted for non snap-to-lines cues</title>
|
||||
<link rel="match" href="track-webvtt-non-snap-to-lines-ref.html">
|
||||
<script src="/common/reftest-wait.js"></script>
|
||||
<script src="/common/media.js"></script>
|
||||
<style>
|
||||
::cue {
|
||||
background: green;
|
||||
}
|
||||
</style>
|
||||
<video autoplay onplaying="this.onplaying = null; this.pause(); takeScreenshot();"></video>
|
||||
<script>
|
||||
var video = document.querySelector("video");
|
||||
var track = video.addTextTrack("captions");
|
||||
var cue = new VTTCue(0, 1, "Bear is Coming!!!!!");
|
||||
cue.snapToLines = false;
|
||||
cue.line = 20;
|
||||
cue.align = "left";
|
||||
track.addCue(cue);
|
||||
track.mode = "showing";
|
||||
video.src = getVideoURI("/media/test");
|
||||
</script>
|
||||
</html>
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<title>WebVTT two-cue layout after the first cue has ended (reference)</title>
|
||||
<script src="/common/reftest-wait.js"></script>
|
||||
<video style="border:1px solid gray">
|
||||
<source src="/media/white.webm" type="video/webm">
|
||||
<source src="/media/white.mp4" type="video/mp4">
|
||||
</video>
|
||||
<script>
|
||||
// Add a single cue at line -2, where it would be if there was a first
|
||||
// cue at line -1.
|
||||
var video = document.querySelector("video");
|
||||
var track = video.addTextTrack("captions");
|
||||
var cue = new VTTCue(0, 3, "cue 2");
|
||||
cue.line = -2;
|
||||
track.addCue(cue);
|
||||
track.mode = "showing";
|
||||
|
||||
video.onloadeddata = function() {
|
||||
takeScreenshot();
|
||||
};
|
||||
</script>
|
||||
</html>
|
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="reftest-wait">
|
||||
<title>WebVTT two-cue layout after the first cue has ended</title>
|
||||
<link rel="match" href="track-webvtt-two-cue-layout-after-first-end-ref.html">
|
||||
<script src="/common/reftest-wait.js"></script>
|
||||
<video style="border:1px solid gray">
|
||||
<source src="/media/white.webm" type="video/webm">
|
||||
<source src="/media/white.mp4" type="video/mp4">
|
||||
</video>
|
||||
<script>
|
||||
// Add two cues, where the first cue ends before the second.
|
||||
var video = document.querySelector("video");
|
||||
var track = video.addTextTrack("captions");
|
||||
track.addCue(new VTTCue(0, 1, "cue 1"));
|
||||
track.addCue(new VTTCue(0, 3, "cue 2"));
|
||||
track.mode = "showing";
|
||||
|
||||
video.onloadeddata = function() {
|
||||
// Double nesting of requestAnimationFrame to
|
||||
// make sure cue layout and paint happens.
|
||||
window.requestAnimationFrame(function() {
|
||||
window.requestAnimationFrame(function() {
|
||||
// Seek past the end of the first cue. The second cue should not move.
|
||||
video.currentTime = 2;
|
||||
video.onseeked = function() { takeScreenshot(); };
|
||||
});
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue