use super::parse_quick_toggle_key;
use evdev::KeyCode;

#[test]
fn parse_quick_toggle_key_supports_letters_digits_and_function_keys() {
    assert_eq!(parse_quick_toggle_key("a"), Some(KeyCode::KEY_A));
    assert_eq!(parse_quick_toggle_key("7"), Some(KeyCode::KEY_7));
    assert_eq!(parse_quick_toggle_key("f12"), Some(KeyCode::KEY_F12));
    assert_eq!(parse_quick_toggle_key("F3"), Some(KeyCode::KEY_F3));
}

#[test]
fn parse_quick_toggle_key_supports_navigation_and_special_aliases() {
    assert_eq!(parse_quick_toggle_key("page_up"), Some(KeyCode::KEY_PAGEUP));
    assert_eq!(parse_quick_toggle_key("delete"), Some(KeyCode::KEY_DELETE));
    assert_eq!(parse_quick_toggle_key("spacebar"), Some(KeyCode::KEY_SPACE));
    assert_eq!(
        parse_quick_toggle_key("print-screen"),
        Some(KeyCode::KEY_SYSRQ)
    );
}

#[test]
fn parse_quick_toggle_key_can_disable_or_fall_back() {
    assert_eq!(parse_quick_toggle_key("off"), None);
    assert_eq!(
        parse_quick_toggle_key("totally-unknown"),
        Some(KeyCode::KEY_PAUSE)
    );
}
