Initial OSS scaffold from Songs2VID (pre-strip)

This commit is contained in:
Songs2VID OSS
2026-08-03 06:15:05 +02:00
commit 935abfb22e
195 changed files with 25023 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
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");