From 827a1922a4fa964d77b5c127b12685dcf4a2c560 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Gregorio=20Rinc=C3=B3n?= Date: Fri, 27 Nov 2026 18:01:28 -0500 Subject: [PATCH] test(ui): the figure's reference step refusal test reads the slot the step has (#3162) --- crates/ui-egui/src/publicationwizard/mod.rs | 5 +++-- crates/ui-egui/src/publicationwizard/sources.rs | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/crates/ui-egui/src/publicationwizard/mod.rs b/crates/ui-egui/src/publicationwizard/mod.rs index a2a13bc740..3250ee5f82 100644 --- a/crates/ui-egui/src/publicationwizard/mod.rs +++ b/crates/ui-egui/src/publicationwizard/mod.rs @@ -44,7 +44,8 @@ pub enum Step { impl Step { /// Where [`Draft`] keeps what each of the two steps with text fields has of its own: the - /// texts step's at 0, the sources step's at 1. + /// texts step's at 0, the sources step's at 1. A figure's reference step has none: it reads as + /// 0, so [`limit_note`] leaves the refusal out there. fn slot(self) -> usize { usize::from(self == Step::Sources) } @@ -322,7 +323,7 @@ fn statistic_menu(ui: &mut egui::Ui, d: &mut Draft, map: &Map, own: Field) { /// done unseen. fn limit_note(ui: &mut egui::Ui, d: &mut Draft, fields: &[Field]) { let limit = [("limit", &*MAX_PUBLICATION_TEXT.to_string())]; - // A figure's step adds no statistic: a refusal on the sheet's sources step isn't its own. + // A figure's step adds no statistic, so no step's refusal is its own. let note = if d.step != Step::Reference && d.refused[d.step.slot()] { i18n::fmt("The statistic wasn't added: each field takes at most {limit} characters.", &limit) } else if fields.iter().any(|&f| !d.off(f) && d.field_mut(f).chars().count() >= MAX_PUBLICATION_TEXT) { diff --git a/crates/ui-egui/src/publicationwizard/sources.rs b/crates/ui-egui/src/publicationwizard/sources.rs index 53581ba00d..a5849955bf 100644 --- a/crates/ui-egui/src/publicationwizard/sources.rs +++ b/crates/ui-egui/src/publicationwizard/sources.rs @@ -200,13 +200,13 @@ mod tests { assert!(h.get_by_role_and_label(Role::MultilineTextInput, "Reference").accesskit_node().is_disabled()); } - /// The figure's step says the command's limits, and not a statistic refused on the sheet's - /// sources step. + /// The figure's step says the command's limits, and not a statistic refused on a sheet's + /// step. #[test] fn a_figures_step_says_its_limits_only() { let mut h = at(Step::Reference, |d| { d.size = "figure-1col".into(); - d.refused = [false, true]; + d.refused = [true, true]; }); assert!(h.query_by_label(&refusal()).is_none()); assert!(h.query_by_label("At most 50 lines.").is_none());