From 890c87460d1574d38fcd5e1699a752dba0935511 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Gregorio=20Rinc=C3=B3n?= Date: Fri, 27 Nov 2026 20:05:29 -0500 Subject: [PATCH 1/3] fix(ui): say on the wizard's review that a switched-off credit line isn't used --- .../ui-egui/src/publicationwizard/review.rs | 48 +++++++++++++++---- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/crates/ui-egui/src/publicationwizard/review.rs b/crates/ui-egui/src/publicationwizard/review.rs index c8f77db0b8..560d46dff6 100644 --- a/crates/ui-egui/src/publicationwizard/review.rs +++ b/crates/ui-egui/src/publicationwizard/review.rs @@ -39,14 +39,7 @@ pub(super) fn review_step(ui: &mut egui::Ui, s: &Session, d: &Draft) { row(tl!("Reference"), reference_value(d)); heading_row(&mut row, d, 1, tl!("Reference heading"), PUBLICATION_HEADINGS[1]); heading_row(&mut row, d, 2, tl!("Column heading"), none); - let credit = if d.no_author { - none.to_string() - } else if d.author.trim().is_empty() { - default_credit() - } else { - d.author.trim().to_string() - }; - row(tl!("Credit line"), credit); + row(tl!("Credit line"), credit_value(d)); let accent = d.accent.map(hex).unwrap_or_else(|| tl!("The style's own").to_string()); row(tl!("Accent"), accent); }); @@ -75,6 +68,18 @@ fn reference_value(d: &Draft) -> String { } } +/// The credit line as it will be drawn: the one typed, or the command's default; switched off, +/// none, but one typed then is said not to be used. +fn credit_value(d: &Draft) -> String { + let typed = d.author.trim(); + match d.off(Field::Author) { + true if typed.is_empty() => tl!("(none)").to_string(), + true => tl!("(none; the line typed isn't used)").to_string(), + false if typed.is_empty() => default_credit(), + false => typed.to_string(), + } +} + /// A heading's row: the one typed, or `or` for the command's; for a section left out, none, but /// one typed there is said not to be used rather than dropped unseen. fn heading_row(row: &mut impl FnMut(&str, String), d: &Draft, at: usize, label: &str, or: &str) { @@ -110,4 +115,31 @@ mod tests { h.run_steps(2); assert!(h.query_by_label_contains("its caption").is_some(), "a figure's texts aren't drawn"); } + + /// A credit line typed and then switched off is said not to be used, as reference lines are; + /// with none typed there is nothing to say. + #[test] + fn the_review_says_a_credit_line_switched_off_isnt_used() { + let default = "Made with RustGIS · today's date"; + let unused = "(none; the line typed isn't used)"; + let mut app = app(); + open(&mut app); + app.dialogs.publication.as_mut().unwrap().step = Step::Review; + let mut h = harness(app); + for (author, no_author, listed) in [ + ("", false, default), + ("J. G.", false, "J. G."), + (" ", false, default), + ("J. G.", true, unused), + ("", true, ""), + (" ", true, ""), + ] { + let d = h.state_mut().dialogs.publication.as_mut().unwrap(); + (d.author, d.no_author) = (author.into(), no_author); + h.run_steps(4); + for text in [default, "J. G.", unused] { + assert_eq!(h.query_by_label(text).is_some(), text == listed, "{text}: {author:?}, off {no_author}"); + } + } + } } From 5b9f04eeed15d28f92708d7bec91f86c7258e8fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Gregorio=20Rinc=C3=B3n?= Date: Fri, 27 Nov 2026 20:19:07 -0500 Subject: [PATCH 2/3] test(ui): count the review's (none) rows for a blank credit line switched off --- crates/ui-egui/src/publicationwizard/review.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/publicationwizard/review.rs b/crates/ui-egui/src/publicationwizard/review.rs index 560d46dff6..71350d1735 100644 --- a/crates/ui-egui/src/publicationwizard/review.rs +++ b/crates/ui-egui/src/publicationwizard/review.rs @@ -126,13 +126,15 @@ mod tests { open(&mut app); app.dialogs.publication.as_mut().unwrap().step = Step::Review; let mut h = harness(app); + // Other empty rows say "(none)" too: the credit row's is the one more. + let others = h.query_all_by_label("(none)").count(); for (author, no_author, listed) in [ ("", false, default), ("J. G.", false, "J. G."), (" ", false, default), ("J. G.", true, unused), - ("", true, ""), - (" ", true, ""), + ("", true, "(none)"), + (" ", true, "(none)"), ] { let d = h.state_mut().dialogs.publication.as_mut().unwrap(); (d.author, d.no_author) = (author.into(), no_author); @@ -140,6 +142,8 @@ mod tests { for text in [default, "J. G.", unused] { assert_eq!(h.query_by_label(text).is_some(), text == listed, "{text}: {author:?}, off {no_author}"); } + let none = h.query_all_by_label("(none)").count(); + assert_eq!(none, others + usize::from(listed == "(none)"), "(none): {author:?}, off {no_author}"); } } } From acd9667809eec420ec7967e500112715a763c5d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Gregorio=20Rinc=C3=B3n?= Date: Fri, 27 Nov 2026 20:22:04 -0500 Subject: [PATCH 3/3] test(ui): say what the review shows for a blank credit line switched off --- crates/ui-egui/src/publicationwizard/review.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/ui-egui/src/publicationwizard/review.rs b/crates/ui-egui/src/publicationwizard/review.rs index 71350d1735..fd097ece8c 100644 --- a/crates/ui-egui/src/publicationwizard/review.rs +++ b/crates/ui-egui/src/publicationwizard/review.rs @@ -117,7 +117,7 @@ mod tests { } /// A credit line typed and then switched off is said not to be used, as reference lines are; - /// with none typed there is nothing to say. + /// with none typed, the row says "(none)" and nothing more. #[test] fn the_review_says_a_credit_line_switched_off_isnt_used() { let default = "Made with RustGIS · today's date";