aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-utils/src/ipc/tests/roundtrip_tests.rs
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2026-04-28 17:14:59 +0200
committerGitHub <noreply@github.com>2026-04-28 17:14:59 +0200
commit227142dd567ee72bcc137c116bc1ce2b818975e7 (patch)
tree8958a994dddb80bf20ce1e6bf2694687736b0b19 /zellij-utils/src/ipc/tests/roundtrip_tests.rs
parentupgrade rustls-webpki (#5106) (diff)
downloadsl0ppij-227142dd567ee72bcc137c116bc1ce2b818975e7.tar.gz
sl0ppij-227142dd567ee72bcc137c116bc1ce2b818975e7.tar.xz
sl0ppij-227142dd567ee72bcc137c116bc1ce2b818975e7.zip
Support CSI2031 (dark/light theme switching) + remove STDIN cache to avoid stale color queries (#5105)
* initial phase 1 implementation * various fies * some fixes * fix fragmented stdin cases * some fixes * renaming * guard against old clients * implement csi 2031 * allow toggling theme with actions * rustfmt * fix: finalize trailing characters in ansi parser as well * add pr
Diffstat (limited to 'zellij-utils/src/ipc/tests/roundtrip_tests.rs')
-rw-r--r--zellij-utils/src/ipc/tests/roundtrip_tests.rs49
1 files changed, 46 insertions, 3 deletions
diff --git a/zellij-utils/src/ipc/tests/roundtrip_tests.rs b/zellij-utils/src/ipc/tests/roundtrip_tests.rs
index 23b8c4ac..4847b679 100644
--- a/zellij-utils/src/ipc/tests/roundtrip_tests.rs
+++ b/zellij-utils/src/ipc/tests/roundtrip_tests.rs
@@ -1,8 +1,8 @@
use super::test_framework::*;
use crate::data::{
- BareKey, CommandOrPlugin, ConnectToSession, Direction, FloatingPaneCoordinates, InputMode,
- KeyModifier, KeyWithModifier, LayoutInfo, LayoutMetadata, NewPanePlacement, OriginatingPlugin,
- PaneId, PluginTag, Resize, WebSharing,
+ BareKey, CommandOrPlugin, ConnectToSession, Direction, FloatingPaneCoordinates,
+ HostTerminalThemeMode, InputMode, KeyModifier, KeyWithModifier, LayoutInfo, LayoutMetadata,
+ NewPanePlacement, OriginatingPlugin, PaneId, PluginTag, Resize, WebSharing,
};
use crate::input::actions::{Action, SearchDirection, SearchOption};
use crate::input::cli_assets::CliAssets;
@@ -433,6 +433,8 @@ fn test_client_messages() {
configuration_options: Some(Options {
simplified_ui: Some(true),
theme: Some("theme".to_owned()),
+ theme_dark: Some("theme_dark".to_owned()),
+ theme_light: Some("theme_light".to_owned()),
default_mode: Some(InputMode::Normal),
default_shell: Some(PathBuf::from("default_shell")),
default_cwd: Some(PathBuf::from("default_cwd")),
@@ -3538,6 +3540,35 @@ fn test_client_messages() {
client_id: Some(100),
is_cli_client: true,
});
+ test_client_roundtrip!(ClientToServerMsg::ForwardedReplyFromHost {
+ token: 0,
+ reply_bytes: vec![],
+ });
+ test_client_roundtrip!(ClientToServerMsg::ForwardedReplyFromHost {
+ token: 42,
+ reply_bytes: b"\x1b]11;rgb:ffff/ffff/ffff\x1b\\".to_vec(),
+ });
+ test_client_roundtrip!(ClientToServerMsg::ForwardedReplyFromHost {
+ token: u32::MAX,
+ reply_bytes: (0u8..=255u8).collect(),
+ });
+ // Guard against protobuf string-vs-bytes encoding regressions: a
+ // payload mixing NULs, ESC, and CSI framing must round-trip
+ // byte-for-byte or the pane will receive corrupt terminal data.
+ test_client_roundtrip!(ClientToServerMsg::ForwardedReplyFromHost {
+ token: 17,
+ reply_bytes: vec![
+ 0x00, 0x1b, b'[', b'?', b'6', b'2', b';', b'1', b';', b'6', b'c', 0x00, 0x1b, b']',
+ b'1', b'1', b';', b'r', b'g', b'b', b':', b'f', b'f', b'f', b'f', b'/', b'f', b'f',
+ b'f', b'f', b'/', b'f', b'f', b'f', b'f', 0x07, 0xff, 0x00,
+ ],
+ });
+ test_client_roundtrip!(ClientToServerMsg::HostTerminalThemeChanged {
+ mode: HostTerminalThemeMode::Dark,
+ });
+ test_client_roundtrip!(ClientToServerMsg::HostTerminalThemeChanged {
+ mode: HostTerminalThemeMode::Light,
+ });
}
fn test_server_messages() {
@@ -3673,6 +3704,18 @@ fn test_server_messages() {
test_server_roundtrip!(ServerToClientMsg::SubscribedPaneClosed {
pane_id: PaneId::Plugin(3),
});
+ test_server_roundtrip!(ServerToClientMsg::ForwardQueryToHost {
+ token: 0,
+ query_bytes: vec![],
+ });
+ test_server_roundtrip!(ServerToClientMsg::ForwardQueryToHost {
+ token: 7,
+ query_bytes: b"\x1b[14t".to_vec(),
+ });
+ test_server_roundtrip!(ServerToClientMsg::ForwardQueryToHost {
+ token: u32::MAX,
+ query_bytes: (0u8..=255u8).collect(),
+ });
}
#[test]