DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
Merge remote-tracking branch 'origin/main' into codex/radial-gradient-ellipse
moppeeer52e0aaa2d632
diff --cc ROADMAP.mdindex 6d2059781,c60a04107..3833077bb--- a/ROADMAP.md+++ b/ROADMAP.md@@@ -129,7 -128,13 +128,14 @@@ list) · [roadmap.md](docs/roadmap.md)Newest first.+- **2026-10-13** · Radial gradients stretch with the object's box, as InDesign draws them: by default an ellipse reaching the frame's sides (it was a circle reaching only the longer side), and a Gradient Swatch tool drag keeps the box's proportions; on screen and in PDF. No readiness percentage change.+ - **2026-10-12** · Text threads by hand: click a selected text frame's in or out port to load+ the text cursor, then click a frame to thread it, click empty space for a column-wide frame or+ drag one (it snaps like frame drawing); Shift-click autoflows, Alt-click stays loaded on the+ frame just added; click the linked frame or double-click a port to break the thread.+ `text.thread`, `text.unthread`, `text.removeFromThread` with undo; locked frames and layers+ refuse threads. The alpha gate now waits only on the Primary Text Frame page fixes (#165). No+ readiness percentage change.- **2026-10-12** · macOS Dock Quit uses the same unsaved-document prompts as window and menu Quit. Repeated requests keep the current answers; Cancel retains every tab and unsaved recovery checkpoint, and completed Save/Don't Save answers exit through the ordinary event loop. No readiness percentage change.- **2026-10-12** · Orderly native exit writes the latest recovery state after finalizing current quit approvals; incomplete or stale plans keep their documents, and Undo to the saved state clears stale recovery. Unavailable or failed recovery is reported. Cancelable macOS Dock Quit remains open (#544). No readiness percentage change.- **2026-10-12** · Recovered documents keep a checkpoint until saved, closed or reverted, including a second crash before autosave. Restarted document IDs and explicit recovery folders preserve other snapshots; failed republishing retains the original. No readiness percentage change.diff --cc crates/engine/src/cmd/style.rsindex 39025c2af,0280612d1..8ce7a3854--- a/crates/engine/src/cmd/style.rs+++ b/crates/engine/src/cmd/style.rs@@@ -1752,39 -1845,6 +1845,43 @@@ mod sample_color_tests}}+#[cfg(test)]+mod radial_gradient_tests {+ use serde_json::json;++ /// White at the side and the top of a 100×200 radial (black → white) rectangle at (50, 20) on+ /// a 200×240 page, rendered at 1 px/pt.+ fn sides(img: &designcraft_render::Rendered) -> (u8, u8, u8) {+ (img.pixel(100, 120)[0], img.pixel(52, 120)[0], img.pixel(100, 22)[0])+ }++ #[test]+ fn a_radial_gradient_is_the_objects_ellipse_on_screen_and_in_pdf() {+ let mut s = crate::Session::new();+ s.execute("file.new", &json!({"width": 200, "height": 240, "facingPages": false})).unwrap();+ let id = s.execute("frame.create", &json!({"rect": [50, 20, 150, 220], "content": "unassigned"})).unwrap()["id"].as_u64().unwrap();+ s.execute("object.stroke", &json!({"ids": [id], "swatch": "[None]"})).unwrap();+ s.execute(+ "object.gradient",+ &json!({"ids": [id], "kind": "radial", "stops": [{"location": 0, "color": "#000000"}, {"location": 100, "color": "#ffffff"}]}),+ )+ .unwrap();+ let d = s.doc().unwrap().doc.clone();+ let mut r = designcraft_render::Renderer::new();+ let (c, side, top) = sides(&r.render_page(&d, &s.cache, 0, 1.0, false, &Default::default()).unwrap());+ assert!(c < 30 && side > 220 && top > 220, "screen: centre {c}, side {side}, top {top}");+ // The PDF, placed back and drawn: the same ellipse.+ let pdf = designcraft_pdf::export_pdf(&d, &s.cache, &Default::default()).unwrap();+ let mut p = crate::Session::new();+ p.execute("file.new", &json!({"width": 200, "height": 240, "facingPages": false})).unwrap();+ p.execute("file.place", &json!({"base64": crate::cmd::file::base64_encode(&pdf), "name": "radial.pdf", "x": 0, "y": 0, "width": 200}))+ .unwrap();+ let d = p.doc().unwrap().doc.clone();+ let (c, side, top) = sides(&r.render_page(&d, &p.cache, 0, 1.0, false, &Default::default()).unwrap());+ assert!(c < 30 && side > 220 && top > 220, "pdf: centre {c}, side {side}, top {top}");+ }+}+++ #[cfg(test)]+ #[path = "text_color_tests.rs"]+ mod text_color_tests;