Skip to content

Commit 9b98aa6

Browse files
committed
test(runtime): cover finalize_splash restoring cursor visibility so the post-splash shell prompt gets a visible cursor, asserting an explicit hide is flipped back to shown via TestBackend's cursor-visibility debug output
1 parent 90f5abc commit 9b98aa6

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

‎src/runtime.rs‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1873,6 +1873,21 @@ mod tests {
18731873
assert!(joined.contains("via draw"));
18741874
}
18751875

1876+
#[test]
1877+
fn finalize_splash_shows_the_cursor_for_the_shell() {
1878+
// ratatui hides the cursor while drawing; `finalize_splash` must hand it back visible
1879+
// so the shell prompt printed after the splash gets one. `TestBackend` tracks cursor
1880+
// visibility in its `Debug` output, so an explicit hide followed by `finalize_splash`
1881+
// proves the show-cursor call is the thing that flips it back.
1882+
let backend = TestBackend::new(20, 3);
1883+
let mut terminal = make_terminal(backend, 3).unwrap();
1884+
terminal.hide_cursor().unwrap();
1885+
assert!(format!("{:?}", terminal.backend()).contains("cursor: false"));
1886+
1887+
finalize_splash(&mut terminal);
1888+
assert!(format!("{:?}", terminal.backend()).contains("cursor: true"));
1889+
}
1890+
18761891
#[test]
18771892
fn copy_rows_copies_vertical_slice() {
18781893
let mut src = Buffer::empty(Rect::new(0, 0, 4, 4));

0 commit comments

Comments
 (0)