Created
October 17, 2015 02:59
-
-
Save jeremyroman/9f9cbd38b1bd9b0482ee to your computer and use it in GitHub Desktop.
this layout test doesn't work
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<canvas id="canvas" width="1" height="1"></canvas> | |
<script src="../../resources/js-test.js"></script> | |
<script> | |
jsTestIsAsync = true; | |
// Create 1x1 rgba(255, 0, 0, 0.5) image data. | |
var imageData = new ImageData(new Uint8ClampedArray([255, 0, 0, 127]), 1, 1); | |
var newImageData; | |
// Convert it to an image bitmap. | |
createImageBitmap(imageData).then(imageBitmap => { | |
// Draw it into a canvas. | |
var context = document.getElementById("canvas").getContext("2d"); | |
context.drawImage(imageBitmap, 0, 0); | |
// Read the image data back and examine it. | |
newImageData = context.getImageData(0, 0, 1, 1); | |
shouldBe("Array.from(newImageData.data)", "[255, 0, 0, 127]"); | |
finishJSTest(); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment