feat(display): input routed via display server to focused app; input Subscribe; uses caps badged + Delegate
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use crate::adapters::mock::MockInputDevice;
|
||||
use crate::protocol::*;
|
||||
use crate::server::InputServer;
|
||||
use server_framework::Server;
|
||||
use server_framework::{Decode, Encode, Server};
|
||||
|
||||
fn test_server() -> InputServer<MockInputDevice> {
|
||||
InputServer::new(MockInputDevice::new())
|
||||
@@ -85,3 +85,14 @@ fn a_full_buffer_drops_the_oldest_event() {
|
||||
InputResponse::Event(InputEvent::KeyDown(Key::Char(8)))
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_subscription_is_kept_and_other_requests_still_work() {
|
||||
let mut server = test_server();
|
||||
let note = types::bounded::CapSlot::new(7);
|
||||
let (reply, _) = server.handle_call(0, [types::input::SUBSCRIBE, 0, 0, 0], note);
|
||||
assert_eq!(reply, [0; 4]);
|
||||
assert_eq!(server.subscriber(), note);
|
||||
let (reply, _) = server.handle_call(0, InputRequest::PollEvent.encode(), None);
|
||||
assert_eq!(InputResponse::decode(reply), Some(InputResponse::NoEvent));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user