21 lines
790 B
Rust
21 lines
790 B
Rust
// file: crates/engines/engine-v1-common/unit_tests/input.rs
|
|
// version: 2
|
|
|
|
#[test]
|
|
fn action_state_is_independent() {
|
|
game_logging_lib::with_test_tracing("action_state_is_independent", || {
|
|
let input = crate::InputState::none().with_action(crate::GameAction::Primary, true);
|
|
assert!(input.is_active(crate::GameAction::Primary));
|
|
assert!(!input.is_active(crate::GameAction::Secondary));
|
|
assert!(!input.is_active(crate::GameAction::Left));
|
|
});
|
|
}
|
|
|
|
#[test]
|
|
fn pointer_state_is_carried_independently_from_actions() {
|
|
let pointer = crate::PointerState::normalized(true, 0.25, 0.75);
|
|
let input = crate::InputState::none().with_pointer(pointer);
|
|
assert_eq!(input.pointer(), pointer);
|
|
assert!(!input.is_active(crate::GameAction::Primary));
|
|
}
|