Skip to content

Commit de716f0

Browse files
authored
Merge branch 'develop' into fix/ISXB-1790-array-helpers-merge-comparer
2 parents 378f5db + 2d1a606 commit de716f0

65 files changed

Lines changed: 29809 additions & 36876 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.yamato/wrench/player-build.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Auto-generated by Recipe Engine, do not modify manually.
2+
# This job is generated by the wrench recipe engine module, see find the docs here: http://Go/ii2fb
3+
{}
4+

.yamato/wrench/player-test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Auto-generated by Recipe Engine, do not modify manually.
2+
# This job is generated by the wrench recipe engine module, see find the docs here: http://Go/ii2fb
3+
{}
4+

.yamato/wrench/pvp-exemptions.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@
127127
},
128128
"PVP-92-3": {
129129
"errors": [
130+
"InputSystem/Plugins/iOS/IOSGameController.cs: .Switch;",
131+
"InputSystem/Plugins/Switch/SwitchProController.cs: .Switch\n",
130132
"InputSystem/Plugins/Switch/SwitchProControllerHID.cs: .Switch.",
131133
"InputSystem/Plugins/Switch/SwitchProControllerHID.cs: .Switch\n",
132134
"InputSystem/Plugins/Switch/SwitchSupportHID.cs: .Switch\n",

.yamato/wrench/validation-jobs.yml

Lines changed: 18 additions & 18 deletions
Large diffs are not rendered by default.

Assets/Tests/InputSystem.Editor/InputActionReferenceEditorTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ private void DisableDomainReloads()
9898
EditorPrefsTestUtils.DisableDomainReload();
9999
}
100100

101-
private static InputActionBehaviour GetBehaviour() => Object.FindFirstObjectByType<InputActionBehaviour>();
101+
private static InputActionBehaviour GetBehaviour() => Object.FindAnyObjectByType<InputActionBehaviour>();
102102
private static InputActionAsset GetAsset() => AssetDatabase.LoadAssetAtPath<InputActionAsset>(assetPath);
103103

104104
// For unclear reason, NUnit fails to assert throwing exceptions after transition into play-mode.

Assets/Tests/InputSystem.Editor/XRIPackageTest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public IEnumerator TearDown()
3838

3939
[UnityTest]
4040
[Category("Integration")]
41+
[Ignore("ISX-2531 - This test is currently ignored as it is causing issues in the CI. It should be re-enabled once the underlying issue is resolved.")]
4142
public IEnumerator AdddingLatestXRIPackageThrowsNoErrors()
4243
{
4344
Application.logMessageReceived += HandleLog;

Assets/Tests/InputSystem/APIVerificationTests.cs

Lines changed: 173 additions & 12 deletions
Large diffs are not rendered by default.

Assets/Tests/InputSystem/CoreTests_Actions.cs

Lines changed: 57 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,9 @@ public void Actions_DoNotGetTriggeredByEditorUpdates()
631631

632632
using (var trace = new InputActionTrace(action))
633633
{
634-
runtime.PlayerFocusLost();
634+
ScheduleFocusChangedEvent(applicationHasFocus: false);
635+
InputSystem.Update(InputUpdateType.Dynamic);
636+
635637
Set(gamepad.leftTrigger, 0.123f, queueEventOnly: true);
636638
InputSystem.Update(InputUpdateType.Editor);
637639

@@ -661,13 +663,13 @@ public void Actions_DoNotGetTriggeredByOutOfFocusEventInEditor(InputSettings.Bac
661663
// could just rely on order of event. Which means this test work for a fixed timestamp and it should
662664
// changed accordingly.
663665
currentTime += 1.0f;
664-
runtime.PlayerFocusLost();
666+
ScheduleFocusChangedEvent(applicationHasFocus: false);
665667
currentTime += 1.0f;
666668
// Queuing an event like it would be in the editor when the GameView is out of focus.
667669
Set(mouse.position, new Vector2(0.234f, 0.345f) , queueEventOnly: true);
668670
currentTime += 1.0f;
669671
// Gaining focus like it would happen in the editor when the GameView regains focus.
670-
runtime.PlayerFocusGained();
672+
ScheduleFocusChangedEvent(applicationHasFocus: true);
671673
currentTime += 1.0f;
672674
// This emulates a device sync that happens when the player regains focus through an IOCTL command.
673675
// That's why it also has it's time incremented.
@@ -720,14 +722,15 @@ public void Actions_TimeoutsDoNotGetTriggeredInEditorUpdates()
720722

721723
trace.Clear();
722724

723-
runtime.PlayerFocusLost();
725+
ScheduleFocusChangedEvent(applicationHasFocus: false);
726+
InputSystem.Update(InputUpdateType.Dynamic);
724727
currentTime = 10;
725728

726729
InputSystem.Update(InputUpdateType.Editor);
727730

728731
Assert.That(trace, Is.Empty);
729732

730-
runtime.PlayerFocusGained();
733+
ScheduleFocusChangedEvent(applicationHasFocus: true);
731734
InputSystem.Update(InputUpdateType.Dynamic);
732735

733736
actions = trace.ToArray();
@@ -1401,6 +1404,45 @@ public void Actions_ValueActionsEnabledInOnEvent_DoNotReactToCurrentStateOfContr
14011404
}
14021405
}
14031406

1407+
// Regression test for UUM-100125.
1408+
[Test]
1409+
[Category("Actions")]
1410+
public void Actions_InitialStateCheckAfterConfigurationChange_DoesNotTriggerForInactiveTouch()
1411+
{
1412+
var touchscreen = InputSystem.AddDevice<Touchscreen>();
1413+
var action = new InputAction(type: InputActionType.Value, binding: "<Touchscreen>/primaryTouch/position");
1414+
action.Enable();
1415+
1416+
// Run the first initial state check from enabling the action.
1417+
InputSystem.Update();
1418+
1419+
using (var trace = new InputActionTrace(action))
1420+
{
1421+
BeginTouch(1, new Vector2(123, 234));
1422+
EndTouch(1, new Vector2(345, 456));
1423+
1424+
Assert.That(touchscreen.primaryTouch.isInProgress, Is.False);
1425+
Assert.That(touchscreen.primaryTouch.position.ReadValue(), Is.Not.EqualTo(default(Vector2)));
1426+
1427+
trace.Clear();
1428+
1429+
// Configuration change causes full re-resolve and schedules initial state check.
1430+
InputSystem.QueueConfigChangeEvent(touchscreen);
1431+
InputSystem.Update();
1432+
InputSystem.Update();
1433+
1434+
// Full re-resolve may cancel the current action state. What must NOT happen is a synthetic
1435+
// Started/Performed pair from persisted inactive touch state.
1436+
Assert.AreEqual(1, trace.count);
1437+
foreach (var eventPtr in trace)
1438+
{
1439+
// The trace should only contain a Canceled event for the action.
1440+
Assert.AreEqual(InputActionPhase.Canceled, eventPtr.phase,
1441+
$"inactive touch state should not produce action callbacks, but received {eventPtr.phase}.");
1442+
}
1443+
}
1444+
}
1445+
14041446
// https://fogbugz.unity3d.com/f/cases/1192972/
14051447
[Test]
14061448
[Category("Actions")]
@@ -12481,17 +12523,20 @@ public void Actions_WithMultipleCompositeBindings_WithoutEvaluateMagnitude_Works
1248112523

1248212524
// Now when enabling actionMap ..
1248312525
actionMap.Enable();
12484-
// On the following update we will trigger OnBeforeUpdate which will rise started/performed
12485-
// from InputActionState.OnBeforeInitialUpdate as controls are "actuated"
12526+
// Inactive touches (ended before action was enabled) must NOT produce started/performed from
12527+
// OnBeforeInitialUpdate. Their persisted state (position, touchId) is non-default due to
12528+
// dontReset, but only TouchControl.isInProgress should be considered for initial-state check.
12529+
// Related to UUM-100125 and Actions_InitialStateCheckAfterConfigurationChange_DoesNotTriggerForInactiveTouch.
1248612530
InputSystem.Update();
12487-
Assert.That(values.Count, Is.EqualTo(prepopulateTouchesBeforeEnablingAction ? 2 : 0)); // started+performed arrive from OnBeforeUpdate
12531+
Assert.That(values.Count, Is.EqualTo(0));
1248812532
values.Clear();
1248912533

12490-
// Now subsequent touches should not be ignored
1249112534
BeginTouch(200, new Vector2(1, 1));
12492-
Assert.That(values.Count, Is.EqualTo(1));
12493-
Assert.That(values[0].InputId, Is.EqualTo(200));
12494-
Assert.That(values[0].Position, Is.EqualTo(new Vector2(1, 1)));
12535+
// If prepopulated, action was never actuated (synthetic initial-check is suppressed),
12536+
// so BeginTouch fires started+performed (2 events).
12537+
Assert.That(values.Count, Is.EqualTo(prepopulateTouchesBeforeEnablingAction ? 2 : 1));
12538+
Assert.That(values[values.Count - 1].InputId, Is.EqualTo(200));
12539+
Assert.That(values[values.Count - 1].Position, Is.EqualTo(new Vector2(1, 1)));
1249512540
}
1249612541

1249712542
// FIX: This test is currently checking if shortcut support is enabled by testing that the unwanted behaviour exists.

Assets/Tests/InputSystem/CoreTests_Devices.cs

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
using UnityEngine.Scripting;
2020
using UnityEngine.TestTools;
2121
using UnityEngine.TestTools.Utils;
22+
using UnityEngineInternal.Input;
2223
using Gyroscope = UnityEngine.InputSystem.Gyroscope;
2324
using UnityEngine.TestTools.Constraints;
2425
using Is = NUnit.Framework.Is;
@@ -1522,7 +1523,7 @@ public void Devices_CanReconnectDevice_WhenDisconnectedWhileAppIsOutOfFocus()
15221523
Assert.That(device, Is.Not.Null);
15231524

15241525
// Loose focus.
1525-
runtime.PlayerFocusLost();
1526+
ScheduleFocusChangedEvent(applicationHasFocus: false);
15261527
InputSystem.Update();
15271528

15281529
// Disconnect.
@@ -1534,7 +1535,7 @@ public void Devices_CanReconnectDevice_WhenDisconnectedWhileAppIsOutOfFocus()
15341535
Assert.That(InputSystem.devices, Is.Empty);
15351536

15361537
// Regain focus.
1537-
runtime.PlayerFocusGained();
1538+
ScheduleFocusChangedEvent(applicationHasFocus: true);
15381539
InputSystem.Update();
15391540

15401541
var newDeviceId = runtime.ReportNewInputDevice(deviceDesc);
@@ -4604,7 +4605,13 @@ void DeviceChangeCallback(InputDevice device, InputDeviceChange change)
46044605
InputSystem.onDeviceChange += DeviceChangeCallback;
46054606

46064607
var eventCount = 0;
4607-
InputSystem.onEvent += (eventPtr, _) => ++ eventCount;
4608+
InputSystem.onEvent += (eventPtr, _) =>
4609+
{
4610+
// Focus events will always be processed no matter the state
4611+
// Since the test relies on counting events based on state, dont count focus events
4612+
if (eventPtr.data->type != (FourCC)FocusConstants.kEventType)
4613+
++eventCount;
4614+
};
46084615

46094616
Assert.That(trackedDevice.enabled, Is.True);
46104617
Assert.That(mouse.enabled, Is.True);
@@ -4647,7 +4654,8 @@ void DeviceChangeCallback(InputDevice device, InputDeviceChange change)
46474654
}
46484655

