Files
songs2vid/scripts/preview-typography.test.ts
T
Atakan Doğan ÖzbanandCursor 56880256e5 Enlarge watermark badge for preview/encode parity and document video title fields.
Fix double-scaled badge preview, bump default watermark to 42% frame width, and update OSS docs/API for title vs songTitle separation and shared typography.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-27 18:28:07 +02:00

26 lines
844 B
TypeScript

import assert from "node:assert/strict";
import {
artistFontSizeForWidth,
scaleFontToPreview,
titleFontSizeForWidth,
watermarkFontSizeForWidth,
} from "../lib/preview-typography";
function testFontSizesMatchLayout() {
const width = 1280;
assert.equal(titleFontSizeForWidth(width), Math.max(22, Math.round(width * 0.032)));
assert.equal(artistFontSizeForWidth(width), Math.max(16, Math.round(width * 0.02)));
assert.equal(watermarkFontSizeForWidth(width), Math.max(22, Math.round(width * 0.028)));
}
function testPreviewScaling() {
const encodeWidth = 1920;
const titlePx = titleFontSizeForWidth(encodeWidth);
const previewPx = scaleFontToPreview(titlePx, encodeWidth);
assert.ok(previewPx > 0 && previewPx < titlePx);
}
testFontSizesMatchLayout();
testPreviewScaling();
console.log("preview-typography.test.ts: ok");