diff --git a/Packages/com.unity.inputsystem/CHANGELOG.md b/Packages/com.unity.inputsystem/CHANGELOG.md index c9d9617a8b..0fd3856d05 100644 --- a/Packages/com.unity.inputsystem/CHANGELOG.md +++ b/Packages/com.unity.inputsystem/CHANGELOG.md @@ -15,6 +15,7 @@ however, it has to be formatted properly to pass verification tests. ### Fixed - Fixed UI clicks not registering when OS provides multiple input sources for the same event, e.g. on Samsung Dex (case ISX-1416, ISXB-342). +- Fixed unstable integration test `Integration_CanSendAndReceiveEvents` by ignoring application focus on integration tests. (case ISX-1381) ## [1.6.1] - 2023-05-26 diff --git a/Packages/com.unity.inputsystem/Tests/IntegrationTests/IntegrationTests.cs b/Packages/com.unity.inputsystem/Tests/IntegrationTests/IntegrationTests.cs index 191040ab27..8d45a2e76e 100644 --- a/Packages/com.unity.inputsystem/Tests/IntegrationTests/IntegrationTests.cs +++ b/Packages/com.unity.inputsystem/Tests/IntegrationTests/IntegrationTests.cs @@ -68,6 +68,22 @@ public static void PreserveMethods() var dummy = new System.ComponentModel.StringConverter(); } + [SetUp] + public virtual void Setup() + { + // The standalone player can go out of focus when running tests. This makes the devices added during tests set + // as disabled. Which in turn makes the InputSystem update not process input state changes for devices. + // By ignoring focus, we can protect ourselves against this and always update the device state in the standalone + // test players + InputSystem.settings.backgroundBehavior = InputSettings.BackgroundBehavior.IgnoreFocus; + } + + [TearDown] + public virtual void TearDown() + { + InputSystem.settings.backgroundBehavior = default; + } + [Test] [Category("Integration")] public void Integration_CanSendAndReceiveEvents()