mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-03 06:31:42 +01:00
Data Sets as Files: keep sets left out by Yes in the last set's error (#13767)
When a Yes skipped a set and the resumed export then stopped at a missing image in the last set, the error notice named only that last file, so the set left out earlier was no longer reported. The notice now appends the existing "Data sets not exported" list.
This commit is contained in:
1 parent
731b311b25
commit
65e10fa0bd
2 files changed
+22
-1
No files matched your search
@@ -286,3 +286,19 @@ fn a_document_edited_while_asking_ends_the_export() {
|
||||
assert!(app.ui.status_error && app.ui.status.contains("changed"), "{}", app.ui.status);
|
||||
let _ = std::fs::remove_dir_all(dir);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_missing_last_set_after_a_yes_still_lists_the_set_left_out() {
|
||||
let dir = scratch("yes-then-last");
|
||||
let out = dir.join("out");
|
||||
let (mut app, ctx) = app(&dir, &[true, false, false]);
|
||||
export_from_form(&mut app, &ctx, &out);
|
||||
let (id, _) = question(&app).unwrap();
|
||||
answer(&mut app, &ctx, id, true);
|
||||
assert!(question(&app).is_none(), "the last set keeps today's error, no question");
|
||||
assert_eq!(files(&out), ["Data_Set_1.png"]);
|
||||
let status = &app.ui.status;
|
||||
assert!(app.ui.status_error && status.starts_with(photocraft_engine::DATA_SET_FILE_MISSING), "{status}");
|
||||
assert!(status.contains("Data Set 2"), "the set an earlier Yes left out stays listed: {status}");
|
||||
let _ = std::fs::remove_dir_all(dir);
|
||||
}
|
||||
@@ -1119,7 +1119,12 @@ fn data_sets_went_on(app: &mut PhotocraftApp, doc: Option<photocraft_doc::DocId>
|
||||
let index = stopped.get("index").and_then(Value::as_u64).and_then(|n| usize::try_from(n).ok());
|
||||
let remaining = stopped.get("remaining").and_then(Value::as_u64).unwrap_or(0);
|
||||
let (Some(index), true) = (index, remaining > 0) else {
|
||||
let error = stopped.get("error").and_then(Value::as_str).unwrap_or(photocraft_engine::DATA_SET_FILE_MISSING).to_owned();
|
||||
let mut error = stopped.get("error").and_then(Value::as_str).unwrap_or(photocraft_engine::DATA_SET_FILE_MISSING).to_owned();
|
||||
// Sets an earlier Yes left out stay listed next to the last set's error.
|
||||
if !skipped.is_empty() {
|
||||
error.push(' ');
|
||||
error.push_str(&crate::i18n::fmt(tl!("Data sets not exported (replacement file not found): {names}"), &[("names", &skipped.join(", "))]));
|
||||
}
|
||||
crate::notices::error(app, error);
|
||||
return;
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user