Compare commits

...
Author SHA1 Message Date
autocraft-bot[bot] 802bb56cf2 Merge main (2d9790c3) into the pull request
The merge is resolved. Main had rebuilt both ribbon tabs on the shared n

The merge is resolved. Main had rebuilt both ribbon tabs on the shared number field, so `layout.rs` and `table.rs` take main's version, and the pull request's old `DragValue` settings are dropped. I added no replacement code: the pull request's regression test passes on main's fields, with a −1000 pt indent and a wide table column left unchanged and no undo step added. This means the pull request now adds only that test and its `docs/ui-parity.md` entry, not a code fix.

The test's own harness panicked under main's new UI runtime, so it now uses the existing `tab_harness` helper, with the same assertions. In `docs/ui-parity.md`, main's text and date are kept, and the pull request's entry is first in the change list.

Checks run for `wordcraft-ui-egui`:
- `cargo fmt --all --check` and clippy with `-D warnings` passed. Cargo also warned that the `egui_extras` dependency is unused.
- Library tests: 1124 passed and 1 failed. The failure is `previews::tests::symbol_thumbnails_read_in_the_strips_real_tiles` ("= is a speck"), which also failed when run alone. It tests equation symbol thumbnails, which this resolution does not touch. I did not run it on main, so I have not confirmed that it fails there too.
- Integration tests: all passed.
- `cargo xtask layers` and `cargo xtask wasm` were not run.
2026-12-04 08:50:20 +00:00
Dhruv aaf03cc166 Showing the Layout or Table Layout tab no longer clamps and applies a value outside a field's range (#3943) 2026-11-04 10:33:19 -06:00
2 changed files with 31 additions and 1 deletions
+30
View File
@@ -1593,3 +1593,33 @@ fn picture_and_shape_size_fields_show_unit_hints() {
assert!(h.query_by_label_contains(expected).is_some(), "{tab} W: hover tooltip shows unit hint");
}
}
/// #3943: showing a ribbon tab only shows its fields. A value outside a field's range (a −1000 pt
/// indent, a column wider than 22 mm) stays as it is: no edit, no undo step, until the person changes it.
#[test]
fn showing_a_ribbon_tab_leaves_values_outside_a_fields_range_alone() {
// Layout › Paragraph: a −1000 pt left indent (the field's range starts at −792 pt).
let mut a = crate::WordApp::new(Session::new(wordcraft_doc::Document::new()), crate::Services::default());
a.run("text.insert", json!({"text": "Indented"})).unwrap();
a.run("para.indents", json!({"left": -1000.0, "right": -900.0})).unwrap();
let (undo, rev) = (a.session.undo_depth(), a.session.rev());
let h = tab_harness(a, "Layout");
let para = h.state().session.doc.para_at(&h.state().session.sel.focus).map(|p| (p.props.indent_left, p.props.indent_right));
assert_eq!(para, Some((Some(-1000.0), Some(-900.0))), "the indents are as they were");
assert_eq!((h.state().session.undo_depth(), h.state().session.rev()), (undo, rev), "no edit, no undo step");
// Table Layout › Cell Size: a column wider than 22 mm, with millimetres as the unit.
let mut a = crate::WordApp::new(Session::new(wordcraft_doc::Document::new()), crate::Services::default());
a.run("file.options", json!({"units": "millimeters"})).unwrap();
a.run("insert.table", json!({"rows": 2, "cols": 2})).unwrap();
a.run("table.columnWidth", json!({"width": 100.0})).unwrap();
let widths = |a: &crate::WordApp| {
let story = a.session.sel.focus.story;
a.session.sel.focus.path.cell().and_then(|(tp, _, _)| a.session.doc.table(story, &tp).map(|t| t.grid.clone()))
};
let (before, undo, rev) = (widths(&a), a.session.undo_depth(), a.session.rev());
assert!(before.as_ref().is_some_and(|g| g.iter().any(|w| *w > 70.0)), "a column wider than 22 mm: {before:?}");
let h = tab_harness(a, "Table Layout");
assert_eq!(widths(h.state()), before, "the column keeps its width");
assert_eq!((h.state().session.undo_depth(), h.state().session.rev()), (undo, rev), "no edit, no undo step");
}
+1 -1
View File
File diff suppressed because one or more lines are too long