diff --git a/crates/canvas-pilot/tests/fixtures/figma-rectangles.README.md b/crates/canvas-pilot/tests/fixtures/figma-rectangles.README.md new file mode 100644 index 0000000..18fa09c --- /dev/null +++ b/crates/canvas-pilot/tests/fixtures/figma-rectangles.README.md @@ -0,0 +1,11 @@ +# Figma SVG clipboard sample + +Supplied by the user on 2026-11-15 as Figma clipboard text. The fixture removes +chat Markdown escaping before XML tags and restores the Markdown-linked namespace +to the literal `http://www.w3.org/2000/svg`. Geometry and element order are unchanged. +The Figma version, platform and exact copy command were not supplied. + +Expected result: two 640 × 360 rectangles, at (0, 0) and (1040, 0), in a +1680 × 360 SVG viewport. Neither rectangle is a background. This validates SVG +text through the paste parser, not Figma's native binary/HTML clipboard formats +or live operating-system clipboard delivery. diff --git a/crates/canvas-pilot/tests/fixtures/figma-rectangles.svg b/crates/canvas-pilot/tests/fixtures/figma-rectangles.svg new file mode 100644 index 0000000..4d3c582 --- /dev/null +++ b/crates/canvas-pilot/tests/fixtures/figma-rectangles.svg @@ -0,0 +1 @@ + diff --git a/crates/canvas-pilot/tests/import.rs b/crates/canvas-pilot/tests/import.rs index 31e72a9..25171e6 100644 --- a/crates/canvas-pilot/tests/import.rs +++ b/crates/canvas-pilot/tests/import.rs @@ -9,6 +9,28 @@ fn close(a: f64, b: f64) { assert!((a - b).abs() < 1e-7, "{a} != {b}"); } #[test] +fn supplied_figma_svg_clipboard_preserves_rectangle_order_and_translation() { + let doc = parse_values(include_str!("fixtures/figma-rectangles.svg")).unwrap(); + assert!(doc.svg); + assert_eq!(doc.shapes.len(), 2); + for (shape, x) in doc.shapes.iter().zip([0.0, 1040.0]) { + let expected = Geometry { + x, + y: 0.0, + width: 640.0, + height: 360.0, + }; + assert_eq!(shape.geometry, expected); + assert!(!shape.background); + assert!(!shape.background_only); + assert_eq!(shape.outline, [0.0, 0.0]); + assert_eq!( + shape.paste_geometry(expected, true, true).unwrap(), + expected + ); + } +} +#[test] fn svg_detects_rectangles_background_names_transforms_and_outlines() { let doc=parse_svg(&svg(r#""#)).unwrap(); assert_eq!(doc.shapes.len(), 3); diff --git a/docs/canvas-pilot/changelog.md b/docs/canvas-pilot/changelog.md index 10c4591..53b2e32 100644 --- a/docs/canvas-pilot/changelog.md +++ b/docs/canvas-pilot/changelog.md @@ -4,6 +4,11 @@ ## Unreleased +- Preserve the supplied Figma SVG clipboard sample as a regression fixture for + ordered rectangular paths and matrix translations through the paste parser. + Existing SVG parsing handles it; native Figma clipboard formats and live + clipboard delivery remain unverified. + - Add a sourced presentation-switcher adapter survey, ranked by public control documentation with separate geometry feasibility assessments, and a stretch goal to consider selected families. Research only; no new support is enabled. diff --git a/docs/canvas-pilot/guide/files.md b/docs/canvas-pilot/guide/files.md index 5597656..861f4e1 100644 --- a/docs/canvas-pilot/guide/files.md +++ b/docs/canvas-pilot/guide/files.md @@ -67,6 +67,15 @@ styles for predictable results. Files are limited to 16 MiB, 256 rectangles plus 64 levels of nesting. SVG imports retain the same outline and position-only choices as draw.io imports. +### Figma SVG clipboard text + +The supplied [Figma SVG sample](../../../crates/canvas-pilot/tests/fixtures/figma-rectangles.svg) +works through the existing SVG/value paste parser: two 640 × 360 rectangular +paths at (0, 0) and (1040, 0), including their matrix translations and order. +Paste SVG text and review the detected shapes in the mapping dialog. +This evidence covers the supplied SVG text only; native Figma binary/HTML +clipboard formats and live clipboard delivery have not been validated. + ### draw.io clipboard The draw.io adapter accepts single-page `.drawio`/`.xml` files (including native diff --git a/docs/canvas-pilot/plan.md b/docs/canvas-pilot/plan.md index 1193bc6..36278bd 100644 --- a/docs/canvas-pilot/plan.md +++ b/docs/canvas-pilot/plan.md @@ -73,7 +73,9 @@ device readback and physical-screen acceptance. and direct linked send/load are implemented; further changes await specifications. - [ ] **Additional native clipboard adapters.** Obtain actual software/version clipboard samples before implementing or claiming Inkscape, Illustrator, Figma, - etc. clipboard support. File import is not native clipboard compatibility. + etc. native clipboard support. The supplied Figma SVG-text sample is covered + by a paste-parser regression test; native clipboard formats and live delivery + remain unverified. File import is not native clipboard compatibility. - [ ] **Non-Centered/masked Midra layer import.** Expand conversion only after verifying those semantics. Source routing synchronization remains separate from the opt-in shared-input settings editor.