46494656
// Lose focus.
4650-
runtime.PlayerFocusLost();
4657+
ScheduleFocusChangedEvent(applicationHasFocus: false);
4658+
InputSystem.Update(InputUpdateType.Dynamic);
46514659

46524660
Assert.That(sensor.enabled, Is.False);
46534661
Assert.That(disabledDevice.enabled, Is.False);
@@ -5068,7 +5076,8 @@ void DeviceChangeCallback(InputDevice device, InputDeviceChange change)
50685076
commands.Clear();
50695077

50705078
// Regain focus.
5071-
runtime.PlayerFocusGained();
5079+
ScheduleFocusChangedEvent(applicationHasFocus: true);
5080+
InputSystem.Update(InputUpdateType.Dynamic);
50725081

50735082
Assert.That(sensor.enabled, Is.False);
50745083
Assert.That(disabledDevice.enabled, Is.False);
@@ -5275,13 +5284,10 @@ void DeviceChangeCallback(InputDevice device, InputDeviceChange change)
52755284
"Sync Gamepad", "Sync Joystick",
52765285
"Sync TrackedDevice", "Sync TrackedDevice2",
52775286
"Sync Mouse", "Sync Mouse2", "Sync Mouse3",
5278-
"Sync Keyboard", "Reset Joystick"
5279-
}));
5280-
// Enabled devices that don't support syncs get reset.
5281-
Assert.That(changes, Is.EquivalentTo(new[]
5282-
{
5283-
"SoftReset Mouse1", "SoftReset Mouse3", "HardReset Joystick", "SoftReset TrackedDevice2"
5287+
"Sync Keyboard"
52845288
}));
5289+
// Enabled devices that don't support syncs dont get reset for Ignore Focus as we do not want to cancel any actions.
5290+
Assert.That(changes, Is.Empty);
52855291
break;
52865292
}
52875293
}
@@ -5318,7 +5324,13 @@ public void Devices_CanSkipProcessingEventsWhileInBackground()
53185324
Assert.That(performedCount, Is.EqualTo(1));
53195325

