it: test idle timeout
This commit is contained in:
parent
b966a73682
commit
d4f49bf947
4 changed files with 43 additions and 3 deletions
30
src/it/tests/t0036_idle.rs
Normal file
30
src/it/tests/t0036_idle.rs
Normal 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(())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue