Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
100-TomatoJuice committed Oct 11, 2023
1 parent ce4d03e commit e1c69c8
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions tests/gamepad_axis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ fn game_pad_dual_axis_cross() {
app.send_input(DualAxis::from_value(
GamepadAxisType::LeftStickX,
GamepadAxisType::LeftStickY,
0.1,
0.05,
0.04,
0.04,
));

app.update();
Expand All @@ -330,18 +330,18 @@ fn game_pad_dual_axis_cross() {
app.send_input(DualAxis::from_value(
GamepadAxisType::LeftStickX,
GamepadAxisType::LeftStickY,
0.06,
0.06,
0.1,
0.05,
));

app.update();

let action_state = app.world.resource::<ActionState<AxislikeTestAction>>();
assert!(action_state.pressed(AxislikeTestAction::XY));
assert_eq!(action_state.value(AxislikeTestAction::XY), 0.084852815);
assert_eq!(action_state.value(AxislikeTestAction::XY), 0.111803405);
assert_eq!(
action_state.axis_pair(AxislikeTestAction::XY).unwrap(),
DualAxisData::new(0.06, 0.06)
DualAxisData::new(0.1, 0.05)
);
}

Expand All @@ -360,8 +360,8 @@ fn game_pad_dual_axis_rect() {
app.send_input(DualAxis::from_value(
GamepadAxisType::LeftStickX,
GamepadAxisType::LeftStickY,
0.1,
0.1,
0.05,
0.05,
));

app.update();
Expand All @@ -379,17 +379,17 @@ fn game_pad_dual_axis_rect() {
GamepadAxisType::LeftStickX,
GamepadAxisType::LeftStickY,
0.1,
0.2,
0.1,
));

app.update();

let action_state = app.world.resource::<ActionState<AxislikeTestAction>>();
assert!(action_state.pressed(AxislikeTestAction::XY));
assert_eq!(action_state.value(AxislikeTestAction::XY), 0.22360681);
assert_eq!(action_state.value(AxislikeTestAction::XY), 0.14142136);
assert_eq!(
action_state.axis_pair(AxislikeTestAction::XY).unwrap(),
DualAxisData::new(0.1, 0.2)
DualAxisData::new(0.1, 0.1)
);
}

Expand Down Expand Up @@ -427,17 +427,17 @@ fn game_pad_dual_axis_ellipse() {
GamepadAxisType::LeftStickX,
GamepadAxisType::LeftStickY,
0.1,
0.1,
0.0,
));

app.update();

let action_state = app.world.resource::<ActionState<AxislikeTestAction>>();
assert!(action_state.pressed(AxislikeTestAction::XY));
assert_eq!(action_state.value(AxislikeTestAction::XY), 0.14142136);
assert_eq!(action_state.value(AxislikeTestAction::XY), 0.1);
assert_eq!(
action_state.axis_pair(AxislikeTestAction::XY).unwrap(),
DualAxisData::new(0.1, 0.1)
DualAxisData::new(0.1, 0.0)
);
}

Expand Down

0 comments on commit e1c69c8

Please sign in to comment.