Update web-platform-tests to revision b'7af9d6ec48ab04043a2bea85a3599904a1a19efa'

This commit is contained in:
WPT Sync Bot 2021-02-21 08:20:50 +00:00 committed by Josh Matthews
parent 8050c95e31
commit 87be1008de
2742 changed files with 142451 additions and 40667 deletions

View file

@ -140,3 +140,46 @@ function verifyPlane(expected, actual) {
testBuffer.slice(h * actual.stride, expected.stride), 'plane data');
}
}
// Reference values generated by:
// https://fiddle.skia.org/c/f100d4d5f085a9e09896aabcbc463868
const kSRGBPixel = [50, 100, 150, 255];
const kP3Pixel = [62, 99, 146, 255];
const kRec2020Pixel = [87, 106, 151, 255];
const kCanvasOptionsP3Uint8 = {
colorSpace: 'display-p3',
pixelFormat: 'uint8'
};
const kImageSettingOptionsP3Uint8 = {
colorSpace: 'display-p3',
storageFormat: 'uint8'
};
const kCanvasOptionsRec2020Uint8 = {
colorSpace: 'rec2020',
pixelFormat: 'uint8'
};
const kImageSettingOptionsRec2020Uint8 = {
colorSpace: 'rec2020',
storageFormat: 'uint8'
};
function testCanvas(ctx, width, height, expected_pixel, imageSetting, assert_compares) {
// The dup getImageData is to workaournd crbug.com/1100233
let imageData = ctx.getImageData(0, 0, width, height, imageSetting);
let colorData = ctx.getImageData(0, 0, width, height, imageSetting).data;
const kMaxPixelToCheck = 128 * 96;
let step = width * height / kMaxPixelToCheck;
step = Math.round(step);
step = (step < 1) ? 1 : step;
for (let i = 0; i < 4 * width * height; i += (4 * step)) {
assert_compares(colorData[i], expected_pixel[0]);
assert_compares(colorData[i + 1], expected_pixel[1]);
assert_compares(colorData[i + 2], expected_pixel[2]);
assert_compares(colorData[i + 3], expected_pixel[3]);
}
}