Update web-platform-tests to revision b'd1192ca239e944dc6cdbcd079e1c16227e08e30c'

This commit is contained in:
WPT Sync Bot 2023-02-02 01:51:40 +00:00
parent 69b272b4e1
commit ec63c43030
233 changed files with 5065 additions and 1252 deletions

View file

@ -1,5 +1,4 @@
function make_audio_data(timestamp, channels, sampleRate, frames) {
let data = new Float32Array(frames*channels);
// This generates samples in a planar format.
@ -207,3 +206,30 @@ function isFrameClosed(frame) {
frame.displayHeight == 0 && frame.codedRect == null &&
frame.visibleRect == null;
}
function testImageBitmapToAndFromVideoFrame(
width, height, expectedPixel, canvasOptions, imageBitmapOptions,
imageSetting) {
let canvas = new OffscreenCanvas(width, height);
let ctx = canvas.getContext('2d', canvasOptions);
ctx.fillStyle = 'rgb(50, 100, 150)';
ctx.fillRect(0, 0, width, height);
testCanvas(ctx, width, height, expectedPixel, imageSetting, assert_equals);
return createImageBitmap(canvas, imageBitmapOptions)
.then((fromImageBitmap) => {
let videoFrame = new VideoFrame(fromImageBitmap, {timestamp: 0});
return createImageBitmap(videoFrame, imageBitmapOptions);
})
.then((toImageBitmap) => {
let myCanvas = new OffscreenCanvas(width, height);
let myCtx = myCanvas.getContext('2d', canvasOptions);
myCtx.drawImage(toImageBitmap, 0, 0);
let tolerance = 2;
testCanvas(
myCtx, width, height, expectedPixel, imageSetting,
(actual, expected) => {
assert_approx_equals(actual, expected, tolerance);
});
});
}