53205326
// Lose focus
5321-
runtime.PlayerFocusLost();
5327+
ScheduleFocusChangedEvent(applicationHasFocus: false);
5328+
#if UNITY_INPUTSYSTEM_SUPPORTS_FOCUS_EVENTS
5329+
// in the new system, we have to process the focus event to update the state of the devices.
5330+
// In the old system, this wouldn't work and would make the test fal
5331+
InputSystem.Update();
5332+
#endif
5333+
53225334
Assert.That(gamepad.enabled, Is.False);
53235335

53245336
// Queue an event while in the background. We don't want to see this event to be processed once focus
@@ -5329,7 +5341,7 @@ public void Devices_CanSkipProcessingEventsWhileInBackground()
53295341
InputSystem.Update();
53305342

53315343
// Gain focus
5332-
runtime.PlayerFocusGained();
5344+
ScheduleFocusChangedEvent(applicationHasFocus: true);
53335345

53345346
// Run update to try process events accordingly once focus is gained
53355347
InputSystem.Update();

Assets/Tests/InputSystem/CoreTests_Editor.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2720,7 +2720,8 @@ public void Editor_CanForceKeyboardAndMouseInputToGameViewWithoutFocus()
27202720
var keyboard = InputSystem.AddDevice<Keyboard>();
27212721
var mouse = InputSystem.AddDevice<Mouse>();
27222722

2723-
runtime.PlayerFocusLost();
2723+
ScheduleFocusChangedEvent(applicationHasFocus: false);
2724+
InputSystem.Update(InputUpdateType.Dynamic);
27242725

27252726
Assert.That(keyboard.enabled, Is.True);
27262727
Assert.That(mouse.enabled, Is.True);
@@ -3016,7 +3017,8 @@ public void Editor_LeavingPlayMode_ReenablesAllDevicesTemporarilyDisabledDueToFo
30163017
Set(mouse.position, new Vector2(123, 234));
30173018
Press(gamepad.buttonSouth);
30183019

3019-
runtime.PlayerFocusLost();
3020+
ScheduleFocusChangedEvent(applicationHasFocus: false);
3021+
InputSystem.Update(InputUpdateType.Dynamic);
30203022

30213023
Assert.That(gamepad.enabled, Is.False);
30223024

0 commit comments

Comments
 (0)