1
0
Fork 0
forked from wry/wry

it: test idle timeout

This commit is contained in:
Julian Orth 2024-04-03 16:06:35 +02:00
parent b966a73682
commit d4f49bf947
4 changed files with 43 additions and 3 deletions

View file

@ -0,0 +1,30 @@
use {
crate::it::{
test_error::{TestErrorExt, TestResult},
testrun::TestRun,
},
std::{rc::Rc, time::Duration},
};
testcase!();
async fn test(run: Rc<TestRun>) -> TestResult {
let ds = run.create_default_setup().await?;
run.cfg.set_idle(Duration::from_micros(100))?;
let idle = run.backend.idle.expect()?;
tassert!(idle.next().is_err());
run.state.wheel.timeout(3).await?;
tassert_eq!(idle.next().with_context(|| "idle")?, true);
tassert!(idle.next().is_err());
ds.mouse.rel(1.0, 1.0);
run.state.eng.yield_now().await;
tassert_eq!(idle.next().with_context(|| "wake")?, false);
Ok(())
}