mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-28 12:18:56 +00:00
Tests/LibWeb: Add test to verify correctness of getImageData
This commit is contained in:
parent
d2f9ba7db1
commit
dbc94ce92e
Notes:
sideshowbarker
2024-07-17 22:55:25 +09:00
Author: https://github.com/circl-lastname
Commit: dbc94ce92e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/166
Issue: https://github.com/LadybirdBrowser/ladybird/issues/120
2 changed files with 21 additions and 0 deletions
|
@ -0,0 +1 @@
|
||||||
|
PASS
|
|
@ -0,0 +1,20 @@
|
||||||
|
<script src="../include.js"></script>
|
||||||
|
<script>
|
||||||
|
test(() => {
|
||||||
|
let area = document.createElement("canvas");
|
||||||
|
let areaCtx = area.getContext("2d");
|
||||||
|
|
||||||
|
area.width = 1;
|
||||||
|
area.height = 1;
|
||||||
|
|
||||||
|
areaCtx.fillStyle = "#ff8040";
|
||||||
|
areaCtx.fillRect(0, 0, 1, 1);
|
||||||
|
|
||||||
|
let imageData = areaCtx.getImageData(0, 0, area.width, area.height);
|
||||||
|
|
||||||
|
if (imageData.data[0] == 0xff && imageData.data[1] == 0x80 && imageData.data[2] == 0x40)
|
||||||
|
println("PASS");
|
||||||
|
else
|
||||||
|
println("FAIL");
|
||||||
|
});
|
||||||
|
</script>
|
Loading…
Add table
Add a link
Reference in a new issue