Skip to content
This repository was archived by the owner on Jul 26, 2025. It is now read-only.

Commit 88cecdc

Browse files
committed
test: add testing case
1 parent 5fa23ca commit 88cecdc

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

src/draw/__tests__/drawCircleOnImage.test.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,3 +365,40 @@ test('default options', () => {
365365
[0, 1, 0],
366366
]);
367367
});
368+
test('draw circle image with transparent color', () => {
369+
const image = testUtils.createGreyaImage([
370+
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
371+
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
372+
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
373+
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
374+
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
375+
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
376+
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
377+
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
378+
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
379+
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
380+
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
381+
]);
382+
const center = { row: 5, column: 2 };
383+
const radius = 2;
384+
const received = image.drawCircle(center, radius, {
385+
fill: [255, 125],
386+
color: [255, 255],
387+
});
388+
389+
const expected = testUtils.createGreyaImage([
390+
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
391+
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
392+
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
393+
[0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0],
394+
[255, 255, 255, 125, 255, 125, 255, 125, 255, 255, 0, 0, 0, 0, 0, 0],
395+
[255, 255, 255, 125, 255, 125, 255, 125, 255, 255, 0, 0, 0, 0, 0, 0],
396+
[255, 255, 255, 125, 255, 125, 255, 125, 255, 255, 0, 0, 0, 0, 0, 0],
397+
[0, 0, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0],
398+
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
399+
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
400+
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
401+
]);
402+
403+
expect(expected).toMatchImage(received);
404+
});

0 commit comments

Comments
 (0)