From 1fe9af68f248687604c6ecb5703e0fde2fcdeef5 Mon Sep 17 00:00:00 2001 From: Tomato <67799071+100-TomatoJuice@users.noreply.github.com> Date: Wed, 11 Oct 2023 15:55:53 -0700 Subject: [PATCH 1/5] Change livezone default --- crates/bevy_input/src/gamepad.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/bevy_input/src/gamepad.rs b/crates/bevy_input/src/gamepad.rs index b3356544d8634..eca1243034692 100644 --- a/crates/bevy_input/src/gamepad.rs +++ b/crates/bevy_input/src/gamepad.rs @@ -631,10 +631,10 @@ pub struct AxisSettings { impl Default for AxisSettings { fn default() -> Self { AxisSettings { - livezone_upperbound: 0.95, + livezone_upperbound: 1.0, deadzone_upperbound: 0.05, deadzone_lowerbound: -0.05, - livezone_lowerbound: -0.95, + livezone_lowerbound: -1.0, threshold: 0.01, } } From d305f44026bda3148ddc08b1790332cbc853228b Mon Sep 17 00:00:00 2001 From: Tomato <67799071+100-TomatoJuice@users.noreply.github.com> Date: Wed, 11 Oct 2023 17:29:05 -0700 Subject: [PATCH 2/5] update gamepad tests --- crates/bevy_input/src/gamepad.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/crates/bevy_input/src/gamepad.rs b/crates/bevy_input/src/gamepad.rs index eca1243034692..b728cd2351400 100644 --- a/crates/bevy_input/src/gamepad.rs +++ b/crates/bevy_input/src/gamepad.rs @@ -1504,9 +1504,9 @@ mod tests { fn test_axis_settings_default_filter() { let cases = [ (1.0, Some(1.0)), - (0.99, Some(1.0)), - (0.96, Some(1.0)), - (0.95, Some(1.0)), + (0.99, Some(0.99)), + (0.96, Some(0.96)), + (0.95, Some(0.95)), (0.9499, Some(0.9499)), (0.84, Some(0.84)), (0.43, Some(0.43)), @@ -1516,9 +1516,9 @@ mod tests { (0.01, Some(0.0)), (0.0, Some(0.0)), (-1.0, Some(-1.0)), - (-0.99, Some(-1.0)), - (-0.96, Some(-1.0)), - (-0.95, Some(-1.0)), + (-0.99, Some(-0.99)), + (-0.96, Some(-0.96)), + (-0.95, Some(-0.95)), (-0.9499, Some(-0.9499)), (-0.84, Some(-0.84)), (-0.43, Some(-0.43)), @@ -1544,7 +1544,7 @@ mod tests { (0.43, Some(0.17), Some(0.43)), (0.43, Some(0.84), Some(0.43)), (0.05, Some(0.055), Some(0.0)), - (0.95, Some(0.945), Some(1.0)), + (0.95, Some(0.945), None), (-0.43, Some(-0.44001), Some(-0.43)), (-0.43, Some(-0.44), None), (-0.43, Some(-0.43), None), @@ -1552,7 +1552,7 @@ mod tests { (-0.43, Some(-0.17), Some(-0.43)), (-0.43, Some(-0.84), Some(-0.43)), (-0.05, Some(-0.055), Some(0.0)), - (-0.95, Some(-0.945), Some(-1.0)), + (-0.95, Some(-0.945), None), ]; for (new_value, old_value, expected) in cases { From 43f1798b41c6ac3b6066fd1183c66ca8edbf6549 Mon Sep 17 00:00:00 2001 From: Tomato <67799071+100-TomatoJuice@users.noreply.github.com> Date: Wed, 11 Oct 2023 20:32:34 -0700 Subject: [PATCH 3/5] Revert "update gamepad tests" This reverts commit d305f44026bda3148ddc08b1790332cbc853228b. --- crates/bevy_input/src/gamepad.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/crates/bevy_input/src/gamepad.rs b/crates/bevy_input/src/gamepad.rs index b728cd2351400..eca1243034692 100644 --- a/crates/bevy_input/src/gamepad.rs +++ b/crates/bevy_input/src/gamepad.rs @@ -1504,9 +1504,9 @@ mod tests { fn test_axis_settings_default_filter() { let cases = [ (1.0, Some(1.0)), - (0.99, Some(0.99)), - (0.96, Some(0.96)), - (0.95, Some(0.95)), + (0.99, Some(1.0)), + (0.96, Some(1.0)), + (0.95, Some(1.0)), (0.9499, Some(0.9499)), (0.84, Some(0.84)), (0.43, Some(0.43)), @@ -1516,9 +1516,9 @@ mod tests { (0.01, Some(0.0)), (0.0, Some(0.0)), (-1.0, Some(-1.0)), - (-0.99, Some(-0.99)), - (-0.96, Some(-0.96)), - (-0.95, Some(-0.95)), + (-0.99, Some(-1.0)), + (-0.96, Some(-1.0)), + (-0.95, Some(-1.0)), (-0.9499, Some(-0.9499)), (-0.84, Some(-0.84)), (-0.43, Some(-0.43)), @@ -1544,7 +1544,7 @@ mod tests { (0.43, Some(0.17), Some(0.43)), (0.43, Some(0.84), Some(0.43)), (0.05, Some(0.055), Some(0.0)), - (0.95, Some(0.945), None), + (0.95, Some(0.945), Some(1.0)), (-0.43, Some(-0.44001), Some(-0.43)), (-0.43, Some(-0.44), None), (-0.43, Some(-0.43), None), @@ -1552,7 +1552,7 @@ mod tests { (-0.43, Some(-0.17), Some(-0.43)), (-0.43, Some(-0.84), Some(-0.43)), (-0.05, Some(-0.055), Some(0.0)), - (-0.95, Some(-0.945), None), + (-0.95, Some(-0.945), Some(-1.0)), ]; for (new_value, old_value, expected) in cases { From b001a93f31e01316ac5021181354e18f1319e64b Mon Sep 17 00:00:00 2001 From: Tomato <67799071+100-TomatoJuice@users.noreply.github.com> Date: Wed, 11 Oct 2023 21:01:05 -0700 Subject: [PATCH 4/5] use past default values for test --- crates/bevy_input/src/gamepad.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/bevy_input/src/gamepad.rs b/crates/bevy_input/src/gamepad.rs index eca1243034692..27f2912278cea 100644 --- a/crates/bevy_input/src/gamepad.rs +++ b/crates/bevy_input/src/gamepad.rs @@ -1501,7 +1501,7 @@ mod tests { } #[test] - fn test_axis_settings_default_filter() { + fn test_axis_settings_filter() { let cases = [ (1.0, Some(1.0)), (0.99, Some(1.0)), @@ -1529,13 +1529,13 @@ mod tests { ]; for (new_value, expected) in cases { - let settings = AxisSettings::default(); + let settings = AxisSettings::new(-0.95, -0.05, 0.05, 0.95, 0.01).unwrap(); test_axis_settings_filter(settings, new_value, None, expected); } } #[test] - fn test_axis_settings_default_filter_with_old_values() { + fn test_axis_settings_filter_with_old_values() { let cases = [ (0.43, Some(0.44001), Some(0.43)), (0.43, Some(0.44), None), @@ -1556,7 +1556,7 @@ mod tests { ]; for (new_value, old_value, expected) in cases { - let settings = AxisSettings::default(); + let settings = AxisSettings::new(-0.95, -0.05, 0.05, 0.95, 0.01).unwrap(); test_axis_settings_filter(settings, new_value, old_value, expected); } } From d01aeca06fc1fb4537f3e15ac3e56529bf3be0d0 Mon Sep 17 00:00:00 2001 From: Tomato <67799071+100-TomatoJuice@users.noreply.github.com> Date: Wed, 11 Oct 2023 21:06:09 -0700 Subject: [PATCH 5/5] add default back to name --- crates/bevy_input/src/gamepad.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/bevy_input/src/gamepad.rs b/crates/bevy_input/src/gamepad.rs index 27f2912278cea..96ab125fa2907 100644 --- a/crates/bevy_input/src/gamepad.rs +++ b/crates/bevy_input/src/gamepad.rs @@ -1501,7 +1501,7 @@ mod tests { } #[test] - fn test_axis_settings_filter() { + fn test_axis_settings_default_filter() { let cases = [ (1.0, Some(1.0)), (0.99, Some(1.0)), @@ -1535,7 +1535,7 @@ mod tests { } #[test] - fn test_axis_settings_filter_with_old_values() { + fn test_axis_settings_default_filter_with_old_values() { let cases = [ (0.43, Some(0.44001), Some(0.43)), (0.43, Some(0.44), None),