feat: add first-class text layers
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { resolveLayerDrawImage } from "./exportArtboardPng";
|
||||
import { resolveLayerDrawImage, resolveTextLayerDraw } from "./exportArtboardPng";
|
||||
|
||||
describe("artboard PNG export", () => {
|
||||
test("draws only cropped source pixels at their retained document position", () => {
|
||||
@@ -14,4 +14,11 @@ describe("artboard PNG export", () => {
|
||||
destination: { x: 120, y: 65, w: 80, h: 60 },
|
||||
});
|
||||
});
|
||||
|
||||
test("uses deterministic text data centered for renderer rotation parity", () => {
|
||||
const draw = resolveTextLayerDraw({ id: "text", type: "text", name: "Text", visible: true, locked: false, opacity: 1, transform: { position: { x: 10, y: 20 }, scale: { x: 2, y: 3 }, rotation: 1 }, content: "AB", style: { fontFamily: "Arial", fontSize: 10, fontWeight: 400, fontStyle: "normal", color: "#ffffff", alignment: "center", lineHeight: 1.2 } });
|
||||
expect(draw.size).toEqual({ w: 10.8, h: 12 });
|
||||
expect(draw.center).toEqual({ x: 20.8, y: 38 });
|
||||
expect(draw.textX).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user