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

Commit b7894a8

Browse files
authored
test: add fromMask test with image containing only '0' or '1'
1 parent 0e8410a commit b7894a8

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/roi/__tests__/fromMask.test.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,34 @@
11
import { fromMask } from '..';
22
import { Mask } from '../..';
33

4+
test('3x3 mask, black', () => {
5+
const mask = testUtils.createMask([
6+
[0, 0, 0],
7+
[0, 0, 0],
8+
[0, 0, 0],
9+
]);
10+
const expected = [
11+
[-1, -1, -1],
12+
[-1, -1, -1],
13+
[-1, -1, -1],
14+
];
15+
expect(fromMask(mask).getMapMatrix()).toStrictEqual(expected);
16+
});
17+
18+
test('3x3 mask, white', () => {
19+
const mask = testUtils.createMask([
20+
[1, 1, 1],
21+
[1, 1, 1],
22+
[1, 1, 1],
23+
]);
24+
const expected = [
25+
[1, 1, 1],
26+
[1, 1, 1],
27+
[1, 1, 1],
28+
];
29+
expect(fromMask(mask).getMapMatrix()).toStrictEqual(expected);
30+
});
31+
432
test('3x3 mask, cross', () => {
533
const mask = testUtils.createMask([
634
[0, 1, 0],

0 commit comments

Comments
 (0)