DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
Test and ROADMAP: an object wraps the frame its anchor lands in
moppeeer56cef8aeeeb1
diff --git a/ROADMAP.md b/ROADMAP.mdindex 8f8523f0b..4b7faf5eb 100644--- a/ROADMAP.md+++ b/ROADMAP.md@@ -347,6 +347,7 @@ list) · [roadmap.md](docs/roadmap.md) (milestones, plan) · [parity-checklist.mNewest first.+- **2026-10-15** · Anchored objects wrap their own story as their anchor lines are set, as in InDesign: the layout no longer depends on where an earlier composition put them (a long story whose pictures moved between frames from pass to pass never settled). No readiness percentage change.- **2026-10-12** · Anchored objects with text wrap push text aside: other stories' text under them and the lines of their own story after the anchor's line (#557). No readiness percentage change.- **2026-10-14** · The Type tool draws a new text frame over a locked empty frame, as InDesign does, instead of turning the locked frame into a text frame. No readiness percentage change.- **2026-10-14** · 100% black shows as pure black on screen by default, as InDesign's Appearance of Black does out of the box (Display All Blacks as Rich Black); Preferences › Appearance of Black › Display All Blacks Accurately still shows it as the dark grey it prints, and a saved choice is kept. No readiness percentage change.diff --git a/crates/compose/src/tests.rs b/crates/compose/src/tests.rsindex 1f01498f9..2dc339697 100644--- a/crates/compose/src/tests.rs+++ b/crates/compose/src/tests.rs@@ -4569,3 +4569,40 @@ fn anchored_wrap_that_moves_its_own_anchor_terminates() {assert!(cs.line_count() > 0);assert_eq!(cs.frames[0].objects.len(), 1);}++/// An object's wrap pushes the text so that a later object's anchor goes on into the next frame+/// (Learn Skills Daily's long-document exercise: pictures anchored in headings through a 79-page+/// story). Each object is placed when its anchor line is set and wraps only the lines after it,+/// in the frame its anchor lands in: the layout doesn't depend on where an earlier composition put+/// the objects, and composing again gives the same lines.+#[test]+fn an_object_wraps_the_frame_its_anchor_lands_in_after_an_earlier_object_pushed_it_on() {+ let text = [LOREM; 6].join(" ");+ let mut d = Document::new(&NewDocument::default());+ let lid = d.default_layer();+ let (a, sid) = d.add_text_frame(SpreadRef::Doc(0), Rect::new(0.0, 0.0, 300.0, 300.0), lid, &text, ParaFormat::default()).unwrap();+ let (b, _) = d.add_text_frame(SpreadRef::Doc(0), Rect::new(320.0, 0.0, 620.0, 300.0), lid, "", ParaFormat::default()).unwrap();+ d.thread(a, b).unwrap();+ let plain = compose_story(&d, sid, &ComposeOptions::default());+ // The second object's anchor sits near the end of the first frame without wrap.+ let late = plain.frames[0].lines.iter().rev().nth(2).unwrap().range.start + 2;+ anchor_box(&mut d, sid, late, 0.0, 0.0, true, WrapMode::BoundingBox);+ // The first, early in the first frame: 60 pt over its whole width pushes the later anchor on.+ let early = plain.frames[0].lines[1].range.start + 2;+ anchor_box(&mut d, sid, early, 0.0, 0.0, true, WrapMode::JumpObject);+ let cs = compose_story(&d, sid, &ComposeOptions::default());+ let late = late + OBJECT_LEN;+ let anchor_frame = cs.frames.iter().position(|f| f.range.contains(&late) || f.range.end == late).unwrap();+ assert_eq!(anchor_frame, 1, "the later anchor went on into the second frame");+ // The first frame's lines under the first object's band keep the full measure (the second+ // object is in the other frame); in the second frame, the lines under its object move right.+ let left = cs.frames[0].lines[0].x0;+ assert!(cs.frames[0].lines.iter().all(|l| (l.x0 - left).abs() < 1e-6));+ let f1 = &cs.frames[1];+ let (li, line) = f1.lines.iter().enumerate().find(|(_, l)| l.range.contains(&late)).unwrap();+ let under: Vec<_> = f1.lines[li + 1..].iter().filter(|l| l.baseline - l.ascent < line.baseline + 60.0).collect();+ assert!(!under.is_empty() && under.iter().all(|l| l.x0 >= f1.lines[0].x0 + 100.0 - 1e-6));+ assert_eq!(f1.objects.len(), 1);+ // Deterministic: the same lines again.+ assert_eq!(line_layout(&compose_story(&d, sid, &ComposeOptions::default())), line_layout(&cs));+}