test(tui): add stalled-pane + tiny-terminal render tests
Some checks failed
CI / rust (pull_request) Has been cancelled
CI / markdown (pull_request) Has been cancelled
CI / port (pull_request) Has been cancelled
CI / agent-jail-pkgs (pull_request) Has been cancelled

Two more TestBackend render tests on top of the connecting/populated/empty set:
- render_stalled_pane_shows_warning_icon — covers the distinct stalled branch
  (state_icon → ⚠), which the healthy-Working test (●) didn't exercise.
- render_does_not_panic_on_tiny_terminal — renders at 20x5 to guard against
  cramped-layout panics (a classic ratatui footgun).

10 tests pass; fmt clean.
This commit is contained in:
Sam & Claude 2026-06-24 14:45:30 +02:00
parent ac0a77c82c
commit 57e3f30f9c

View file

@ -810,4 +810,53 @@ mod tests {
// Must not have panicked; content is fine either way
let _ = text;
}
#[test]
fn render_stalled_pane_shows_warning_icon() {
// Stalled is a distinct render branch (state_icon → "⚠", magenta).
let snap = GlasspaneSnapshot::new(
"osa",
"2026-06-24T12:00:00Z",
vec![colibri_glasspane::Pane {
id: "pane-stalled".into(),
agent: "zot".into(),
state: AgentState::Working,
session_id: Some("s1".into()),
last_event_at: Some("2026-06-24T12:00:01Z".into()),
cwd: Some("/home/clawdie".into()),
stalled: true,
}],
);
let mut app = App::new(PathBuf::from("/tmp/nonexistent.sock"));
app.snapshot = Some(snap);
app.rebuild_session_list();
let text = render_text(&mut app, 80, 24);
assert!(text.contains("pane-stalled"), "expected pane id in: {text}");
// Stalled icon is ⚠ (not the ● of a healthy Working pane).
assert!(text.contains(""), "expected stalled icon in: {text}");
}
#[test]
fn render_does_not_panic_on_tiny_terminal() {
// Cramped layouts are a classic ratatui panic source — the draw must
// still succeed (render_text's .expect would fail if it panicked).
let snap = GlasspaneSnapshot::new(
"osa",
"2026-06-24T12:00:00Z",
vec![colibri_glasspane::Pane {
id: "p".into(),
agent: "zot".into(),
state: AgentState::Working,
session_id: Some("s1".into()),
last_event_at: None,
cwd: None,
stalled: false,
}],
);
let mut app = App::new(PathBuf::from("/tmp/nonexistent.sock"));
app.snapshot = Some(snap);
app.rebuild_session_list();
let _ = render_text(&mut app, 20, 5);
}
}