Files
pdfcraft/crates/ui-egui/tests/support/mod.rs
T
skylar taylor-barrick b5467d93a0 fix(ui): preserve native open actions and password prompts
Carry selected tool actions through native file preparation, password retries and conversion, and defer startup intake until pending native opens finish.

Await observable completion in native opening, password, recovery and linked-PDF tests while retaining their content, identity, dirty-state, cancellation and destination checks. Verify the expected validation error and preserve the original document after refused consent targets.

M3; refs #1914.
2026-10-13 12:18:41 -06:00

23 lines
840 B
Rust

//! State-based waits for native preparation, which completes between UI frames.
use egui_kittest::Harness;
use pdfcraft_ui_egui::PdfCraftApp;
pub fn wait_until(h: &mut Harness<'static, PdfCraftApp>, what: &str, ready: impl Fn(&PdfCraftApp) -> bool) {
let deadline = std::time::Instant::now() + std::time::Duration::from_secs(30);
loop {
h.step();
if ready(h.state()) {
return;
}
assert!(
std::time::Instant::now() < deadline,
"timed out waiting for {what}: views={}, active={:?}, password={:?}, toast={:?}",
h.state().views.len(),
h.state().active,
h.state().password_prompt.as_ref().map(|p| (&p.name, &p.error)),
h.state().toast
);
std::thread::sleep(std::time::Duration::from_millis(5));
}
}