summaryrefslogtreecommitdiff
path: root/tests/unit/image_bitmap_test.ts
diff options
context:
space:
mode:
authorHajime-san <41257923+Hajime-san@users.noreply.github.com>2024-05-07 20:47:42 +0900
committerGitHub <noreply@github.com>2024-05-07 04:47:42 -0700
commite7a2317f5a18751ecc1a63b3464690b125839ecf (patch)
tree505bb7762e5b77ca43c71804e9af5503c1ba6edb /tests/unit/image_bitmap_test.ts
parentcbb78e138ffbfc92ca64f2cce56dd5c629e4f142 (diff)
fix(ext/web): properly handle `Blob` case for `createImageBitmap` (#23518)
fixes https://github.com/denoland/deno/issues/22649
Diffstat (limited to 'tests/unit/image_bitmap_test.ts')
-rw-r--r--tests/unit/image_bitmap_test.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/unit/image_bitmap_test.ts b/tests/unit/image_bitmap_test.ts
index 364f2a167..006631182 100644
--- a/tests/unit/image_bitmap_test.ts
+++ b/tests/unit/image_bitmap_test.ts
@@ -90,3 +90,14 @@ Deno.test(async function imageBitmapFlipY() {
1, 0, 0, 1, 2, 0, 0, 1, 3, 0, 0, 1,
]));
});
+
+Deno.test(async function imageBitmapFromBlob() {
+ const path = "tests/testdata/image/1x1-white.png";
+ const imageData = new Blob([await Deno.readFile(path)], {
+ type: "image/png",
+ });
+ const imageBitmap = await createImageBitmap(imageData);
+ // @ts-ignore: Deno[Deno.internal].core allowed
+ // deno-fmt-ignore
+ assertEquals(Deno[Deno.internal].getBitmapData(imageBitmap), new Uint8Array([255,255,255,255]));
+});