use crate::tui::traits::{EventResult, Shortcut, ViewContext, ViewState};
use crossterm::event::{KeyEvent, MouseEvent};
#[allow(dead_code)]
pub struct SummaryView;
impl SummaryView {
#[allow(dead_code)]
pub(crate) const fn new() -> Self {
Self
}
}
impl Default for SummaryView {
fn default() -> Self {
Self::new()
}
}
impl ViewState for SummaryView {
fn handle_key(&mut self, _key: KeyEvent, _ctx: &mut ViewContext) -> EventResult {
EventResult::Ignored
}
fn handle_mouse(&mut self, _mouse: MouseEvent, _ctx: &mut ViewContext) -> EventResult {
EventResult::Ignored
}
fn title(&self) -> &'static str {
"Summary"
}
fn shortcuts(&self) -> Vec<Shortcut> {
vec![]
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::tui::traits::ViewMode;
use crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
#[test]
fn test_all_keys_ignored() {
let mut view = SummaryView::new();
let status: &'static mut Option<String> = Box::leak(Box::new(None));
let mut ctx = ViewContext {
mode: ViewMode::Diff,
focused: true,
width: 80,
height: 24,
tick: 0,
status_message: status,
};
let result = view.handle_key(
KeyEvent::new(KeyCode::Char('j'), KeyModifiers::NONE),
&mut ctx,
);
assert_eq!(result, EventResult::Ignored);
}
}