diff --git a/crates/automation/src/actions/file.rs b/crates/automation/src/actions/file.rs index 1591e6fdb..845fd82a0 100644 --- a/crates/automation/src/actions/file.rs +++ b/crates/automation/src/actions/file.rs @@ -9,7 +9,7 @@ use super::model::Action; /// /// A file PhotoCraft wrote with its folder occurrences (`set_rows`, and per action `set_slot`, /// `action_id`, `legacy_shortcut_owner`) loads too: those fields are read into -/// [`FileOccurrences`] and [`ActionList::merge_file`](super::ActionList::merge_file) turns them +/// `FileOccurrences` and [`ActionList::merge_file`](super::ActionList::merge_file) turns them /// into unique set and action names. Names are the list's only identity, so they are never /// written back. #[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)] diff --git a/crates/automation/src/ui/agents/mod.rs b/crates/automation/src/ui/agents/mod.rs index 8b3859f7b..01b5a9115 100644 --- a/crates/automation/src/ui/agents/mod.rs +++ b/crates/automation/src/ui/agents/mod.rs @@ -108,7 +108,7 @@ impl<'a> AgentsPage<'a> { let mut next = None; let mut field = Field::new(words.control_port.clone()).id_salt("port"); if mcp_flag { - field = field.help(Help::Text(words.port_hint.clone().into())); + field = field.help(Help::Text(words.port_hint.clone())); } field.show(ui, |ui, _| { let number = NumberField::new(words.control_port.clone(), Bind::given(Some(port as f64))) @@ -140,7 +140,7 @@ impl<'a> AgentsPage<'a> { .map(|choice| { let label: Label = match choice { WhenAppClosed::Launch => words.launch.fill(&[("app", app)]).into(), - WhenAppClosed::Headless => words.headless.clone().into(), + WhenAppClosed::Headless => words.headless.clone(), WhenAppClosed::Error => words.ask.fill(&[("app", app)]).into(), }; Entry::new(choice, label) diff --git a/crates/draw/src/ui/crop/session.rs b/crates/draw/src/ui/crop/session.rs index 46a934fb3..44b21444b 100644 --- a/crates/draw/src/ui/crop/session.rs +++ b/crates/draw/src/ui/crop/session.rs @@ -184,7 +184,7 @@ impl CropKept { /// drawn one. /// - Dismissal ([`dismiss`](Self::dismiss)): after Discard or an accepted crop the default frame /// is still made but stays hidden until the next press, ratio change or size change -/// ([`show`](Self::show)), for that document and size only. +/// ([`show_frame`](Self::show_frame)), for that document and size only. /// - [`CropTool`](super::CropTool) is the one writer: the session has no edit type of its own. #[derive(Clone, Debug, Default)] pub struct CropSession { @@ -464,7 +464,7 @@ impl CropSession { } /// Discard or an accepted crop: the session is cleared and the document's default frame stays - /// hidden until [`show`](Self::show). The next [`ensure_frame`](Self::ensure_frame) still makes + /// hidden until [`show_frame`](Self::show_frame). The next [`ensure_frame`](Self::ensure_frame) still makes /// the frame, so the hidden overlay has one to show. pub fn dismiss(&mut self) { let made_for = self.frame_for; diff --git a/crates/draw/src/ui/measure/overlay.rs b/crates/draw/src/ui/measure/overlay.rs index 3b56518c3..ae0921b3a 100644 --- a/crates/draw/src/ui/measure/overlay.rs +++ b/crates/draw/src/ui/measure/overlay.rs @@ -109,7 +109,7 @@ pub(super) fn ruler_cursor(precise: bool, protractor: bool) -> Cursor { /// Shift 10, Delete and Backspace clear the line. /// - It paints a cross at each point, in the line's look; the app shows the line and the arm with `StraightLinePreview` /// ([`RulerPass::show_line`](super::RulerPass::show_line)). -/// - [Read only](Self::read_only), it paints the crosses at rest and takes no press, key or focus: the ruler drawn +/// - [Read only](craft_ui::contract::Props::read_only), it paints the crosses at rest and takes no press, key or focus: the ruler drawn /// under the other tools ([`show_ruler`](super::show_ruler)). /// - **AccessKit:** the group's value reads "Length L, angle A°" in the ruler's units; each point is named and valued /// "x, y" in the ruler's units. diff --git a/crates/draw/tests/it/shape_cells.rs b/crates/draw/tests/it/shape_cells.rs index e7c78e604..21062f3aa 100644 --- a/crates/draw/tests/it/shape_cells.rs +++ b/crates/draw/tests/it/shape_cells.rs @@ -276,9 +276,7 @@ fn the_gear_enables_only_the_chosen_sizes_and_escape_keeps_the_pick() { #[trial] fn a_fixed_size_typed_past_its_range_keeps_the_end_and_reports_it_once_and_an_emptied_field_is_empty() { - let mut start = BoxConstraints::default(); - start.constraint = BoxConstraint::FixedSize; - start.fixed = (Some(100.0), Some(50.0)); + let start = BoxConstraints { constraint: BoxConstraint::FixedSize, fixed: (Some(100.0), Some(50.0)), ..Default::default() }; let (mut fixture, host) = gear(start); type_into(&mut fixture, "Fixed Size W", "400000"); assert_eq!(host.borrow().value.fixed, (Some(300_000.0), Some(50.0)), "a width past 300,000 keeps 300,000"); diff --git a/crates/draw/tests/it/shape_drag.rs b/crates/draw/tests/it/shape_drag.rs index 8fb8dc770..3eb3fd502 100644 --- a/crates/draw/tests/it/shape_drag.rs +++ b/crates/draw/tests/it/shape_drag.rs @@ -161,8 +161,7 @@ fn shift_squares_the_box_from_the_shorter_side() { /// A Rectangle drag under the gear `constraint` with `change` applied to the gear's values. fn gear(constraint: BoxConstraint, change: impl FnOnce(&mut BoxConstraints)) -> Shapes { - let mut constraints = BoxConstraints::default(); - constraints.constraint = constraint; + let mut constraints = BoxConstraints { constraint, ..Default::default() }; change(&mut constraints); Shapes::new(ShapeDragOptions::new(ShapeKind::Rectangle).constraints(constraints)) } diff --git a/crates/draw/tests/it/transform_box.rs b/crates/draw/tests/it/transform_box.rs index 5ec365983..4cdef9c7d 100644 --- a/crates/draw/tests/it/transform_box.rs +++ b/crates/draw/tests/it/transform_box.rs @@ -776,7 +776,7 @@ fn a_secondary_click_on_the_box_opens_the_mode_menu() { }); }); fixture.settle(); - let mut right_click = |fixture: &mut Fixture, at: Pos2| { + let right_click = |fixture: &mut Fixture, at: Pos2| { fixture.frame(vec![pointer::moved(at)]); fixture.frame(vec![pointer::secondary(at, true)]); fixture.frame(vec![pointer::secondary(at, false)]); diff --git a/crates/imaging/tests/it/select.rs b/crates/imaging/tests/it/select.rs index b3a0e3bc0..a27811572 100644 --- a/crates/imaging/tests/it/select.rs +++ b/crates/imaging/tests/it/select.rs @@ -914,6 +914,8 @@ fn the_magnetic_lasso_shows_the_width_circle_under_the_precise_cursor() { #[trial] fn width_steps_by_one_and_shift_jumps_to_the_limits() { let mut settings = MagneticSettings::default(); + settings.step_width(1, false); + assert_eq!(settings.width, 11.0, "a step adds one to the default width"); settings.width = 10.4; settings.step_width(1, false); assert_eq!(settings.width, 11.0, "a step adds one to the rounded width"); diff --git a/crates/imaging/tests/it/transform_preview.rs b/crates/imaging/tests/it/transform_preview.rs index dd41209ca..239c8aceb 100644 --- a/crates/imaging/tests/it/transform_preview.rs +++ b/crates/imaging/tests/it/transform_preview.rs @@ -380,17 +380,22 @@ fn closed_styled_previews_leave_their_composites_to_eviction() { // With nearest interpolation every zoom and scale gives level 0 with nearest filtering. +/// A preview with the scale it is painted at. +type PaintedPreview = (Rc, f32); +/// The texture and size a painted preview showed. +type ShownPreview = (egui::TextureId, [f32; 2]); + /// Previews painted every frame of a fixture whose host runs jobs only when a trial says (upstream's 5 × 3 white /// image). struct Mips { fixture: Fixture, jobs: Arc, /// The previews the next frames paint, each at its scale. - painted: Rc, f32)>>>, + painted: Rc>>, /// The display every painted preview is converted for. display: Rc>>, /// What each painted preview showed in the last frame. - shown: Rc>>>, + shown: Rc>>>, /// The previews' uploads in the last frame, read in the frame. uploads: Rc>, } diff --git a/crates/svg/src/tree.rs b/crates/svg/src/tree.rs index f2e1a7963..821088ce9 100644 --- a/crates/svg/src/tree.rs +++ b/crates/svg/src/tree.rs @@ -13,7 +13,7 @@ //! [`crate::guard::entities_expand_past`], [`crate::guard::too_wide`] (attributes an element), //! [`crate::guard::prescan`] (nesting in the text), //! [`height`] (nesting with references followed, as usvg walks them), then usvg. -//! [`image_resolver`] bounds the SVG documents embedded in `` data URLs the same way. +//! `image_resolver` (with the `tree` feature) bounds the SVG documents embedded in `` data URLs the same way. //! [`draw`] bounds what drawing a tree with resvg allocates. //! //! Stack: usvg uses about 15 kB of stack for each level of nesting (measured natively by @@ -66,9 +66,9 @@ pub struct Limits { /// Accept a document type declaration; `false` refuses any `` data URLs, unpacked, for - /// [`image_resolver`]. + /// `image_resolver`. pub embedded_bytes: usize, - /// SVG documents embedded inside one another, for [`image_resolver`]. + /// SVG documents embedded inside one another, for `image_resolver`. pub embedded_depth: usize, /// Decoded RGBA pixels retained across the raster images embedded in one drawing. Dimensions /// are probed before usvg hands the bytes to a decoder; repeated references to the same data @@ -137,7 +137,7 @@ pub fn text<'a>(bytes: &'a [u8], limits: &Limits) -> Result, Error> } /// The tree of an SVG or SVGZ file, within `limits`. `options` are usvg's: fonts, the default -/// size, and the image resolver ([`image_resolver`] unless the caller reads linked files). +/// size, and the image resolver (`image_resolver` unless the caller reads linked files). pub fn parse(bytes: &[u8], limits: &Limits, options: &usvg::Options<'_>) -> Result { parse_text(&svgz::text(bytes, limits.bytes)?, limits, options) } diff --git a/crates/svg/src/tree/primitive.rs b/crates/svg/src/tree/primitive.rs index a43933ec3..a7e9d722e 100644 --- a/crates/svg/src/tree/primitive.rs +++ b/crates/svg/src/tree/primitive.rs @@ -4,8 +4,8 @@ //! //! A path is a primitive when it is one closed contour whose points all lie on the outline of //! an axis-aligned (rounded) rectangle or ellipse and that encloses its area. The check works on -//! the segments as given, so use it on a [`Coordinates::Local`](super::document::Coordinates) -//! scene, where a rotated or skewed shape keeps its own axes. +//! the segments as given (a [`Path`](super::document::Path)'s are after its absolute transform), so +//! a rotated or skewed shape is not recognised. use super::document::Segment; diff --git a/crates/ui-patterns/tests/it/form_dialogs/hosted.rs b/crates/ui-patterns/tests/it/form_dialogs/hosted.rs index e69740ef1..91004c210 100644 --- a/crates/ui-patterns/tests/it/form_dialogs/hosted.rs +++ b/crates/ui-patterns/tests/it/form_dialogs/hosted.rs @@ -31,8 +31,12 @@ fn canvas_size() -> HostedCanvasSize { } #[allow(clippy::redundant_closure, reason = "the builder must be generic over the bind's lifetime, which the bare path is not")] +fn image_size_of(values: ImageSizeValues) -> HostedImageSize { + HostedImageSize::new(values, |values| ImageSize::new(values)) +} + fn image_size() -> HostedImageSize { - HostedImageSize::new(ImageSizeValues::new(PICTURE), |values| ImageSize::new(values)) + image_size_of(ImageSizeValues::new(PICTURE)) } /// The document of the guide dialogs: 3000 × 2000 px at 300 ppi, measured in pixels. @@ -437,7 +441,7 @@ fn image_size_alt_digits_pick_resample_without_typing_into_a_field() { fixture.settle(); // Resample off: the keys pick nothing and type nothing into the resolution field. - host.borrow_mut().open(HostedImageSize::new(ImageSizeValues::new(PICTURE).resampling(false), |values| ImageSize::new(values))); + host.borrow_mut().open(image_size_of(ImageSizeValues::new(PICTURE).resampling(false))); fixture.settle(); let resolution = fixture.by_label("Resolution").expect("the Resolution field"); fixture.click(&resolution).settle(); diff --git a/crates/ui-widgets/tests/it/text/access.rs b/crates/ui-widgets/tests/it/text/access.rs index 3601e80c4..0bb7683f3 100644 --- a/crates/ui-widgets/tests/it/text/access.rs +++ b/crates/ui-widgets/tests/it/text/access.rs @@ -44,10 +44,10 @@ fn a_number_field_that_keeps_its_name_is_described_by_its_caption() { let node = NodeKey::of(field.get()); let described: Vec> = tree.described_by(field.get()).into_iter().map(|key| tree.name_of(key)).collect(); if keeps { - assert_eq!(name(&tree, node), Some("Clone Source X Offset"), "the field keeps its own name"); + assert_eq!(name(tree, node), Some("Clone Source X Offset"), "the field keeps its own name"); assert!(described.contains(&Some("X")), "the caption describes the field: {described:?}"); } else { - assert_eq!(name(&tree, node), Some("X"), "the caption names the field"); + assert_eq!(name(tree, node), Some("X"), "the caption names the field"); } } } diff --git a/crates/ui-widgets/tests/it/text/number.rs b/crates/ui-widgets/tests/it/text/number.rs index c968b4fc1..5da40480f 100644 --- a/crates/ui-widgets/tests/it/text/number.rs +++ b/crates/ui-widgets/tests/it/text/number.rs @@ -459,8 +459,11 @@ fn a_draft_that_is_no_number_owes_no_range_alert() { use craft_ui::text::RangeAlert; use std::rc::Rc; + /// A step run after the typing: it gets the fixture and a way to type text. + type Step<'a> = &'a dyn Fn(&mut Fixture, &dyn Fn(&mut Fixture, &str)); + /// Types "150" over the field without leaving it, then runs `then`; returns the alerts and the value after. - fn after_150(then: &dyn Fn(&mut Fixture, &dyn Fn(&mut Fixture, &str))) -> (usize, Option) { + fn after_150(then: Step<'_>) -> (usize, Option) { let value = Rc::new(Cell::new(Some(50.0))); let alerts: Rc>> = Rc::default(); let (held, seen) = (value.clone(), alerts.clone()); @@ -488,7 +491,7 @@ fn a_draft_that_is_no_number_owes_no_range_alert() { let tab = |fixture: &mut Fixture| { fixture.key(Key::Tab, Modifiers::NONE); }; - let cases: [(&str, &dyn Fn(&mut Fixture, &dyn Fn(&mut Fixture, &str)), usize); 4] = [ + let cases: [(&str, Step<'_>, usize); 4] = [ ( "text typed over it, then Tab", &|fixture: &mut Fixture, type_over: &dyn Fn(&mut Fixture, &str)| {