From db26ce4a945368723aec538608c6c595626609ef Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 13 Nov 2026 07:11:22 -0800 Subject: [PATCH] Tests: the script report test allows its script the folder it writes in A script now writes only in its own folders and in what a person allowed it, so the ui.inspect script report test picks the test folder in the script's folder dialog before the script exports into it. --- crates/ui-egui/src/tests/automation.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/crates/ui-egui/src/tests/automation.rs b/crates/ui-egui/src/tests/automation.rs index d7f438d285..3683ec1ae7 100644 --- a/crates/ui-egui/src/tests/automation.rs +++ b/crates/ui-egui/src/tests/automation.rs @@ -1004,22 +1004,26 @@ fn ui_inspect_keeps_text_that_only_looks_like_a_library_id() { let _ = std::fs::remove_dir_all(base); } -/// `ui.inspect`'s `scriptReport` names a file the person's script wrote outside the read root, and -/// the included file a failed run stopped in (also in its error line), by its file name; the person -/// sees the paths. +/// `ui.inspect`'s `scriptReport` names a file the person's script wrote outside the read root (in +/// the folder the person allowed it), and the included file a failed run stopped in (also in its +/// error line), by its file name; the person sees the paths. #[test] fn ui_inspect_script_report_leaves_out_files_outside_the_read_root() { let (mut app, tx, base) = confined("inspect-script-report"); let (kept, hidden) = (s(base.join("in/kept.svg")), s(base.join("outside/hidden.svg"))); app.session.execute("file.new", &json!({"width": 100, "height": 100})).unwrap(); let source = format!( - "vc.run('document.export', {{path: {kept}, format: 'svg'}}); vc.run('document.export', {{path: {hidden}, format: 'svg'}});", + "Folder.selectDialog('Folder'); vc.run('document.export', {{path: {kept}, format: 'svg'}}); vc.run('document.export', {{path: {hidden}, format: 'svg'}});", kept = json!(kept), hidden = json!(hidden) ); let finish = |app: &mut VectorcraftApp, params: Value| { app.session.execute("script.run", ¶ms).unwrap(); for _ in 0..10_000 { + if app.session.script_picker().is_some() { + let paths = vec![s(base.clone())]; + assert!(app.session.script_pick(vectorcraft_engine::script::files::PickAnswer::Allow { paths, always: false })); + } if app.session.script_pump().is_some() { break; }