mirror of
https://github.com/storytold/effectcraft.git
synced 2026-11-22 10:21:01 +01:00
Merge pull request #3693 from storytold/fix/import-dialog-tests-paths-result
Tests: import dialog tests answer with a Result of paths (main does not compile its tests)
This commit is contained in:
3 files changed
+13
-5
No files matched your search
@@ -141,7 +141,12 @@ pub fn install_pickers(app: &mut EffectcraftApp, ctx: &egui::Context) -> Receive
|
|||||||
pub fn message(title: &str, description: String) {
|
pub fn message(title: &str, description: String) {
|
||||||
let shown = guarded("message", || rfd::MessageDialog::new().set_level(rfd::MessageLevel::Error).set_title(title).set_description(description).show());
|
let shown = guarded("message", || rfd::MessageDialog::new().set_level(rfd::MessageLevel::Error).set_title(title).set_description(description).show());
|
||||||
if let Err(e) = shown {
|
if let Err(e) = shown {
|
||||||
log::error!("{e}");
|
// The diagnostic helper runs before logging is installed.
|
||||||
|
if log::log_enabled!(log::Level::Error) {
|
||||||
|
log::error!("{e}");
|
||||||
|
} else {
|
||||||
|
eprintln!("effectcraft: {e}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ fn start_helpers_if_opted_in(session: &mut effectcraft_engine::Session) {
|
|||||||
fn main() -> eframe::Result {
|
fn main() -> eframe::Result {
|
||||||
let args: Vec<_> = std::env::args_os().skip(1).collect();
|
let args: Vec<_> = std::env::args_os().skip(1).collect();
|
||||||
if crash_report::maybe_run(&args, |description| {
|
if crash_report::maybe_run(&args, |description| {
|
||||||
rfd::MessageDialog::new().set_level(rfd::MessageLevel::Error).set_title("EffectCraft diagnostic report").set_description(description).show();
|
file_dialogs::message("EffectCraft diagnostic report", description.to_owned());
|
||||||
}) {
|
}) {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -823,7 +823,7 @@ fn import_file_dialog_offers_and_imports_after_effects_projects() {
|
|||||||
assert!(many && exts.iter().any(|e| e == "aep") && exts.iter().any(|e| e == "aepx"), "{exts:?}");
|
assert!(many && exts.iter().any(|e| e == "aep") && exts.iter().any(|e| e == "aepx"), "{exts:?}");
|
||||||
assert!(exts.iter().any(|e| e == "png"), "footage too");
|
assert!(exts.iter().any(|e| e == "png"), "footage too");
|
||||||
|
|
||||||
super::frontend::dialog_answered(&mut app, crate::DialogAnswer { command: "file.import".into(), key: "paths", params: json!({}), paths: vec![aep] });
|
super::frontend::dialog_answered(&mut app, crate::DialogAnswer { command: "file.import".into(), key: "paths", params: json!({}), paths: Ok(vec![aep]) });
|
||||||
let comp = app.session.project.item(app.session.active_comp_id().expect("a composition is open")).unwrap();
|
let comp = app.session.project.item(app.session.active_comp_id().expect("a composition is open")).unwrap();
|
||||||
assert_eq!(comp.name, "Intro");
|
assert_eq!(comp.name, "Intro");
|
||||||
assert_eq!(app.session.project.item(comp.parent.expect("in a folder")).unwrap().name, "Intro.aep");
|
assert_eq!(app.session.project.item(comp.parent.expect("in a folder")).unwrap().name, "Intro.aep");
|
||||||
@@ -884,7 +884,10 @@ fn picked_projects_report_every_error() {
|
|||||||
std::fs::write(&aep, b"not an aep").unwrap();
|
std::fs::write(&aep, b"not an aep").unwrap();
|
||||||
std::fs::write(&ecproj, b"not a project").unwrap();
|
std::fs::write(&ecproj, b"not a project").unwrap();
|
||||||
let paths = vec![aep.to_string_lossy().to_string(), ecproj.to_string_lossy().to_string()];
|
let paths = vec![aep.to_string_lossy().to_string(), ecproj.to_string_lossy().to_string()];
|
||||||
super::frontend::dialog_answered(&mut app, crate::DialogAnswer { command: "file.import".into(), key: "paths", params: json!({}), paths: paths.clone() });
|
super::frontend::dialog_answered(
|
||||||
|
&mut app,
|
||||||
|
crate::DialogAnswer { command: "file.import".into(), key: "paths", params: json!({}), paths: Ok(paths.clone()) },
|
||||||
|
);
|
||||||
let status = &app.ui.status;
|
let status = &app.ui.status;
|
||||||
assert!(status.contains("broken.aep") && status.contains("broken.ecproj"), "{status}");
|
assert!(status.contains("broken.aep") && status.contains("broken.ecproj"), "{status}");
|
||||||
assert!(!status.contains('"'), "messages, not quoted JSON: {status}");
|
assert!(!status.contains('"'), "messages, not quoted JSON: {status}");
|
||||||
@@ -915,7 +918,7 @@ fn a_picked_project_with_losses_asks_and_the_next_waits() {
|
|||||||
source.execute("comp.new", json!({"name": "Intro", "width": 64, "height": 36, "frameRate": 30, "duration": 1})).unwrap();
|
source.execute("comp.new", json!({"name": "Intro", "width": 64, "height": 36, "frameRate": 30, "duration": 1})).unwrap();
|
||||||
source.execute("file.exportAep", json!({"path": intro, "allowLosses": true})).unwrap();
|
source.execute("file.exportAep", json!({"path": intro, "allowLosses": true})).unwrap();
|
||||||
let paths = vec![lossy.to_string_lossy().to_string(), intro.clone()];
|
let paths = vec![lossy.to_string_lossy().to_string(), intro.clone()];
|
||||||
super::frontend::dialog_answered(&mut app, crate::DialogAnswer { command: "file.import".into(), key: "paths", params: json!({}), paths });
|
super::frontend::dialog_answered(&mut app, crate::DialogAnswer { command: "file.import".into(), key: "paths", params: json!({}), paths: Ok(paths) });
|
||||||
assert_eq!(app.dialog, Some(crate::Dialog::AepLosses));
|
assert_eq!(app.dialog, Some(crate::Dialog::AepLosses));
|
||||||
assert_eq!(app.dialog_state.aep_losses.queue, [intro]);
|
assert_eq!(app.dialog_state.aep_losses.queue, [intro]);
|
||||||
assert!(app.session.project.items.is_empty(), "nothing imported before the answer");
|
assert!(app.session.project.items.is_empty(), "nothing imported before the answer");
|
||||||
|
|||||||
Reference in new issue
Block a user