diff --git a/crates/ui-egui/src/dialogs/effect.rs b/crates/ui-egui/src/dialogs/effect.rs index 057eac94eb..eb01163db0 100644 --- a/crates/ui-egui/src/dialogs/effect.rs +++ b/crates/ui-egui/src/dialogs/effect.rs @@ -757,17 +757,17 @@ mod tests { assert_eq!((pa["detail"].as_f64(), pb["detail"].as_f64()), (Some(3.0), Some(8.0)), "each keeps its untouched value"); } - /// Zig Zag's Ridges per segment and Roughen's Detail are counts: their rows show no percent sign, while Size - /// with Relative, a share of the object's size, shows one. + /// Zig Zag's Ridges per segment is a plain count and Roughen's Detail a count per inch: neither row shows a + /// percent sign, while Size with Relative, a share of the object's size, shows one. #[test] - fn zig_zag_ridges_and_roughen_detail_show_no_percent_sign() { + fn zig_zag_ridges_and_roughen_detail_show_their_count_units() { use craft::ui::runtime::env::UnitKind; let app = app(); - for (effect, key) in [("distort.zigZag", "ridges"), ("distort.roughen", "detail")] { + for (effect, key, expected) in [("distort.zigZag", "ridges", None), ("distort.roughen", "detail", Some(UnitKind::PerInch))] { let cx = EffectCx::new(&app, effect, false); let rows = super::super::effect_rows::distort(&cx, &DialogFields::new()); let unit = |k: &str| rows.iter().find(|p| p.key == k).map(|p| p.unit); - assert_eq!(unit(key), Some(None), "{effect} {key}"); + assert_eq!(unit(key), Some(expected), "{effect} {key}"); assert_eq!(unit("size"), Some(Some(UnitKind::Percent)), "{effect} size"); } } diff --git a/crates/ui-egui/src/dialogs/effect_rows.rs b/crates/ui-egui/src/dialogs/effect_rows.rs index 9ba4858116..023c67cba5 100644 --- a/crates/ui-egui/src/dialogs/effect_rows.rs +++ b/crates/ui-egui/src/dialogs/effect_rows.rs @@ -88,8 +88,11 @@ pub(super) fn transform(cx: &EffectCx, _fields: &DialogFields) -> Vec { /// Zig Zag and Roughen. pub(super) fn distort(cx: &EffectCx, fields: &DialogFields) -> Vec { let roughen = cx.id == "distort.roughen"; - // PLAN: production suffixes Detail with "/in"; `Param::unit` takes a `UnitKind` and none stands for it - let second = if roughen { count_range("detail", lbl!("Detail:"), 10.0) } else { count_range("ridges", lbl!("Ridges per segment:"), 4.0) }; + let second = if roughen { + count_range("detail", lbl!("Detail:"), 10.0).unit(UnitKind::PerInch) + } else { + count_range("ridges", lbl!("Ridges per segment:"), 4.0) + }; let points: Vec<(String, Label)> = choices(&cx.id, "points") .unwrap_or_default() .iter()