diff --git a/crates/ui-egui/src/publicationwizard/review.rs b/crates/ui-egui/src/publicationwizard/review.rs index 897edc3d63..d714d45845 100644 --- a/crates/ui-egui/src/publicationwizard/review.rs +++ b/crates/ui-egui/src/publicationwizard/review.rs @@ -14,6 +14,16 @@ pub(super) fn review_step(ui: &mut egui::Ui, d: &Draft) { }; row(tl!("Size"), size_label(&d.size)); if d.figure() { + // The figure note sends a sheet's texts to the caption. Its reference doesn't go there + // (the figure draws the default one), so it is said here. + let unused = if d.no_reference { + Some(tl!("\"No cartographic reference\" isn't used: a figure takes the default reference")) + } else { + lines(&d.reference).next().map(|_| tl!("The lines typed aren't used: a figure takes the default reference")) + }; + if let Some(unused) = unused { + row(tl!("Reference"), unused.to_string()); + } return; } let turned = match d.orientation { diff --git a/crates/ui-egui/src/publicationwizard/sources.rs b/crates/ui-egui/src/publicationwizard/sources.rs index 478bab1ece..112c29dc8b 100644 --- a/crates/ui-egui/src/publicationwizard/sources.rs +++ b/crates/ui-egui/src/publicationwizard/sources.rs @@ -145,9 +145,10 @@ mod tests { assert_eq!(d.params()["headings"], json!([PUBLICATION_HEADINGS[0], PUBLICATION_HEADINGS[1], "Col"])); } - /// A section left out takes no heading with it: not the reference's where there is none. + /// A heading typed for a section left out isn't sent: where a later heading follows, the + /// command's own goes in its place. #[test] - fn a_section_left_out_sends_no_heading() { + fn a_heading_typed_for_a_section_left_out_isnt_sent() { let mut d = draft(); d.headings = [String::new(), "Ref".into(), String::new()]; d.no_reference = true; @@ -391,6 +392,22 @@ mod tests { assert!(h.query_by_label(said).is_some()); } + /// A figure takes the command's default reference: the review says the lines or the tick set + /// on a sheet aren't used, and says nothing where neither was set. + #[test] + fn a_figures_review_says_the_sheets_reference_isnt_used() { + let typed = "The lines typed aren't used: a figure takes the default reference"; + let tick = "\"No cartographic reference\" isn't used: a figure takes the default reference"; + let mut h = at(Step::Review, |d| d.size = "figure-1col".into()); + assert!(h.query_by_label_contains("default reference").is_none(), "nothing set, nothing lost"); + h.state_mut().dialogs.publication.as_mut().unwrap().reference = "UTM 23S".into(); + h.run_steps(4); + assert!(h.query_by_label(typed).is_some() && h.query_by_label(tick).is_none()); + h.state_mut().dialogs.publication.as_mut().unwrap().no_reference = true; + h.run_steps(4); + assert!(h.query_by_label(tick).is_some() && h.query_by_label(typed).is_none()); + } + /// Create puts the sources, the reference and the heading given on the sheet, and Undo takes /// it away. #[test]