summaryrefslogtreecommitdiffstats
path: root/src/tests/fakes/fake_input.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/fakes/fake_input.rs')
-rw-r--r--src/tests/fakes/fake_input.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/tests/fakes/fake_input.rs b/src/tests/fakes/fake_input.rs
index 6007b71..b854c3b 100644
--- a/src/tests/fakes/fake_input.rs
+++ b/src/tests/fakes/fake_input.rs
@@ -6,6 +6,9 @@ use ::std::net::{IpAddr, Ipv4Addr, SocketAddr};
use ::std::{thread, time};
use ::termion::event::Event;
+use ::std::sync::Arc;
+use ::std::sync::atomic::{AtomicBool, Ordering};
+
use crate::network::{Connection, Protocol};
pub struct KeyboardEvents {
@@ -151,3 +154,14 @@ pub fn create_fake_lookup_addr(
None => None,
})
}
+
+pub fn create_fake_receive_winch(
+ should_send_winch_event: bool
+) -> Box<Fn(&Arc<AtomicBool>)> {
+ Box::new(move |winch| {
+ if should_send_winch_event {
+ thread::sleep(time::Duration::from_secs(1));
+ winch.store(true, Ordering::Relaxed);
+ }
+ })
+}