From 24be579cc47f57abdff8bf53666f28d79300ac57 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 24 Nov 2026 18:57:45 -0800 Subject: [PATCH] Tests: the empty-password Place tests use the dialog host The Import PDF dialog now lives in the craft dialog host, so an_empty_password_still_asks_for_the_password closes each dialog with cancel_by_id and checks it with the file's dialog_id helper instead of app.ui.dialog. --- crates/ui-egui/src/dialogs/tests_import_pdf.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/dialogs/tests_import_pdf.rs b/crates/ui-egui/src/dialogs/tests_import_pdf.rs index 5051b8338b..30a1aa9d65 100644 --- a/crates/ui-egui/src/dialogs/tests_import_pdf.rs +++ b/crates/ui-egui/src/dialogs/tests_import_pdf.rs @@ -525,14 +525,18 @@ fn an_empty_password_still_asks_for_the_password() { let mut app = app(); let bytes = pdf(&[PdfPage::new(120.0, 60.0, "1 0 0 rg 0 0 20 20 re f")], Some("pw")); let data = vectorcraft_format::base64_encode(&bytes); + let close = |app: &VectorcraftApp| { + let id = dialog_id(app).expect("an Import PDF dialog"); + assert!(app.dialogs().unwrap().with(|host| host.cancel_by_id(&ctx(app), id))); + assert!(!is_open(app)); + }; for password in [json!(""), json!(null)] { - app.ui.dialog = None; let p = json!({"name": "locked.pdf", "dataBase64": data, "password": password}); assert!(import_pdf::offer_place_password(&mut app, &p), "asks with password {password}"); assert_eq!((field(&app, "__locked"), field(&app, "__passwordOnly")), (json!(true), json!(true))); + close(&app); } - app.ui.dialog = None; let p = json!({"name": "locked.pdf", "dataBase64": data, "password": "pw"}); assert!(!import_pdf::offer_place_password(&mut app, &p), "a given password is placed with"); - assert!(app.ui.dialog.is_none()); + assert!(!is_open(&app)); }