mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Update web-platform-tests to revision b'468d01bbd84da2babf265c6af46947be68713440'
This commit is contained in:
parent
35e95f55a1
commit
58e8ee674b
9438 changed files with 266112 additions and 106976 deletions
|
@ -1,6 +1,30 @@
|
|||
function makeOffscreenCanvas(width, height) {
|
||||
function make_audio_data(timestamp, channels, sampleRate, frames) {
|
||||
|
||||
let data = new Float32Array(frames*channels);
|
||||
|
||||
// This generates samples in a planar format.
|
||||
for (var channel = 0; channel < channels; channel++) {
|
||||
let hz = 100 + channel * 50; // sound frequency
|
||||
let base_index = channel * frames;
|
||||
for (var i = 0; i < frames; i++) {
|
||||
let t = (i / sampleRate) * hz * (Math.PI * 2);
|
||||
data[base_index + i] = Math.sin(t);
|
||||
}
|
||||
}
|
||||
|
||||
return new AudioData({
|
||||
timestamp: timestamp,
|
||||
data: data,
|
||||
numberOfChannels: channels,
|
||||
numberOfFrames: frames,
|
||||
sampleRate: sampleRate,
|
||||
format: "f32-planar",
|
||||
});
|
||||
}
|
||||
|
||||
function makeOffscreenCanvas(width, height, options) {
|
||||
let canvas = new OffscreenCanvas(width, height);
|
||||
let ctx = canvas.getContext('2d');
|
||||
let ctx = canvas.getContext('2d', options);
|
||||
ctx.fillStyle = 'rgba(50, 100, 150, 255)';
|
||||
ctx.fillRect(0, 0, width, height);
|
||||
return canvas;
|
||||
|
@ -127,22 +151,6 @@ function testUnconfiguredCodec(test, codec, codecInput) {
|
|||
return promise_rejects_dom(test, 'InvalidStateError', codec.flush(), 'flush');
|
||||
}
|
||||
|
||||
// Verifies a PlaneInit structure matches the actual constructed plane.
|
||||
function verifyPlane(expected, actual) {
|
||||
assert_less_than_equal(expected.stride, actual.stride, 'plane strides');
|
||||
assert_equals(expected.rows, actual.rows, 'plane rows');
|
||||
assert_less_than_equal(
|
||||
expected.stride * expected.rows, actual.length, 'plane size');
|
||||
|
||||
var testBuffer = new Uint8Array(actual.length);
|
||||
actual.readInto(testBuffer);
|
||||
for (var h = 0; h < actual.rows; ++h) {
|
||||
assert_array_equals(
|
||||
expected.src.slice(h * expected.stride, expected.stride),
|
||||
testBuffer.slice(h * actual.stride, expected.stride), 'plane data');
|
||||
}
|
||||
}
|
||||
|
||||
// Reference values generated by:
|
||||
// https://fiddle.skia.org/c/f100d4d5f085a9e09896aabcbc463868
|
||||
|
||||
|
@ -185,3 +193,9 @@ function testCanvas(ctx, width, height, expected_pixel, imageSetting, assert_com
|
|||
assert_compares(colorData[i + 3], expected_pixel[3]);
|
||||
}
|
||||
}
|
||||
|
||||
function makeDetachedArrayBuffer() {
|
||||
let buffer = new Uint8Array();
|
||||
new MessageChannel().port1.postMessage(buffer, [buffer]);
|
||||
return buffer;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue