15 lines
509 B
TypeScript
15 lines
509 B
TypeScript
import { test } from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { applyMaskAlpha } from './maskedPreview';
|
|
|
|
test('applyMaskAlpha keeps slab pixels and clears the background', () => {
|
|
const rgba = new Uint8ClampedArray([
|
|
1, 2, 3, 255,
|
|
4, 5, 6, 255,
|
|
7, 8, 9, 255,
|
|
]);
|
|
const out = applyMaskAlpha(rgba, new Uint8Array([1, 0]));
|
|
assert.deepEqual([...out], [1, 2, 3, 255, 4, 5, 6, 0, 7, 8, 9, 0]);
|
|
assert.deepEqual([...rgba], [1, 2, 3, 255, 4, 5, 6, 255, 7, 8, 9, 255]);
|
|
});
|