feat(POSTV1-ASSET-ALL-16): 完整还原归档文字模板素材
Dada P0-A isolated Windows CI / validate-and-package (push) Waiting to run
Dada P0-A isolated Windows CI / validate-and-package (push) Waiting to run
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
TextEditSession,
|
||||
createTextTemplateElement,
|
||||
effectiveFontSize,
|
||||
fontOption,
|
||||
searchTextTemplates,
|
||||
} from "../../apps/web/src/text-assets.js";
|
||||
import { elementHalfExtents } from "../../apps/web/src/editor-elements.js";
|
||||
@@ -51,7 +52,7 @@ describe("TASK-WP4-03 text templates and properties", () => {
|
||||
template_or_asset_id: "H003",
|
||||
});
|
||||
expect(switched.style_parameters).toMatchObject({
|
||||
fill_color: "#111111", letter_spacing: 1, line_height: 1.2, stroke_enabled: false,
|
||||
fill_color: "#FFFFFF", letter_spacing: 0, line_height: 1, stroke_enabled: false,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -73,12 +74,12 @@ describe("TASK-WP4-03 text templates and properties", () => {
|
||||
|
||||
it("synchronizes numeric font size with the canvas scale", () => {
|
||||
const element = createTextTemplateElement(P0A_TEXT_TEMPLATES[0]!, identity, 0, { scale: { x: 1.5, y: 1.5 } });
|
||||
expect(effectiveFontSize(element)).toBe(72);
|
||||
expect(effectiveFontSize(element)).toBe(P0A_TEXT_TEMPLATES[0]!.defaultFontSize * 1.5);
|
||||
const edit = new TextEditSession(element, P0A_TEXT_TEMPLATES);
|
||||
edit.setEffectiveFontSize(96);
|
||||
const resized = edit.complete();
|
||||
expect(resized.font_size).toBe(48);
|
||||
expect(resized.scale).toEqual({ x: 2, y: 2 });
|
||||
expect(resized.font_size).toBe(P0A_TEXT_TEMPLATES[0]!.defaultFontSize);
|
||||
expect(resized.scale).toEqual({ x: 96 / P0A_TEXT_TEMPLATES[0]!.defaultFontSize, y: 96 / P0A_TEXT_TEMPLATES[0]!.defaultFontSize });
|
||||
expect(effectiveFontSize(resized)).toBe(96);
|
||||
});
|
||||
|
||||
@@ -97,10 +98,11 @@ describe("TASK-WP4-03 text templates and properties", () => {
|
||||
expect(bounds.y).toBeGreaterThan(0.16);
|
||||
});
|
||||
|
||||
it("adds every template with a registered catalog font", () => {
|
||||
it("adds every template with its captured default font", () => {
|
||||
expect(P0A_TEXT_TEMPLATES.every((template) => template.available && template.fontUrl)).toBe(true);
|
||||
const registeredFonts = new Set(P0A_FONT_OPTIONS.map((font) => font.fontId));
|
||||
expect(P0A_TEXT_TEMPLATES.every((template) => registeredFonts.has(template.defaultFontId))).toBe(true);
|
||||
expect(P0A_TEXT_TEMPLATES.every((template) => fontOption(template.defaultFontId)?.url === template.fontUrl)).toBe(true);
|
||||
expect(P0A_TEXT_TEMPLATES.filter((template) => template.defaultFontId.startsWith("TEXT-FONT-"))).toHaveLength(332);
|
||||
expect(P0A_FONT_OPTIONS).toHaveLength(86);
|
||||
const available = P0A_TEXT_TEMPLATES[0]!;
|
||||
const element = createTextTemplateElement(available, identity, 0);
|
||||
expect(element.font_override).toBeUndefined();
|
||||
|
||||
Reference in New Issue
Block a user