Skip to content

Commit

Permalink
Validate the same pixel in all 2d.composite meta WPT tests
Browse files Browse the repository at this point in the history
Having the same assertions in all tests will simplify things when we
migrate these tests to the new test generator, allowing all tests to
share the same common base implementation.

Bug: 40207206
Change-Id: Ifaa73c2b8021ef00290d36729d3f54094951d9d0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6192519
Commit-Queue: Jean-Philippe Gravel <[email protected]>
Reviewed-by: Andres Ricardo Perez <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1410976}
  • Loading branch information
graveljp authored and chromium-wpt-export-bot committed Jan 24, 2025
1 parent c99065a commit 32cc0b0
Show file tree
Hide file tree
Showing 53 changed files with 40 additions and 95 deletions.
3 changes: 1 addition & 2 deletions html/canvas/element/compositing/2d.composite.clip.clear.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ <h1>2d.composite.clip.clear</h1>
ctx.clip();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 25,25, 0,255,0,255);
_assertPixel(canvas, 75,25, 0,255,0,255);
_assertPixel(canvas, 50,25, 0,255,0,255);

});
</script>
Expand Down
3 changes: 1 addition & 2 deletions html/canvas/element/compositing/2d.composite.clip.copy.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ <h1>2d.composite.clip.copy</h1>
ctx.clip();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 25,25, 0,255,0,255);
_assertPixel(canvas, 75,25, 0,255,0,255);
_assertPixel(canvas, 50,25, 0,255,0,255);

});
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ <h1>2d.composite.clip.destination-atop</h1>
ctx.clip();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 25,25, 0,255,0,255);
_assertPixel(canvas, 75,25, 0,255,0,255);
_assertPixel(canvas, 50,25, 0,255,0,255);

});
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ <h1>2d.composite.clip.destination-in</h1>
ctx.clip();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 25,25, 0,255,0,255);
_assertPixel(canvas, 75,25, 0,255,0,255);
_assertPixel(canvas, 50,25, 0,255,0,255);

});
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ <h1>2d.composite.clip.destination-out</h1>
ctx.clip();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 25,25, 0,255,0,255);
_assertPixel(canvas, 75,25, 0,255,0,255);
_assertPixel(canvas, 50,25, 0,255,0,255);

});
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ <h1>2d.composite.clip.destination-over</h1>
ctx.clip();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 25,25, 0,255,0,255);
_assertPixel(canvas, 75,25, 0,255,0,255);
_assertPixel(canvas, 50,25, 0,255,0,255);

});
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ <h1>2d.composite.clip.lighter</h1>
ctx.clip();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 25,25, 0,255,0,255);
_assertPixel(canvas, 75,25, 0,255,0,255);
_assertPixel(canvas, 50,25, 0,255,0,255);

});
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ <h1>2d.composite.clip.source-atop</h1>
ctx.clip();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 25,25, 0,255,0,255);
_assertPixel(canvas, 75,25, 0,255,0,255);
_assertPixel(canvas, 50,25, 0,255,0,255);

});
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ <h1>2d.composite.clip.source-in</h1>
ctx.clip();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 25,25, 0,255,0,255);
_assertPixel(canvas, 75,25, 0,255,0,255);
_assertPixel(canvas, 50,25, 0,255,0,255);

});
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ <h1>2d.composite.clip.source-out</h1>
ctx.clip();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 25,25, 0,255,0,255);
_assertPixel(canvas, 75,25, 0,255,0,255);
_assertPixel(canvas, 50,25, 0,255,0,255);

});
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ <h1>2d.composite.clip.source-over</h1>
ctx.clip();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 25,25, 0,255,0,255);
_assertPixel(canvas, 75,25, 0,255,0,255);
_assertPixel(canvas, 50,25, 0,255,0,255);

});
</script>
Expand Down
3 changes: 1 addition & 2 deletions html/canvas/element/compositing/2d.composite.clip.xor.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ <h1>2d.composite.clip.xor</h1>
ctx.clip();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 25,25, 0,255,0,255);
_assertPixel(canvas, 75,25, 0,255,0,255);
_assertPixel(canvas, 50,25, 0,255,0,255);

});
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ <h1>2d.composite.uncovered.image.copy</h1>
const blob = await response.blob();
const bitmap = await createImageBitmap(blob);
ctx.drawImage(bitmap, 40, 40, 10, 10, 40, 50, 10, 10);
_assertPixelApprox(canvas, 15,15, 0,0,0,0, 5);
_assertPixelApprox(canvas, 50,25, 0,0,0,0, 5);

}, "drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ <h1>2d.composite.uncovered.image.destination-atop</h1>
const blob = await response.blob();
const bitmap = await createImageBitmap(blob);
ctx.drawImage(bitmap, 40, 40, 10, 10, 40, 50, 10, 10);
_assertPixelApprox(canvas, 15,15, 0,0,0,0, 5);
_assertPixelApprox(canvas, 50,25, 0,0,0,0, 5);

}, "drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ <h1>2d.composite.uncovered.image.destination-in</h1>
const blob = await response.blob();
const bitmap = await createImageBitmap(blob);
ctx.drawImage(bitmap, 40, 40, 10, 10, 40, 50, 10, 10);
_assertPixelApprox(canvas, 15,15, 0,0,0,0, 5);
_assertPixelApprox(canvas, 50,25, 0,0,0,0, 5);

}, "drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ <h1>2d.composite.uncovered.image.source-in</h1>
const blob = await response.blob();
const bitmap = await createImageBitmap(blob);
ctx.drawImage(bitmap, 40, 40, 10, 10, 40, 50, 10, 10);
_assertPixelApprox(canvas, 15,15, 0,0,0,0, 5);
_assertPixelApprox(canvas, 50,25, 0,0,0,0, 5);

}, "drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ <h1>2d.composite.uncovered.image.source-out</h1>
const blob = await response.blob();
const bitmap = await createImageBitmap(blob);
ctx.drawImage(bitmap, 40, 40, 10, 10, 40, 50, 10, 10);
_assertPixelApprox(canvas, 15,15, 0,0,0,0, 5);
_assertPixelApprox(canvas, 50,25, 0,0,0,0, 5);

}, "drawImage() draws pixels not covered by the source object as (0,0,0,0), and does not leave the pixels unchanged.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ <h1>2d.composite.clip.clear</h1>
ctx.clip();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 25,25, 0,255,0,255);
_assertPixel(canvas, 75,25, 0,255,0,255);
_assertPixel(canvas, 50,25, 0,255,0,255);
t.done();

});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ t.step(function() {
ctx.clip();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 25,25, 0,255,0,255);
_assertPixel(canvas, 75,25, 0,255,0,255);
_assertPixel(canvas, 50,25, 0,255,0,255);
t.done();
});
done();
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ <h1>2d.composite.clip.copy</h1>
ctx.clip();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 25,25, 0,255,0,255);
_assertPixel(canvas, 75,25, 0,255,0,255);
_assertPixel(canvas, 50,25, 0,255,0,255);
t.done();

});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ t.step(function() {
ctx.clip();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 25,25, 0,255,0,255);
_assertPixel(canvas, 75,25, 0,255,0,255);
_assertPixel(canvas, 50,25, 0,255,0,255);
t.done();
});
done();
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ <h1>2d.composite.clip.destination-atop</h1>
ctx.clip();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 25,25, 0,255,0,255);
_assertPixel(canvas, 75,25, 0,255,0,255);
_assertPixel(canvas, 50,25, 0,255,0,255);
t.done();

});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ t.step(function() {
ctx.clip();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 25,25, 0,255,0,255);
_assertPixel(canvas, 75,25, 0,255,0,255);
_assertPixel(canvas, 50,25, 0,255,0,255);
t.done();
});
done();
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ <h1>2d.composite.clip.destination-in</h1>
ctx.clip();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 25,25, 0,255,0,255);
_assertPixel(canvas, 75,25, 0,255,0,255);
_assertPixel(canvas, 50,25, 0,255,0,255);
t.done();

});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ t.step(function() {
ctx.clip();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 25,25, 0,255,0,255);
_assertPixel(canvas, 75,25, 0,255,0,255);
_assertPixel(canvas, 50,25, 0,255,0,255);
t.done();
});
done();
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ <h1>2d.composite.clip.destination-out</h1>
ctx.clip();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 25,25, 0,255,0,255);
_assertPixel(canvas, 75,25, 0,255,0,255);
_assertPixel(canvas, 50,25, 0,255,0,255);
t.done();

});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ t.step(function() {
ctx.clip();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 25,25, 0,255,0,255);
_assertPixel(canvas, 75,25, 0,255,0,255);
_assertPixel(canvas, 50,25, 0,255,0,255);
t.done();
});
done();
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ <h1>2d.composite.clip.destination-over</h1>
ctx.clip();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 25,25, 0,255,0,255);
_assertPixel(canvas, 75,25, 0,255,0,255);
_assertPixel(canvas, 50,25, 0,255,0,255);
t.done();

});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ t.step(function() {
ctx.clip();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 25,25, 0,255,0,255);
_assertPixel(canvas, 75,25, 0,255,0,255);
_assertPixel(canvas, 50,25, 0,255,0,255);
t.done();
});
done();
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ <h1>2d.composite.clip.lighter</h1>
ctx.clip();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 25,25, 0,255,0,255);
_assertPixel(canvas, 75,25, 0,255,0,255);
_assertPixel(canvas, 50,25, 0,255,0,255);
t.done();

});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ t.step(function() {
ctx.clip();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 25,25, 0,255,0,255);
_assertPixel(canvas, 75,25, 0,255,0,255);
_assertPixel(canvas, 50,25, 0,255,0,255);
t.done();
});
done();
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ <h1>2d.composite.clip.source-atop</h1>
ctx.clip();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 25,25, 0,255,0,255);
_assertPixel(canvas, 75,25, 0,255,0,255);
_assertPixel(canvas, 50,25, 0,255,0,255);
t.done();

});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ t.step(function() {
ctx.clip();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 25,25, 0,255,0,255);
_assertPixel(canvas, 75,25, 0,255,0,255);
_assertPixel(canvas, 50,25, 0,255,0,255);
t.done();
});
done();
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ <h1>2d.composite.clip.source-in</h1>
ctx.clip();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 25,25, 0,255,0,255);
_assertPixel(canvas, 75,25, 0,255,0,255);
_assertPixel(canvas, 50,25, 0,255,0,255);
t.done();

});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ t.step(function() {
ctx.clip();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 25,25, 0,255,0,255);
_assertPixel(canvas, 75,25, 0,255,0,255);
_assertPixel(canvas, 50,25, 0,255,0,255);
t.done();
});
done();
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ <h1>2d.composite.clip.source-out</h1>
ctx.clip();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 25,25, 0,255,0,255);
_assertPixel(canvas, 75,25, 0,255,0,255);
_assertPixel(canvas, 50,25, 0,255,0,255);
t.done();

});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ t.step(function() {
ctx.clip();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 25,25, 0,255,0,255);
_assertPixel(canvas, 75,25, 0,255,0,255);
_assertPixel(canvas, 50,25, 0,255,0,255);
t.done();
});
done();
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ <h1>2d.composite.clip.source-over</h1>
ctx.clip();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 25,25, 0,255,0,255);
_assertPixel(canvas, 75,25, 0,255,0,255);
_assertPixel(canvas, 50,25, 0,255,0,255);
t.done();

});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ t.step(function() {
ctx.clip();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 25,25, 0,255,0,255);
_assertPixel(canvas, 75,25, 0,255,0,255);
_assertPixel(canvas, 50,25, 0,255,0,255);
t.done();
});
done();
3 changes: 1 addition & 2 deletions html/canvas/offscreen/compositing/2d.composite.clip.xor.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ <h1>2d.composite.clip.xor</h1>
ctx.clip();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 25,25, 0,255,0,255);
_assertPixel(canvas, 75,25, 0,255,0,255);
_assertPixel(canvas, 50,25, 0,255,0,255);
t.done();

});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ t.step(function() {
ctx.clip();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 25,25, 0,255,0,255);
_assertPixel(canvas, 75,25, 0,255,0,255);
_assertPixel(canvas, 50,25, 0,255,0,255);
t.done();
});
done();
Loading

0 comments on commit 32cc0b0

Please sign in to comment.