mirror of
https://github.com/servo/servo.git
synced 2025-08-22 05:45:33 +01:00
Update web-platform-tests to revision 60220357131c65146444da1f54624d5b54d0975d
This commit is contained in:
parent
c45192614c
commit
775b784f79
2144 changed files with 58115 additions and 29658 deletions
|
@ -0,0 +1,44 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<title>createImageBitmap: clipping to the bitmap</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/canvas-tests.js"></script>
|
||||
<script>
|
||||
promise_test(function(t) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
const image = new Image();
|
||||
image.onload = function() { resolve(image); };
|
||||
image.onerror = function() { reject(); };
|
||||
image.src = "/images/green-16x16.png";
|
||||
}).then(function(image) {
|
||||
return createImageBitmap(image, 8, 8, 16, 16);
|
||||
}).then(function(imageBitmap) {
|
||||
const color = 204;
|
||||
|
||||
const canvas = document.createElement("canvas");
|
||||
canvas.width = 16;
|
||||
canvas.height = 16;
|
||||
|
||||
// debug
|
||||
document.body.appendChild(canvas);
|
||||
canvas.setAttribute("style", "width: 100px; height: 100px;");
|
||||
|
||||
const ctx = canvas.getContext("2d");
|
||||
ctx.fillStyle = `rgb(${color}, ${color}, ${color})`;
|
||||
ctx.fillRect(0, 0, 20, 20);
|
||||
ctx.drawImage(imageBitmap, 0, 0);
|
||||
|
||||
const expected = [
|
||||
[ 4, 4, 0,255,0,255],
|
||||
[12, 4, color,color,color,255],
|
||||
[ 4, 12, color,color,color,255],
|
||||
[12, 12, color,color,color,255],
|
||||
];
|
||||
for (let [x, y, r, g, b, a] of expected) {
|
||||
_assertPixel(canvas, x,y, r,g,b,a, `${x},${y}`, `${r},${g},${b},${a}`);
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue