Update tests

This commit is contained in:
2025-02-14 20:07:31 +00:00
parent 518ada8f3e
commit eaa86e14ba
5 changed files with 22 additions and 4 deletions

View File

@@ -60,3 +60,19 @@ impl SdlKeyboardAdapter {
}
}
#[cfg(test)]
mod tests{
use crate::device::keyboard::Key;
use super::SdlKeyboardAdapter;
#[test]
fn test_keycode_to_key(){
assert_eq!(Some(Key::K7), SdlKeyboardAdapter::keycode_to_key(sdl2::keyboard::Keycode::A));
}
#[test]
fn test_keycode_to_key_no_key(){
assert_eq!(None, SdlKeyboardAdapter::keycode_to_key(sdl2::keyboard::Keycode::L));
}
}