Skip to content

Commit

Permalink
Add test for fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nicopap committed Jan 16, 2023
1 parent 65880cc commit 15c9fcd
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion crates/bevy_input/src/gamepad.rs
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ impl ButtonSettings {
/// \ / ← All values are reported as -1.0
/// ----------- ← -1.0
/// ```
#[derive(Debug, Clone, Reflect, FromReflect)]
#[derive(Debug, Clone, Reflect, FromReflect, PartialEq)]
#[reflect(Debug, Default)]
pub struct AxisSettings {
/// Values that are higher than `livezone_upperbound` will be rounded up to -1.0.
Expand Down Expand Up @@ -1528,6 +1528,16 @@ mod tests {
#[test]
fn test_try_out_of_range_axis_settings() {
let mut axis_settings = AxisSettings::default();
assert_eq!(
AxisSettings::new(-0.95, -0.05, 0.05, 0.95, 0.001),
Ok(AxisSettings {
livezone_lowerbound: -0.95,
deadzone_lowerbound: -0.05,
deadzone_upperbound: 0.05,
livezone_upperbound: 0.95,
threshold: 0.001,
})
);
assert_eq!(
Err(AxisSettingsError::LiveZoneLowerBoundOutOfRange(-2.0)),
axis_settings.try_set_livezone_lowerbound(-2.0)
Expand Down

0 comments on commit 15c9fcd

Please sign in to comment.