diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-15 20:53:34 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-05-15 20:53:55 +0300 |
| commit | 73dba97521f5a0e3104518ef48b775a178998f52 (patch) | |
| tree | ad9f95b4836303a35974b9ccdde229a1b05b03f4 /tests | |
| parent | 4cbe72ec2d8a174e3c4f9bde2101aa189c7f38e7 (diff) | |
fix: forward pane cursor shape
fixes #116
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/api_ping.rs | 2 | ||||
| -rw-r--r-- | tests/cli_wrapper.rs | 6 | ||||
| -rw-r--r-- | tests/client_mode.rs | 39 | ||||
| -rw-r--r-- | tests/cross_area.rs | 19 | ||||
| -rw-r--r-- | tests/detach_reattach.rs | 44 | ||||
| -rw-r--r-- | tests/multi_client.rs | 5 | ||||
| -rw-r--r-- | tests/server_headless.rs | 16 |
7 files changed, 67 insertions, 64 deletions
diff --git a/tests/api_ping.rs b/tests/api_ping.rs index 8abaf267..30840e91 100644 --- a/tests/api_ping.rs +++ b/tests/api_ping.rs @@ -227,7 +227,7 @@ fn ping_over_socket_returns_version() { assert_eq!(value["result"]["version"], env!("CARGO_PKG_VERSION")); // Intentionally hardcoded so wire protocol bumps require updating this test. // Changing this value means old clients/servers are no longer compatible. - assert_eq!(value["result"]["protocol"], 5); + assert_eq!(value["result"]["protocol"], 6); cleanup_spawned_herdr(child, base); } diff --git a/tests/cli_wrapper.rs b/tests/cli_wrapper.rs index 357482e9..52e99edb 100644 --- a/tests/cli_wrapper.rs +++ b/tests/cli_wrapper.rs @@ -938,7 +938,7 @@ fn status_commands_report_client_and_server_versions() { "stdout: {full_stdout}" ); assert!( - full_stdout.contains(" protocol: 5"), + full_stdout.contains(" protocol: 6"), "stdout: {full_stdout}" ); assert!(full_stdout.contains("server:\n"), "stdout: {full_stdout}"); @@ -971,7 +971,7 @@ fn status_commands_report_client_and_server_versions() { "stdout: {server_stdout}" ); assert!( - server_stdout.contains("protocol: 5"), + server_stdout.contains("protocol: 6"), "stdout: {server_stdout}" ); @@ -983,7 +983,7 @@ fn status_commands_report_client_and_server_versions() { "stdout: {client_stdout}" ); assert!( - client_stdout.contains("protocol: 5"), + client_stdout.contains("protocol: 6"), "stdout: {client_stdout}" ); assert!( diff --git a/tests/client_mode.rs b/tests/client_mode.rs index 150b8733..79dfaae3 100644 --- a/tests/client_mode.rs +++ b/tests/client_mode.rs @@ -186,6 +186,7 @@ struct CursorWire { x: u16, y: u16, visible: bool, + shape: u8, } fn decode_frame_payload(payload: &[u8]) -> std::io::Result<FrameWire> { @@ -237,7 +238,7 @@ fn frame_contains_text(frame: &FrameWire, needle: &str) -> bool { } let _ = (frame.height, frame.graphics.len()); if let Some(cursor) = frame.cursor.as_ref() { - let _ = (cursor.x, cursor.y, cursor.visible); + let _ = (cursor.x, cursor.y, cursor.visible, cursor.shape); } text.contains(needle) @@ -266,8 +267,8 @@ fn client_connects_and_receives_frame() { // Connect and handshake. let mut stream = UnixStream::connect(&client_socket).expect("should connect to client socket"); let (version, error) = - client_handshake(&mut stream, 5, 80, 24).expect("handshake should succeed"); - assert_eq!(version, 5, "server should report protocol version 5"); + client_handshake(&mut stream, 6, 80, 24).expect("handshake should succeed"); + assert_eq!(version, 6, "server should report protocol version 6"); assert!( error.is_none(), "handshake should not have error: {:?}", @@ -334,8 +335,8 @@ fn client_sees_headless_startup_config_diagnostic() { let mut stream = UnixStream::connect(&client_socket).expect("should connect to client socket"); let (version, error) = - client_handshake(&mut stream, 5, 80, 24).expect("handshake should succeed"); - assert_eq!(version, 5); + client_handshake(&mut stream, 6, 80, 24).expect("handshake should succeed"); + assert_eq!(version, 6); assert!(error.is_none(), "{:?}", error); stream @@ -383,8 +384,8 @@ fn client_input_forwarded_to_pane() { // Connect and handshake. let mut stream = UnixStream::connect(&client_socket).expect("should connect to client socket"); let (version, error) = - client_handshake(&mut stream, 5, 80, 24).expect("handshake should succeed"); - assert_eq!(version, 5); + client_handshake(&mut stream, 6, 80, 24).expect("handshake should succeed"); + assert_eq!(version, 6); assert!(error.is_none(), "{:?}", error); // Send an Input message containing "echo hello\n". @@ -437,8 +438,8 @@ fn client_resize_sends_message() { // Connect and handshake. let mut stream = UnixStream::connect(&client_socket).expect("should connect to client socket"); let (version, error) = - client_handshake(&mut stream, 5, 80, 24).expect("handshake should succeed"); - assert_eq!(version, 5); + client_handshake(&mut stream, 6, 80, 24).expect("handshake should succeed"); + assert_eq!(version, 6); assert!(error.is_none(), "{:?}", error); // Drain the initial frame(s). @@ -496,8 +497,8 @@ fn server_shutdown_sends_message_to_client() { // Connect and handshake. let mut stream = UnixStream::connect(&client_socket).expect("should connect to client socket"); let (version, error) = - client_handshake(&mut stream, 5, 80, 24).expect("handshake should succeed"); - assert_eq!(version, 5); + client_handshake(&mut stream, 6, 80, 24).expect("handshake should succeed"); + assert_eq!(version, 6); assert!(error.is_none(), "{:?}", error); // Send SIGINT so the server takes the graceful shutdown path and @@ -724,8 +725,8 @@ fn client_receives_frame_after_pane_output() { // Connect and handshake. let mut stream = UnixStream::connect(&client_socket).expect("should connect to client socket"); let (version, error) = - client_handshake(&mut stream, 5, 80, 24).expect("handshake should succeed"); - assert_eq!(version, 5); + client_handshake(&mut stream, 6, 80, 24).expect("handshake should succeed"); + assert_eq!(version, 6); assert!(error.is_none(), "{:?}", error); read_next_frame_payload(&mut stream, Duration::from_secs(10)) @@ -771,8 +772,8 @@ fn navigate_mode_keybind_dispatch_in_server() { // Connect and handshake. let mut stream = UnixStream::connect(&client_socket).expect("should connect to client socket"); let (version, error) = - client_handshake(&mut stream, 5, 80, 24).expect("handshake should succeed"); - assert_eq!(version, 5); + client_handshake(&mut stream, 6, 80, 24).expect("handshake should succeed"); + assert_eq!(version, 6); assert!(error.is_none(), "{:?}", error); // Drain initial frames. @@ -889,8 +890,8 @@ fn graceful_shutdown_sends_server_shutdown_to_client() { // Connect and handshake. let mut stream = UnixStream::connect(&client_socket).expect("should connect to client socket"); let (version, error) = - client_handshake(&mut stream, 5, 80, 24).expect("handshake should succeed"); - assert_eq!(version, 5); + client_handshake(&mut stream, 6, 80, 24).expect("handshake should succeed"); + assert_eq!(version, 6); assert!(error.is_none(), "{:?}", error); // Drain initial frame(s). @@ -987,8 +988,8 @@ fn client_receives_notify_on_agent_state_change() { // Connect as a client and perform handshake. let mut stream = UnixStream::connect(&client_socket).expect("should connect"); let (version, error) = - client_handshake(&mut stream, 5, 80, 24).expect("handshake should succeed"); - assert_eq!(version, 5); + client_handshake(&mut stream, 6, 80, 24).expect("handshake should succeed"); + assert_eq!(version, 6); assert!(error.is_none(), "{:?}", error); // Drain initial frame(s). diff --git a/tests/cross_area.rs b/tests/cross_area.rs index 963214b3..b5910e92 100644 --- a/tests/cross_area.rs +++ b/tests/cross_area.rs @@ -518,6 +518,7 @@ struct CursorWire { x: u16, y: u16, visible: bool, + shape: u8, } fn decode_frame_payload(payload: &[u8]) -> io::Result<FrameWire> { @@ -554,7 +555,7 @@ fn frame_contains_text(frame: &FrameWire, needle: &str) -> bool { } let _ = (frame.height, frame.graphics.len()); if let Some(cursor) = frame.cursor.as_ref() { - let _ = (cursor.x, cursor.y, cursor.visible); + let _ = (cursor.x, cursor.y, cursor.visible, cursor.shape); } text.contains(needle) @@ -677,7 +678,7 @@ fn cross_area_detach_and_reattach_preserves_state() { // Local attach (client A). let mut client_a = UnixStream::connect(&client_socket).expect("client A should connect"); - client_handshake(&mut client_a, 5, 100, 30); + client_handshake(&mut client_a, 6, 100, 30); assert!(wait_for_frame(&mut client_a, Duration::from_secs(2))); // Use herdr: create a workspace and write output into its pane. @@ -714,7 +715,7 @@ fn cross_area_detach_and_reattach_preserves_state() { // Reattach from another terminal/session (client B). let mut client_b = UnixStream::connect(&client_socket).expect("client B should connect"); - client_handshake(&mut client_b, 5, 80, 24); + client_handshake(&mut client_b, 6, 80, 24); assert!( wait_for_frame(&mut client_b, Duration::from_secs(5)), "reattached client should receive frame" @@ -770,7 +771,7 @@ fn cross_area_agent_process_survives_detach_and_reattach() { wait_for_socket(&client_socket, Duration::from_secs(10)); let mut client_a = UnixStream::connect(&client_socket).expect("client A should connect"); - client_handshake(&mut client_a, 5, 100, 30); + client_handshake(&mut client_a, 6, 100, 30); assert!(wait_for_frame(&mut client_a, Duration::from_secs(2))); let created = workspace_create(&api_socket, "agent-persist"); @@ -823,7 +824,7 @@ fn cross_area_agent_process_survives_detach_and_reattach() { // Reattach and ensure client-side state reflects the persisted working status. let mut client_b = UnixStream::connect(&client_socket).expect("client B should connect"); - client_handshake(&mut client_b, 5, 80, 24); + client_handshake(&mut client_b, 6, 80, 24); let saw_working_on_client = wait_for_frame_matching(&mut client_b, Duration::from_secs(5), |frame| { frame_contains_text(frame, "working") @@ -868,7 +869,7 @@ fn cross_area_client_and_api_workspace_views_are_consistent() { wait_for_socket(&client_socket, Duration::from_secs(10)); let mut client = UnixStream::connect(&client_socket).expect("client should connect"); - client_handshake(&mut client, 5, 100, 30); + client_handshake(&mut client, 6, 100, 30); assert!(wait_for_frame(&mut client, Duration::from_secs(2))); drain_server_messages(&mut client, Duration::from_millis(300)); @@ -931,9 +932,9 @@ fn cross_area_two_clients_shared_view_and_single_detach_stability() { wait_for_socket(&client_socket, Duration::from_secs(10)); let mut client_a = UnixStream::connect(&client_socket).expect("client A should connect"); - client_handshake(&mut client_a, 5, 110, 30); + client_handshake(&mut client_a, 6, 110, 30); let mut client_b = UnixStream::connect(&client_socket).expect("client B should connect"); - client_handshake(&mut client_b, 5, 100, 30); + client_handshake(&mut client_b, 6, 100, 30); assert!(wait_for_frame(&mut client_a, Duration::from_secs(2))); assert!(wait_for_frame(&mut client_b, Duration::from_secs(2))); @@ -1099,7 +1100,7 @@ fn cross_area_server_kill_then_restart_and_reconnect() { let mut reconnect_client = UnixStream::connect(&client_socket).expect("new client should connect after restart"); - client_handshake(&mut reconnect_client, 5, 80, 24); + client_handshake(&mut reconnect_client, 6, 80, 24); assert!( wait_for_frame(&mut reconnect_client, Duration::from_secs(5)), "new client should receive frame after restart" diff --git a/tests/detach_reattach.rs b/tests/detach_reattach.rs index 588d5713..67e634a7 100644 --- a/tests/detach_reattach.rs +++ b/tests/detach_reattach.rs @@ -276,8 +276,8 @@ fn navigate_q_detaches_client_and_server_persists() { // Connect and handshake. let mut stream = UnixStream::connect(&client_socket).expect("should connect to client socket"); let (version, error) = - client_handshake(&mut stream, 5, 80, 24).expect("handshake should succeed"); - assert_eq!(version, 5); + client_handshake(&mut stream, 6, 80, 24).expect("handshake should succeed"); + assert_eq!(version, 6); assert!(error.is_none(), "{:?}", error); // Drain initial frames. @@ -338,8 +338,8 @@ fn explicit_detach_message_causes_clean_disconnect() { // Connect and handshake. let mut stream = UnixStream::connect(&client_socket).expect("should connect"); let (version, error) = - client_handshake(&mut stream, 5, 80, 24).expect("handshake should succeed"); - assert_eq!(version, 5); + client_handshake(&mut stream, 6, 80, 24).expect("handshake should succeed"); + assert_eq!(version, 6); assert!(error.is_none(), "{:?}", error); // Drain initial frames. @@ -397,8 +397,8 @@ fn reattach_after_detach_shows_current_state() { // --- Client A --- let mut stream_a = UnixStream::connect(&client_socket).expect("client A should connect"); let (version, error) = - client_handshake(&mut stream_a, 5, 80, 24).expect("handshake should succeed"); - assert_eq!(version, 5); + client_handshake(&mut stream_a, 6, 80, 24).expect("handshake should succeed"); + assert_eq!(version, 6); assert!(error.is_none(), "{:?}", error); // Drain initial frames. @@ -436,8 +436,8 @@ fn reattach_after_detach_shows_current_state() { // --- Client B (reattach) --- let mut stream_b = UnixStream::connect(&client_socket).expect("client B should connect"); let (version, error) = - client_handshake(&mut stream_b, 5, 80, 24).expect("handshake should succeed"); - assert_eq!(version, 5); + client_handshake(&mut stream_b, 6, 80, 24).expect("handshake should succeed"); + assert_eq!(version, 6); assert!( error.is_none(), "reattach handshake should succeed: {:?}", @@ -516,8 +516,8 @@ fn processes_survive_during_and_after_detach() { // Connect and handshake. let mut stream = UnixStream::connect(&client_socket).expect("should connect"); let (version, error) = - client_handshake(&mut stream, 5, 80, 24).expect("handshake should succeed"); - assert_eq!(version, 5); + client_handshake(&mut stream, 6, 80, 24).expect("handshake should succeed"); + assert_eq!(version, 6); assert!(error.is_none(), "{:?}", error); // Drain initial frames. @@ -555,8 +555,8 @@ fn processes_survive_during_and_after_detach() { // Reattach — verify we can connect and receive a frame. let mut stream_b = UnixStream::connect(&client_socket).expect("should reattach"); let (version, error) = - client_handshake(&mut stream_b, 5, 80, 24).expect("reattach handshake should succeed"); - assert_eq!(version, 5); + client_handshake(&mut stream_b, 6, 80, 24).expect("reattach handshake should succeed"); + assert_eq!(version, 6); assert!(error.is_none(), "{:?}", error); // Verify the reattached client receives a frame. @@ -604,8 +604,8 @@ fn server_persists_after_client_connection_drop() { // Connect and handshake. let mut stream = UnixStream::connect(&client_socket).expect("should connect"); let (version, error) = - client_handshake(&mut stream, 5, 80, 24).expect("handshake should succeed"); - assert_eq!(version, 5); + client_handshake(&mut stream, 6, 80, 24).expect("handshake should succeed"); + assert_eq!(version, 6); assert!(error.is_none(), "{:?}", error); // Drain initial frames. @@ -631,8 +631,8 @@ fn server_persists_after_client_connection_drop() { // Reattach — verify we can connect and handshake again. let mut stream_b = UnixStream::connect(&client_socket).expect("should reattach"); let (version, error) = - client_handshake(&mut stream_b, 5, 80, 24).expect("reattach handshake should succeed"); - assert_eq!(version, 5); + client_handshake(&mut stream_b, 6, 80, 24).expect("reattach handshake should succeed"); + assert_eq!(version, 6); assert!(error.is_none(), "reattach should succeed: {:?}", error); cleanup_spawned_herdr(spawned, base); @@ -653,8 +653,8 @@ fn detached_output_preserves_last_attached_pty_size() { let mut stream = UnixStream::connect(&client_socket).expect("client should connect"); let (version, error) = - client_handshake(&mut stream, 5, 120, 40).expect("handshake should succeed"); - assert_eq!(version, 5); + client_handshake(&mut stream, 6, 120, 40).expect("handshake should succeed"); + assert_eq!(version, 6); assert!(error.is_none(), "{:?}", error); drain_messages(&mut stream); @@ -722,8 +722,8 @@ fn output_accumulated_while_detached_visible_on_reattach() { // Connect and handshake client A. let mut stream_a = UnixStream::connect(&client_socket).expect("client A should connect"); let (version, error) = - client_handshake(&mut stream_a, 5, 80, 24).expect("handshake should succeed"); - assert_eq!(version, 5); + client_handshake(&mut stream_a, 6, 80, 24).expect("handshake should succeed"); + assert_eq!(version, 6); assert!(error.is_none(), "{:?}", error); // Detach client A immediately. @@ -780,8 +780,8 @@ fn output_accumulated_while_detached_visible_on_reattach() { // --- Client B (reattach) --- let mut stream_b = UnixStream::connect(&client_socket).expect("client B should connect"); let (version, error) = - client_handshake(&mut stream_b, 5, 80, 24).expect("reattach handshake should succeed"); - assert_eq!(version, 5); + client_handshake(&mut stream_b, 6, 80, 24).expect("reattach handshake should succeed"); + assert_eq!(version, 6); assert!(error.is_none(), "{:?}", error); // Client B should receive a frame with the current state. diff --git a/tests/multi_client.rs b/tests/multi_client.rs index 704b511e..103c3f1f 100644 --- a/tests/multi_client.rs +++ b/tests/multi_client.rs @@ -549,7 +549,7 @@ fn client_handshake( fn connect_raw_client(client_socket: &Path, cols: u16, rows: u16) -> UnixStream { let mut stream = UnixStream::connect(client_socket).expect("should connect to client socket"); - client_handshake(&mut stream, 5, cols, rows).expect("handshake should succeed"); + client_handshake(&mut stream, 6, cols, rows).expect("handshake should succeed"); stream } @@ -599,6 +599,7 @@ struct CursorWire { x: u16, y: u16, visible: bool, + shape: u8, } fn decode_frame_payload(payload: &[u8]) -> io::Result<FrameWire> { @@ -714,7 +715,7 @@ fn frame_contains_text(frame: &FrameWire, needle: &str) -> bool { let _ = (frame.height, frame.graphics.len()); if let Some(cursor) = frame.cursor.as_ref() { - let _ = (cursor.x, cursor.y, cursor.visible); + let _ = (cursor.x, cursor.y, cursor.visible, cursor.shape); } full_text.contains(needle) diff --git a/tests/server_headless.rs b/tests/server_headless.rs index 209a8045..51a9d005 100644 --- a/tests/server_headless.rs +++ b/tests/server_headless.rs @@ -583,11 +583,11 @@ fn client_handshake_succeeds() { // Connect to the client socket and perform a handshake. let mut stream = UnixStream::connect(&client_socket).expect("should connect to client socket"); - // Send Hello with version 5, 80 cols, 24 rows. + // Send Hello with version 6, 80 cols, 24 rows. let (version, error) = - client_handshake(&mut stream, 5, 80, 24).expect("handshake should succeed"); + client_handshake(&mut stream, 6, 80, 24).expect("handshake should succeed"); - assert_eq!(version, 5, "server should report protocol version 5"); + assert_eq!(version, 6, "server should report protocol version 6"); assert!( error.is_none(), "handshake should not have an error: {:?}", @@ -616,7 +616,7 @@ fn client_handshake_rejects_incompatible_version() { let (version, error) = client_handshake(&mut stream, 0, 80, 24) .expect("should read Welcome response even on rejection"); - assert_eq!(version, 5, "server should report its version 5"); + assert_eq!(version, 6, "server should report its version 6"); assert!( error.is_some(), "version 0 should be rejected with an error" @@ -641,10 +641,10 @@ fn client_handshake_clamps_small_terminal_size() { // Send Hello with 0x0 terminal size — should be clamped. let mut stream = UnixStream::connect(&client_socket).expect("should connect to client socket"); - let (version, error) = client_handshake(&mut stream, 5, 0, 0) + let (version, error) = client_handshake(&mut stream, 6, 0, 0) .expect("handshake with 0x0 should succeed (server clamps)"); - assert_eq!(version, 5); + assert_eq!(version, 6); assert!( error.is_none(), "0x0 size should be accepted (clamped): {:?}", @@ -704,9 +704,9 @@ fn no_hello_client_closed_within_five_seconds() { // Verify the server is still healthy — a proper client can still connect. let mut good_stream = UnixStream::connect(&client_socket).expect("should connect after no-hello client"); - let (version, error) = client_handshake(&mut good_stream, 5, 80, 24) + let (version, error) = client_handshake(&mut good_stream, 6, 80, 24) .expect("proper handshake should still work after no-hello client"); - assert_eq!(version, 5); + assert_eq!(version, 6); assert!(error.is_none()); // API should still work. |
