@@ -2096,7 +2096,6 @@ public void Actions_WithMultipleBoundControls_DriveInteractionsFromControlWithGr
20962096 }
20972097 }
20982098
2099- [ Preserve ]
21002099 private class ReleaseOnlyTestInteraction : IInputInteraction < float >
21012100 {
21022101 private bool m_WaitingForRelease ;
@@ -3465,7 +3464,6 @@ public void Actions_IncompatibleProcessorIsIgnored()
34653464 }
34663465
34673466 // ReSharper disable once ClassNeverInstantiated.Local
3468- [ Preserve ]
34693467 private class ConstantVector2TestProcessor : InputProcessor < Vector2 >
34703468 {
34713469 public override Vector2 Process ( Vector2 value , InputControl control )
@@ -3948,7 +3946,6 @@ public void Actions_CanFindEnabledActions()
39483946 }
39493947
39503948 // ReSharper disable once ClassNeverInstantiated.Local
3951- [ Preserve ]
39523949 private class TestInteraction : IInputInteraction
39533950 {
39543951#pragma warning disable CS0649
@@ -6287,7 +6284,6 @@ public void Actions_RegisteringExistingCompositeUnderNewName_CreatesAlias()
62876284 #endif // UNITY_EDITOR
62886285
62896286 #pragma warning disable CS0649
6290- [ Preserve ]
62916287 private class CompositeWithParameters : InputBindingComposite < float >
62926288 {
62936289 public int intParameter ;
@@ -6868,7 +6864,6 @@ public void Actions_CanCreateComposite_WithPartsBeingOutOfOrder()
68686864 }
68696865 }
68706866
6871- [ Preserve ]
68726867 private class LogInteraction : IInputInteraction
68736868 {
68746869 public void Process ( ref InputInteractionContext context )
@@ -7254,7 +7249,6 @@ public void Actions_CompositesInDifferentMapsTiedToSameControlsWork()
72547249 LogAssert . NoUnexpectedReceived ( ) ;
72557250 }
72567251
7257- [ Preserve ]
72587252 private class CompositeWithVector2Part : InputBindingComposite < Vector2 >
72597253 {
72607254 [ InputControlAttribute ( layout = "Vector2" ) ]
@@ -7288,7 +7282,6 @@ public void Actions_CanCreateCompositeWithVector2PartBinding()
72887282 }
72897283 }
72907284
7291- [ Preserve ]
72927285 private class CompositeAskingForSourceControl : InputBindingComposite < float >
72937286 {
72947287 [ InputControl ( layout = "Button" ) ]
@@ -8330,28 +8323,27 @@ public void Actions_ExceptionsInCallbacksAreCaughtAndLogged()
83308323 map . actionTriggered += ctx => { throw new InvalidOperationException ( "TEST EXCEPTION FROM MAP" ) ; } ;
83318324 action . Enable ( ) ;
83328325
8326+ LogAssert . Expect ( LogType . Exception , new Regex ( ".*TEST EXCEPTION FROM MAP.*" ) ) ;
83338327 LogAssert . Expect ( LogType . Error ,
83348328 new Regex (
83358329 ".*InvalidOperationException while executing 'started' callbacks of 'testMap'" ) ) ;
8336- LogAssert . Expect ( LogType . Exception , new Regex ( ".*TEST EXCEPTION FROM MAP.*" ) ) ;
83378330
8331+ LogAssert . Expect ( LogType . Exception , new Regex ( ".*TEST EXCEPTION FROM ACTION.*" ) ) ;
83388332 LogAssert . Expect ( LogType . Error ,
83398333 new Regex (
83408334 ".*InvalidOperationException while executing 'performed' callbacks of 'testMap/testAction.*'" ) ) ;
8341- LogAssert . Expect ( LogType . Exception , new Regex ( ".*TEST EXCEPTION FROM ACTION.*" ) ) ;
83428335
8336+ LogAssert . Expect ( LogType . Exception , new Regex ( ".*TEST EXCEPTION FROM MAP.*" ) ) ;
83438337 LogAssert . Expect ( LogType . Error ,
83448338 new Regex (
83458339 ".*InvalidOperationException while executing 'performed' callbacks of 'testMap'" ) ) ;
8346- LogAssert . Expect ( LogType . Exception , new Regex ( ".*TEST EXCEPTION FROM MAP.*" ) ) ;
83478340
83488341 InputSystem . QueueStateEvent ( gamepad , new GamepadState ( ) . WithButton ( GamepadButton . South ) ) ;
83498342 InputSystem . Update ( ) ;
83508343
83518344 LogAssert . NoUnexpectedReceived ( ) ;
83528345 }
83538346
8354- [ Preserve ]
83558347 class TestInteractionCheckingDefaultState : IInputInteraction
83568348 {
83578349 public void Process ( ref InputInteractionContext context )
@@ -8800,6 +8792,41 @@ public void Actions_CanResetAction()
88008792 }
88018793 }
88028794
8795+ // Corresponds to bug report ticket 1370732.
8796+ [ Test ]
8797+ [ Category ( "Actions" ) ]
8798+ public void Actions_ResetShouldPreserveEnabledState__IfResetWhileInDisabledState ( )
8799+ {
8800+ var gamepad = InputSystem . AddDevice < Gamepad > ( ) ;
8801+
8802+ InputSystem . settings . defaultDeadzoneMin = 0 ;
8803+ InputSystem . settings . defaultDeadzoneMax = 1 ;
8804+
8805+ var action = new InputAction ( type : InputActionType . Value , binding : "<Gamepad>/leftStick" ) ;
8806+ action . Enable ( ) ;
8807+ Assert . That ( action . enabled , Is . True ) ;
8808+
8809+ action . Disable ( ) ;
8810+ Assert . That ( action . enabled , Is . False ) ;
8811+
8812+ action . Reset ( ) ;
8813+ Assert . That ( action . enabled , Is . False ) ;
8814+
8815+ action . Enable ( ) ;
8816+ Assert . That ( action . enabled , Is . True ) ;
8817+
8818+ using ( var trace = new InputActionTrace ( action ) )
8819+ {
8820+ Set ( gamepad . leftStick , new Vector2 ( 0.2f , 0.3f ) ) ;
8821+
8822+ Assert . That ( action . inProgress , Is . True ) ;
8823+ Assert . That ( action . ReadValue < Vector2 > ( ) , Is . EqualTo ( new Vector2 ( 0.2f , 0.3f ) ) ) ;
8824+ Assert . That ( trace ,
8825+ Started ( action , value : new Vector2 ( 0.2f , 0.3f ) )
8826+ . AndThen ( Performed ( action , value : new Vector2 ( 0.2f , 0.3f ) ) ) ) ;
8827+ }
8828+ }
8829+
88038830 private class MonoBehaviourWithActionProperty : MonoBehaviour
88048831 {
88058832 public InputActionProperty actionProperty ;
0 commit comments