mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-10-14 11:17:10 -04:00
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.
23 lines
840 B
Rust
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));
|
|
}
|
|
}
|