diff --git a/tests/engine/io/fig/import/pattern-paint-oracle.test.ts b/tests/engine/io/fig/import/pattern-paint-oracle.test.ts index e0bae30bd..1bef8532c 100644 --- a/tests/engine/io/fig/import/pattern-paint-oracle.test.ts +++ b/tests/engine/io/fig/import/pattern-paint-oracle.test.ts @@ -31,6 +31,12 @@ interface PaintOracle { source: { id: string; visible: boolean } target: { fills: PatternOracleFill[] } } + patternAlignment: { + frame: { id: string } + source: { id: string; visible: boolean } + targets: Array<{ alignment: string; fills: PatternOracleFill[] }> + metrics: { rmseNormalized: number; fuzzDifferentPixels: number } + } effects: { noise: { results: Record } textureAndGlass: { results: Record } @@ -62,6 +68,23 @@ describe('Figma pattern/noise/custom paint oracle availability', () => { expect(patternFill?.verticalAlignment).toBe('CENTER') }) + test('records Figma pattern alignment payloads and current visual metrics', () => { + const alignment = readOracle().patternAlignment + + expect(alignment.source.visible).toBe(true) + expect(alignment.targets.map((target) => target.alignment)).toEqual(['START', 'CENTER', 'END']) + for (const target of alignment.targets) { + const fill = target.fills[0] + expect(fill?.type).toBe('PATTERN') + expect(fill?.sourceNodeId).toBe(alignment.source.id) + expect(fill?.horizontalAlignment).toBe(target.alignment) + expect(fill?.verticalAlignment).toBe(target.alignment) + expect(fill?.spacing.y).toBeCloseTo(0.4) + } + expect(alignment.metrics.rmseNormalized).toBeCloseTo(0.246422) + expect(alignment.metrics.fuzzDifferentPixels).toBe(22209) + }) + test('records that noise and custom paint payloads are still blocked on Figma-authored samples', () => { const oracle = readOracle() expect(oracle.pluginRuntimeCreation.PATTERN_DIRECT_FILLS_ASSIGNMENT?.ok).toBe(false) diff --git a/tests/fixtures/figma-oracles/pattern-noise-custom-paints.json b/tests/fixtures/figma-oracles/pattern-noise-custom-paints.json index 5118b8b0d..617a474de 100644 --- a/tests/fixtures/figma-oracles/pattern-noise-custom-paints.json +++ b/tests/fixtures/figma-oracles/pattern-noise-custom-paints.json @@ -27,7 +27,10 @@ "sourceNodeId": "296784:2259", "tileType": "RECTANGULAR", "scalingFactor": 1, - "spacing": { "x": 0.25, "y": 0.4000000059604645 }, + "spacing": { + "x": 0.25, + "y": 0.4000000059604645 + }, "horizontalAlignment": "CENTER", "verticalAlignment": "CENTER" } @@ -47,9 +50,17 @@ "visible": true, "boundVariables": {}, "noiseSize": 0.5, - "noiseSizeVector": { "x": 0.5, "y": 0.5 }, + "noiseSizeVector": { + "x": 0.5, + "y": 0.5 + }, "noiseType": "MONOTONE", - "color": { "r": 0, "g": 0, "b": 0, "a": 1 }, + "color": { + "r": 0, + "g": 0, + "b": 0, + "a": 1 + }, "density": 0.4000000059604645 } ] @@ -62,10 +73,23 @@ "visible": true, "boundVariables": {}, "noiseSize": 0.5, - "noiseSizeVector": { "x": 0.5, "y": 0.5 }, + "noiseSizeVector": { + "x": 0.5, + "y": 0.5 + }, "noiseType": "DUOTONE", - "color": { "r": 0, "g": 0, "b": 0, "a": 1 }, - "secondaryColor": { "r": 1, "g": 1, "b": 1, "a": 1 }, + "color": { + "r": 0, + "g": 0, + "b": 0, + "a": 1 + }, + "secondaryColor": { + "r": 1, + "g": 1, + "b": 1, + "a": 1 + }, "density": 0.4000000059604645 } ] @@ -78,9 +102,17 @@ "visible": true, "boundVariables": {}, "noiseSize": 0.5, - "noiseSizeVector": { "x": 0.5, "y": 0.5 }, + "noiseSizeVector": { + "x": 0.5, + "y": 0.5 + }, "noiseType": "MULTITONE", - "color": { "r": 0, "g": 0, "b": 0, "a": 1 }, + "color": { + "r": 0, + "g": 0, + "b": 0, + "a": 1 + }, "opacity": 0.699999988079071, "density": 0.4000000059604645 } @@ -100,7 +132,10 @@ "radius": 8, "boundVariables": {}, "noiseSize": 0.5, - "noiseSizeVector": { "x": 0.5, "y": 0.5 }, + "noiseSizeVector": { + "x": 0.5, + "y": 0.5 + }, "clipToShape": true } ] @@ -163,5 +198,95 @@ "GRADIENT_LINEAR": 9 } }, - "status": "A real PATTERN payload is captured through Figma's async paint API with source and target in the same copied subtree. Real NOISE and CUSTOM paint payloads are still unavailable as Paint payloads in the connected Figma file and committed .fig fixtures. Figma Plugin API does expose NOISE, TEXTURE, and GLASS Effect payloads, recorded here for follow-up effect fidelity work." + "status": "A real PATTERN payload is captured through Figma's async paint API with source and target in the same copied subtree. Real NOISE and CUSTOM paint payloads are still unavailable as Paint payloads in the connected Figma file and committed .fig fixtures. Figma Plugin API does expose NOISE, TEXTURE, and GLASS Effect payloads, recorded here for follow-up effect fidelity work.", + "patternAlignment": { + "page": "OpenPencil pattern alignment oracle 2026-05-27", + "frame": { + "id": "297316:2267", + "name": "Pattern alignment frame" + }, + "source": { + "id": "297316:2268", + "name": "Pattern alignment source dot", + "visible": true + }, + "targets": [ + { + "id": "297316:2269", + "name": "Pattern START alignment target", + "alignment": "START", + "fills": [ + { + "type": "PATTERN", + "visible": true, + "opacity": 1, + "blendMode": "NORMAL", + "sourceNodeId": "297316:2268", + "tileType": "RECTANGULAR", + "scalingFactor": 1, + "spacing": { + "x": 0.25, + "y": 0.4000000059604645 + }, + "horizontalAlignment": "START", + "verticalAlignment": "START" + } + ] + }, + { + "id": "297316:2270", + "name": "Pattern CENTER alignment target", + "alignment": "CENTER", + "fills": [ + { + "type": "PATTERN", + "visible": true, + "opacity": 1, + "blendMode": "NORMAL", + "sourceNodeId": "297316:2268", + "tileType": "RECTANGULAR", + "scalingFactor": 1, + "spacing": { + "x": 0.25, + "y": 0.4000000059604645 + }, + "horizontalAlignment": "CENTER", + "verticalAlignment": "CENTER" + } + ] + }, + { + "id": "297316:2271", + "name": "Pattern END alignment target", + "alignment": "END", + "fills": [ + { + "type": "PATTERN", + "visible": true, + "opacity": 1, + "blendMode": "NORMAL", + "sourceNodeId": "297316:2268", + "tileType": "RECTANGULAR", + "scalingFactor": 1, + "spacing": { + "x": 0.25, + "y": 0.4000000059604645 + }, + "horizontalAlignment": "END", + "verticalAlignment": "END" + } + ] + } + ], + "metrics": { + "output": "/tmp/open-pencil-oracles/pattern-alignment-frame", + "differentPixels": 23179, + "differentPercent": 31.84, + "fuzz": "2%", + "fuzzDifferentPixels": 22209, + "fuzzDifferentPercent": 30.51, + "rmseNormalized": 0.246422 + }, + "note": "Captures START/CENTER/END pattern alignment in one frame with a visible source node. START matches current OpenPencil row origin closely; CENTER and END show remaining Figma origin differences." + } }