import { applyColorMatrixToColor } from './colorMatrixMath.ts'; import { createExposureAdjustment, initializeExposureAdjustment } from './exposureAdjustment.ts'; describe('createExposureAdjustment', () => { it('defaults to the identity (exposure 0)', () => { const adjustment = createExposureAdjustment(); expect(adjustment.kind).toBe('ExposureAdjustment'); expect(applyColorMatrixToColor(adjustment.colorMatrix, 0x204060ff)).toBe(0x204060ff); }); it('scales RGB by 2^exposure, preserving alpha', () => { const adjustment = createExposureAdjustment({ exposure: 1 }); // Each channel doubles; alpha is untouched. expect(applyColorMatrixToColor(adjustment.colorMatrix, 0x204060ff)).toBe(0x4080c0ff); }); it('clamps to SDR [0,1] for the default pipeline', () => { const adjustment = createExposureAdjustment({ exposure: 1 }); // 0x80 doubled is 256 → clamps to 255. expect(applyColorMatrixToColor(adjustment.colorMatrix, 0x808080ff)).toBe(0xffffffff); }); }); describe('initializeExposureAdjustment', () => { it('is the construction initializer of createExposureAdjustment', () => { expect(typeof initializeExposureAdjustment).toBe('function'); }); });