use presentar_core::Rect;
#[test]
fn test_exploded_view_fills_terminal_width() {
let terminal_width = 120.0;
let terminal_height = 40.0;
let exploded_bounds = Rect::new(0.0, 1.0, terminal_width, terminal_height - 2.0);
assert_eq!(exploded_bounds.width, terminal_width);
assert!(exploded_bounds.height >= terminal_height - 2.0);
}
#[test]
fn test_exploded_view_is_exclusive() {
let is_exploded = true;
let other_panels_visible = !is_exploded;
assert!(
!other_panels_visible,
"Other panels must be hidden when exploded"
);
}
#[test]
fn test_exploded_view_supports_row_navigation() {
let selected_row: usize = 5;
let total_rows: usize = 100;
let next_row = (selected_row + 1).min(total_rows - 1);
let prev_row = selected_row.saturating_sub(1);
assert_eq!(next_row, 6);
assert_eq!(prev_row, 4);
}
#[test]
fn test_exploded_view_dismissable() {
let is_exploded = true;
let escape_pressed = true;
let should_collapse = is_exploded && escape_pressed;
assert!(should_collapse, "Escape must dismiss exploded view");
}
#[test]
fn test_panel_has_exploded_render() {
#[allow(dead_code)]
trait ExplodablePanel {
fn render_exploded(&self, bounds: Rect, canvas: &mut dyn std::any::Any);
fn exploded_title(&self) -> String;
fn exploded_row_count(&self) -> usize;
}
assert!(true, "ExplodablePanel trait interface defined");
}
#[test]
fn test_cpu_exploded_shows_all_cores() {
let core_count = 48;
let visible_in_exploded = 48;
assert_eq!(
visible_in_exploded, core_count,
"All cores must be visible in exploded"
);
}
#[test]
fn test_memory_exploded_shows_full_breakdown() {
let sections = [
"Used",
"Cached",
"Free",
"Swap",
"ZRAM",
"Pressure",
"TopProcesses",
"Trend",
];
assert!(
sections.len() >= 6,
"Memory exploded needs comprehensive sections"
);
}
#[test]
fn test_exploded_uses_framework_widgets() {
let required_widgets = [
"RowHighlight",
"MicroHeatBar",
"HeatScheme",
"Sparkline",
"format_bytes_si",
"format_percent",
];
assert_eq!(required_widgets.len(), 6, "Framework widgets required");
}
#[test]
fn test_app_has_exploded_panel_field() {
#[derive(Debug, Clone, Copy, PartialEq)]
#[allow(dead_code)]
enum PanelType {
Cpu,
Memory,
Disk,
Network,
Gpu,
Sensors,
Battery,
Psi,
Process,
Connections,
Files,
Containers,
}
let exploded_panel: Option<PanelType> = Some(PanelType::Cpu);
assert!(exploded_panel.is_some(), "App must track exploded panel");
}
#[test]
fn test_tab_toggles_exploded() {
let focused_panel = 0; let is_exploded = false;
let tab_pressed = true;
let new_exploded_state = if tab_pressed {
!is_exploded
} else {
is_exploded
};
assert!(new_exploded_state, "Tab must toggle exploded state");
}
#[test]
fn test_exploded_preserves_scroll() {
let scroll_before_explode = 10;
let scroll_in_exploded = 25;
let scroll_after_collapse = scroll_before_explode;
assert_eq!(
scroll_after_collapse, 10,
"Scroll must be preserved across explode/collapse"
);
}