41 function createOneTest(rgbaValue) {
42 return new Promise(function (resolve, reject) {
48 var imageData = new ImageData(new Uint8ClampedArray([r, g, b, a]), 1, 1);
51 createImageBitmap(imageData).then(
52 function (imageBitmap) {
53 var context = document.createElement("canvas").getContext("2d");
54 context.drawImage(imageBitmap, 0, 0);
55 newImageData = context.getImageData(0, 0, 1, 1);
56 var newR = newImageData.data[0];
57 var newG = newImageData.data[1];
58 var newB = newImageData.data[2];
59 var newA = newImageData.data[3];
61 Math.abs(r - newR) <= tolerance &&
62 Math.abs(g - newG) <= tolerance &&
63 Math.abs(b - newB) <= tolerance &&
64 Math.abs(a - newA) <= tolerance;
75 ") should equal to imageData(" +
84 "Premultiplied Alpha is handled while creating ImageBitmap from ImageData."
99 function testBug1239752() {
101 for (var i = 0; i < RGBAValues.length; ++i) {
102 tests.push(createOneTest(RGBAValues[i]));
105 return Promise.all(tests);