0.1.0-0-pre.8
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/engines/engine-v1-common/unit_tests/input.rs
|
||||
// version: 1
|
||||
// version: 2
|
||||
|
||||
#[test]
|
||||
fn action_state_is_independent() {
|
||||
@@ -10,3 +10,11 @@ fn action_state_is_independent() {
|
||||
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));
|
||||
}
|
||||
|
||||
10
crates/engines/engine-v1-common/unit_tests/pointer.rs
Normal file
10
crates/engines/engine-v1-common/unit_tests/pointer.rs
Normal file
@@ -0,0 +1,10 @@
|
||||
// file: crates/engines/engine-v1-common/unit_tests/pointer.rs
|
||||
// version: 1
|
||||
|
||||
#[test]
|
||||
fn normalized_pointer_clamps_coordinates() {
|
||||
let pointer = crate::PointerState::normalized(true, -0.5, 1.5);
|
||||
assert!(pointer.active());
|
||||
assert_eq!(pointer.x(), 0.0);
|
||||
assert_eq!(pointer.y(), 1.0);
|
||||
}
|
||||
Reference in New Issue
Block a user