Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions crates/ui-egui/src/publicationwizard/review.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
21 changes: 19 additions & 2 deletions crates/ui-egui/src/publicationwizard/sources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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]
Expand Down
Loading