Files
luminary/src/lib/export.test.ts
T
bhursey 3759b47bc6 Add JPEG XL export with a lossless option
Export now offers JPEG XL (8-bit sRGB) next to JPEG, PNG, WebP and 16-bit
TIFF, encoded on-device by libjxl compiled to WebAssembly so the export stays
offline. The codec loads only when a JXL is chosen, the quality slider applies
to the lossy mode, and a lossless switch disables it. The user guide and
changelog describe the format and its current limits (no ICC or XMP yet).

Also adds SECURITY-AUDIT.md with the dependency scan and the review of the
server's trust boundaries.
2026-12-01 14:43:29 +00:00

38 lines
1.3 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { outputSize } from '../gl/renderer';
import { defaultEdits } from './edits';
import { buildFileName, DEFAULT_EXPORT } from './export';
import type { PhotoRecord } from '../types';
describe('export output dimensions', () => {
it('matches the source for an uncropped image', () => {
expect(outputSize(defaultEdits(), 6000, 4000)).toEqual({ w: 6000, h: 4000 });
});
it('swaps dimensions for a quarter turn', () => {
const edits = defaultEdits();
edits.crop.quarter = 1;
expect(outputSize(edits, 6000, 4000)).toEqual({ w: 4000, h: 6000 });
});
it('includes the triangular points added by straightening', () => {
const edits = defaultEdits();
edits.crop.angle = 45;
expect(outputSize(edits, 4000, 3000)).toEqual({ w: 4950, h: 4950 });
});
it('writes the JPEG XL extension for a JXL export', () => {
const photo = { name: 'DSCF1234.RAF', addedAt: Date.now() } as PhotoRecord;
const name = buildFileName('{name}', photo, 0, { ...DEFAULT_EXPORT, format: 'jxl' });
expect(name).toBe('DSCF1234.jxl');
});
it('applies the crop after the rotated frame is calculated', () => {
const edits = defaultEdits();
edits.crop.angle = 45;
edits.crop.w = 0.5;
edits.crop.h = 0.5;
expect(outputSize(edits, 4000, 3000)).toEqual({ w: 2475, h: 2475 });
});
});