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.
This commit is contained in:
dotCooCoo
2026-11-13 07:11:22 -08:00
parent 4716646c6b
commit db26ce4a94
+8 -4
View File
@@ -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", &params).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;
}