aboutsummaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-05-12 15:54:19 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-05-12 15:54:19 +0300
commit4af28fbb6551cd33596096af422895c1998fa3e8 (patch)
tree06d92a8a1cf53a2d85129f0e6d3e9701a75eda1b /src/app
parent8375922c069a244133d083a0bb50273e134be6b1 (diff)
test: add ime input regressions
Diffstat (limited to 'src/app')
-rw-r--r--src/app/mod.rs50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/app/mod.rs b/src/app/mod.rs
index 43d15bec..7534559f 100644
--- a/src/app/mod.rs
+++ b/src/app/mod.rs
@@ -1979,6 +1979,56 @@ mod tests {
assert!(rx.try_recv().is_err());
}
+ #[tokio::test]
+ async fn route_client_input_forwards_multilingual_ime_text_to_focused_pane() {
+ let mut app = test_app();
+ let mut workspace = Workspace::test_new("test");
+ let focused = workspace.focused_pane_id().unwrap();
+ let text = "中日한🙂";
+ let (runtime, mut rx) =
+ PaneRuntime::test_with_channel_capacity(80, 24, text.chars().count());
+ workspace.tabs[0].runtimes.insert(focused, runtime);
+ app.state.workspaces = vec![workspace];
+ app.state.active = Some(0);
+ app.state.selected = 0;
+ app.state.mode = Mode::Terminal;
+
+ app.route_client_input(text.as_bytes().to_vec());
+
+ let mut forwarded = Vec::new();
+ for _ in text.chars() {
+ let chunk = rx.recv().await.unwrap();
+ forwarded.extend_from_slice(&chunk);
+ }
+ assert_eq!(forwarded, text.as_bytes());
+ assert!(rx.try_recv().is_err());
+ }
+
+ #[tokio::test]
+ async fn route_client_input_forwards_long_voice_like_cjk_text_without_truncation() {
+ let mut app = test_app();
+ let mut workspace = Workspace::test_new("test");
+ let focused = workspace.focused_pane_id().unwrap();
+ let text = "你好,今天我们测试一段比较长的语音输入。こんにちは。안녕하세요.🙂".repeat(64);
+ let char_count = text.chars().count();
+ let (runtime, mut rx) = PaneRuntime::test_with_channel_capacity(80, 24, char_count);
+ workspace.tabs[0].runtimes.insert(focused, runtime);
+ app.state.workspaces = vec![workspace];
+ app.state.active = Some(0);
+ app.state.selected = 0;
+ app.state.mode = Mode::Terminal;
+
+ app.route_client_input(text.as_bytes().to_vec());
+
+ let mut forwarded = Vec::new();
+ for _ in 0..char_count {
+ let chunk = rx.recv().await.unwrap();
+ forwarded.extend_from_slice(&chunk);
+ }
+ assert_eq!(forwarded, text.as_bytes());
+ assert!(rx.try_recv().is_err());
+ }
+
#[test]
fn route_client_input_handles_mouse_events() {
let mut app = test_app();