fix(measure): show masked calibration preview

This commit is contained in:
grokbot_ty
2026-09-26 08:38:17 -07:00
parent 0dd5d255ec
commit 89bc7d4ee9
3 changed files with 116 additions and 10 deletions
+14
View File
@@ -0,0 +1,14 @@
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]);
});