From e017c289d0606011728cc178fb27bc991ab5c6a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Freire?= Date: Fri, 23 Jun 2023 13:51:58 +0200 Subject: [PATCH 1/2] Set background settings to ignore focus This makes the devices adding during tests to be enabled regardless of the standalone player application focus. --- .../Tests/IntegrationTests/IntegrationTests.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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() From 0241d4af8bf432400a5b3562af70fe9af4dcbd0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Freire?= Date: Fri, 23 Jun 2023 14:01:55 +0200 Subject: [PATCH 2/2] Update CHANGELOG --- Packages/com.unity.inputsystem/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) 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