Skip to content

AI-native design editor. Open-source Figma alternative.

test(kiwi): record Figma noise effect payloads

Danila Poyarkov5c6808e2196c
diff --git a/packages/docs/development/roadmap.md b/packages/docs/development/roadmap.md
index 12b5bb028..a443b82b2 100644
--- a/packages/docs/development/roadmap.md
+++ b/packages/docs/development/roadmap.md
@@ -129,7 +129,7 @@ Figma's design documentation groups features into these areas:
| Solid fills | ✅ | ✅ | ✅ | ✅ | ✅ | Color variables supported for common fill cases. |
| Gradients | ✅ | ✅ | ✅ | ✅ | ✅ | Linear/radial/angular/diamond support; Figma edge cases may differ. |
| Image fills | ✅ | ✅ | ◐ | ✅ | ✅ | Fill/fit/crop/tile support exists; imported crop/tile affine transforms are applied, but exact Figma parity is still partial. |
-| Pattern / noise / custom fills | ✅ | ◐ | — | ✅ | — | Schema metadata imports/exports; Figma pattern fills with a referenced source node render as repeated source tiles with scale, spacing, alignment, and basic hex offsets. Noise/custom paints still render with a solid fallback pending real payload samples. |
+| Pattern / noise / custom fills | ✅ | ◐ | — | ✅ | — | Schema metadata imports/exports; Figma pattern fills with a referenced source node render as repeated source tiles with scale, spacing, alignment, and basic hex offsets. Noise/custom paints still render with a solid fallback pending real paint payload samples; Figma-authored noise/texture/glass effect payloads are captured separately. |
| Video/GIF/media fills | ↩ | — | — | ↩ | — | Kiwi schema includes media paint/export enums, but OpenPencil has no video/GIF playback or media layer support. |
| Layer/fill/effect blend modes | ✅ | ◐ | — | ✅ | ✅ | Canvas applies node, fill, and common shadow effect blend modes; Figma isolation edge cases remain partial. |
| Opacity | ✅ | ✅ | ✅ | ✅ | ✅ | Node opacity uses save layers in the renderer. |
@@ -205,7 +205,7 @@ These are parsed or visible in Figma docs and most likely to cause visible diffe
1. **Masks** — tune remaining exact Figma stack semantics beyond common alpha/vector/luminance and consecutive-mask paths. `tests/fixtures/figma-oracles/masks.json` records live Figma API values for alpha, vector, and luminance masks.
2. **Corner smoothing** — expand Figma fixture comparisons and tune remaining stroke/effect edge cases.
-3. **Pattern/noise/custom fills** — tune first-class pattern rendering for nested/effectful pattern sources and exact Figma hex spacing. `tests/fixtures/figma-oracles/pattern-noise-custom-paints.json` captures a real async Figma `PATTERN` payload; real `NOISE` / `CUSTOM` payloads remain blocked on Figma-authored samples.
+3. **Pattern/noise/custom fills** — tune first-class pattern rendering for nested/effectful pattern sources and exact Figma hex spacing. `tests/fixtures/figma-oracles/pattern-noise-custom-paints.json` captures a real async Figma `PATTERN` payload and Figma-authored noise/texture/glass effect payloads; real `NOISE` / `CUSTOM` paint payloads remain blocked on Figma-authored samples.
4. **Variable-font and rich text fixtures** — broaden real-file coverage for variable axes, derived text data, leading trim, decoration style, underline offset/skip-ink, semantic font metadata, and raw OpenType feature metadata; `tests/fixtures/figma-oracles/rich-text-decoration.json` captures the first live Figma rich-text oracle.
5. **Boolean operation editing** — improve inspector/tooling workflows for imported boolean-operation nodes.
6. **Layout grids and guides** — render/edit page guides and Figma layout grids, or clearly keep them round-trip-only.
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 7ecc7bea3..e0bae30bd 100644
--- a/tests/engine/io/fig/import/pattern-paint-oracle.test.ts
+++ b/tests/engine/io/fig/import/pattern-paint-oracle.test.ts
@@ -12,12 +12,29 @@ interface PatternOracleFill {
verticalAlignment: string
}
+interface EffectOracleResult {
+ ok: boolean
+ effects: Array<{
+ type: string
+ noiseType?: string
+ noiseSize?: number
+ noiseSizeVector?: Vector
+ density?: number
+ opacity?: number
+ secondaryColor?: unknown
+ }>
+}
+
interface PaintOracle {
pattern: {
frame: { id: string }
source: { id: string; visible: boolean }
target: { fills: PatternOracleFill[] }
}
+ effects: {
+ noise: { results: Record<string, EffectOracleResult> }
+ textureAndGlass: { results: Record<string, EffectOracleResult> }
+ }
pluginRuntimeCreation: Record<string, { ok: boolean; message: string }>
currentFileFillTypes: Record<string, number>
localFigFixtureFillTypes: Record<string, Record<string, number>>
@@ -32,11 +49,12 @@ function readOracle(): PaintOracle {
describe('Figma pattern/noise/custom paint oracle availability', () => {
test('records the live Figma pattern paint payload', () => {
- const patternFill = readOracle().pattern.target.fills[0]
+ const oracle = readOracle()
+ const patternFill = oracle.pattern.target.fills[0]
- expect(readOracle().pattern.source.visible).toBe(true)
+ expect(oracle.pattern.source.visible).toBe(true)
expect(patternFill?.type).toBe('PATTERN')
- expect(patternFill?.sourceNodeId).toBe(readOracle().pattern.source.id)
+ expect(patternFill?.sourceNodeId).toBe(oracle.pattern.source.id)
expect(patternFill?.tileType).toBe('RECTANGULAR')
expect(patternFill?.spacing.x).toBe(0.25)
expect(patternFill?.spacing.y).toBeCloseTo(0.4)
@@ -44,7 +62,7 @@ describe('Figma pattern/noise/custom paint oracle availability', () => {
expect(patternFill?.verticalAlignment).toBe('CENTER')
})
- test('records that noise and custom payloads are still blocked on Figma-authored samples', () => {
+ 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)
@@ -55,6 +73,35 @@ describe('Figma pattern/noise/custom paint oracle availability', () => {
expect(counts[type]).toBeUndefined()
}
}
- expect(oracle.status).toContain('NOISE and CUSTOM')
+ expect(oracle.status).toContain('NOISE and CUSTOM paint payloads')
+ })
+
+ test('records Figma-authored noise effect payloads for follow-up effect fidelity work', () => {
+ const { results } = readOracle().effects.noise
+
+ expect(results.MONOTONE?.ok).toBe(true)
+ expect(results.DUOTONE?.ok).toBe(true)
+ expect(results.MULTITONE?.ok).toBe(true)
+
+ const monotone = results.MONOTONE?.effects[0]
+ const duotone = results.DUOTONE?.effects[0]
+ const multitone = results.MULTITONE?.effects[0]
+
+ expect(monotone?.type).toBe('NOISE')
+ expect(monotone?.noiseType).toBe('MONOTONE')
+ expect(monotone?.noiseSizeVector).toEqual({ x: 0.5, y: 0.5 })
+ expect(monotone?.density).toBeCloseTo(0.4)
+ expect(duotone?.secondaryColor).toEqual({ r: 1, g: 1, b: 1, a: 1 })
+ expect(multitone?.opacity).toBeCloseTo(0.7)
+ })
+
+ test('records texture and glass effect payloads separately from unavailable custom paints', () => {
+ const { results } = readOracle().effects.textureAndGlass
+
+ expect(results.TEXTURE?.ok).toBe(true)
+ expect(results.TEXTURE?.effects[0]?.type).toBe('TEXTURE')
+ expect(results.TEXTURE?.effects[0]?.noiseSizeVector).toEqual({ x: 0.5, y: 0.5 })
+ expect(results.GLASS?.ok).toBe(true)
+ expect(results.GLASS?.effects[0]?.type).toBe('GLASS')
})
})
diff --git a/tests/fixtures/figma-oracles/pattern-noise-custom-paints.json b/tests/fixtures/figma-oracles/pattern-noise-custom-paints.json
index 543856780..5118b8b0d 100644
--- a/tests/fixtures/figma-oracles/pattern-noise-custom-paints.json
+++ b/tests/fixtures/figma-oracles/pattern-noise-custom-paints.json
@@ -35,6 +35,95 @@
},
"note": "Captured with setFillsAsync; the frame includes a visible source node so clipboard import has the referenced pattern source. Direct node.fills assignment rejects PATTERN."
},
+ "effects": {
+ "noise": {
+ "nodeId": "297107:2262",
+ "results": {
+ "MONOTONE": {
+ "ok": true,
+ "effects": [
+ {
+ "type": "NOISE",
+ "visible": true,
+ "boundVariables": {},
+ "noiseSize": 0.5,
+ "noiseSizeVector": { "x": 0.5, "y": 0.5 },
+ "noiseType": "MONOTONE",
+ "color": { "r": 0, "g": 0, "b": 0, "a": 1 },
+ "density": 0.4000000059604645
+ }
+ ]
+ },
+ "DUOTONE": {
+ "ok": true,
+ "effects": [
+ {
+ "type": "NOISE",
+ "visible": true,
+ "boundVariables": {},
+ "noiseSize": 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 },
+ "density": 0.4000000059604645
+ }
+ ]
+ },
+ "MULTITONE": {
+ "ok": true,
+ "effects": [
+ {
+ "type": "NOISE",
+ "visible": true,
+ "boundVariables": {},
+ "noiseSize": 0.5,
+ "noiseSizeVector": { "x": 0.5, "y": 0.5 },
+ "noiseType": "MULTITONE",
+ "color": { "r": 0, "g": 0, "b": 0, "a": 1 },
+ "opacity": 0.699999988079071,
+ "density": 0.4000000059604645
+ }
+ ]
+ }
+ }
+ },
+ "textureAndGlass": {
+ "nodeId": "297110:2263",
+ "results": {
+ "TEXTURE": {
+ "ok": true,
+ "effects": [
+ {
+ "type": "TEXTURE",
+ "visible": true,
+ "radius": 8,
+ "boundVariables": {},
+ "noiseSize": 0.5,
+ "noiseSizeVector": { "x": 0.5, "y": 0.5 },
+ "clipToShape": true
+ }
+ ]
+ },
+ "GLASS": {
+ "ok": true,
+ "effects": [
+ {
+ "type": "GLASS",
+ "visible": true,
+ "radius": 8,
+ "boundVariables": {},
+ "refraction": 0.30000001192092896,
+ "depth": 2,
+ "lightAngle": 45,
+ "lightIntensity": 0.5,
+ "dispersion": 0.20000000298023224
+ }
+ ]
+ }
+ }
+ }
+ },
"pluginRuntimeCreation": {
"PATTERN_DIRECT_FILLS_ASSIGNMENT": {
"ok": false,
@@ -74,5 +163,5 @@
"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 in the connected Figma file and committed .fig fixtures, so first-class rendering for those remains blocked on Figma-authored samples."
+ "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."
}