diff options
Diffstat (limited to 'src/ui.rs')
| -rw-r--r-- | src/ui.rs | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -170,7 +170,7 @@ fn compute_view_internal( resize_panes: bool, cell_size: crate::kitty_graphics::HostCellSize, ) { - if is_mobile_width(area) { + if is_mobile_width(area, app.mobile_width_threshold) { compute_mobile_view(app, terminal_runtimes, area, resize_panes, cell_size); return; } @@ -544,6 +544,24 @@ mod tests { } #[test] + fn configured_mobile_width_threshold_controls_layout_switch() { + let mut app = crate::app::state::AppState::test_new(); + app.workspaces = vec![Workspace::test_new("one")]; + app.active = Some(0); + app.selected = 0; + app.mode = Mode::Terminal; + + compute_view(&mut app, Rect::new(0, 0, 80, 20)); + assert_eq!(app.view.layout, ViewLayout::Desktop); + + app.mobile_width_threshold = 90; + compute_view(&mut app, Rect::new(0, 0, 80, 20)); + assert_eq!(app.view.layout, ViewLayout::Mobile); + assert_eq!(app.view.mobile_header_rect, Rect::new(0, 0, 80, 2)); + assert_eq!(app.view.terminal_area, Rect::new(0, 2, 80, 18)); + } + + #[test] fn product_announcement_renders_above_config_diagnostic() { let mut app = crate::app::state::AppState::test_new(); app.workspaces = vec![Workspace::test_new("one")]; |
