Skip to content

Commit

Permalink
try something
Browse files Browse the repository at this point in the history
  • Loading branch information
coolreader18 committed Jan 22, 2025
1 parent e25052b commit 47153d1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/virtual_device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ async fn test_virtual_device_actually_emits() -> Result<(), Box<dyn Error>> {
let virtual_device_name = "fake-keyboard";
keys.insert(KeyCode::KEY_ESC);

let mut device = VirtualDevice::builder()?
let mut device = VirtualDevice::builder()
.unwrap()
.name(virtual_device_name)
.with_keys(&keys)?
.with_keys(&keys)
.unwrap()
.build()
.unwrap();

Expand All @@ -38,15 +40,15 @@ async fn test_virtual_device_actually_emits() -> Result<(), Box<dyn Error>> {
// listen for events on the listen device
let listener = tokio::spawn(async move {
// try to read the key code that will be sent through virtual device
let mut events = listen_device.into_event_stream()?;
let mut events = listen_device.into_event_stream().unwrap();
events.next_event().await
});

// emit a key code through virtual device
let down_event = InputEvent::new(type_.0, code, 10);
device.emit(&[down_event]).unwrap();

let event = timeout(Duration::from_secs(1), listener).await???;
let event = timeout(Duration::from_secs(1), listener).await.unwrap();

assert_eq!(down_event.event_type(), event.event_type());
assert_eq!(down_event.code(), event.code());
Expand Down

0 comments on commit 47153d1

Please sign in to comment.