Skip to content

Commit 7b35840

Browse files
committed
Merge branch 'develop' into joao/editor-runtime-split-for-module
2 parents 4e72b8d + 2d1a606 commit 7b35840

9 files changed

Lines changed: 509 additions & 153 deletions

File tree

Assets/Tests/InputSystem/APIVerificationTests.cs

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -551,45 +551,29 @@ public class OpenVRControllerWMR : UnityEngine.InputSystem.XR.XRController
551551
public class OpenVROculusTouchController : UnityEngine.InputSystem.XR.XRControllerWithRumble
552552
public class ViveWand : UnityEngine.InputSystem.XR.XRControllerWithRumble
553553
")]
554-
// API scraper in 1.0.0 emitted incomplete default argument expressions for these overloads.
554+
// New scraper version (com.unity.coding:0.1.0-preview.26) includes default argument expressions for these overloads.
555555
[Property("Exclusions", @"1.0.0
556556
public static string GetBindingDisplayString(this InputAction action, int bindingIndex, InputBinding.DisplayStringOptions options = );
557557
public static string GetBindingDisplayString(this InputAction action, InputBinding bindingMask, InputBinding.DisplayStringOptions options = );
558558
public static string GetBindingDisplayString(this InputAction action, InputBinding.DisplayStringOptions options = , string group = default(string));
559559
public static string GetBindingDisplayString(this InputAction action, int bindingIndex, out string deviceLayoutName, out string controlPath, InputBinding.DisplayStringOptions options = );
560560
public string ToDisplayString(InputBinding.DisplayStringOptions options = , InputControl control = default(InputControl));
561561
public string ToDisplayString(out string deviceLayoutName, out string controlPath, InputBinding.DisplayStringOptions options = , InputControl control = default(InputControl));
562-
DontIncludeInteractions = 4,
563-
DontOmitDevice = 2,
564-
DontUseShortDisplayNames = 1,
565-
IgnoreBindingOverrides = 8,
566-
OmitDevice = 2,
567-
UseShortNames = 4,
568-
BufferedBytes = 256,
569-
Constant = 1,
570-
NonLinear = 16,
571-
NoPreferred = 32,
572-
NullState = 64,
573-
Relative = 4,
574-
Variable = 2,
575-
Volatile = 128,
576-
Wrap = 8,
577-
public FourCC(char a, char b = , char c = , char d = ) {}
578562
public static string ToHumanReadableString(string path, InputControlPath.HumanReadableStringOptions options = InputControlPath.HumanReadableStringOptions.None, InputControl control = default(InputControl));
579563
public static string ToHumanReadableString(string path, out string deviceLayoutName, out string controlPath, InputControlPath.HumanReadableStringOptions options = InputControlPath.HumanReadableStringOptions.None, InputControl control = default(InputControl));
580-
public class InputStateHistory<TValue> : InputStateHistory, System.Collections.Generic.IEnumerable<UnityEngine.InputSystem.LowLevel.InputStateHistory<TValue>>, System.Collections.Generic.IReadOnlyCollection<UnityEngine.InputSystem.LowLevel.InputStateHistory<TValue>>, System.Collections.Generic.IReadOnlyList<UnityEngine.InputSystem.LowLevel.InputStateHistory<TValue>>, System.Collections.IEnumerable where TValue : struct, new()
564+
public UnityEngine.InputSystem.LowLevel.InputStateHistory<TValue> RecordStateChange(UnityEngine.InputSystem.InputControl<TValue> control, TValue value, double time = -1d);
565+
")]
566+
// New scraper version (com.unity.coding:0.1.0-preview.26) is able to qualify nested types inside a generic class.
567+
[Property("Exclusions", @"1.0.0
581568
public UnityEngine.InputSystem.LowLevel.InputStateHistory<TValue> this[int index] { get; set; }
582569
public UnityEngine.InputSystem.LowLevel.InputStateHistory<TValue> AddRecord(UnityEngine.InputSystem.LowLevel.InputStateHistory<TValue> record);
583570
public System.Collections.Generic.IEnumerator<UnityEngine.InputSystem.LowLevel.InputStateHistory<TValue>> GetEnumerator();
584-
public UnityEngine.InputSystem.LowLevel.InputStateHistory<TValue> RecordStateChange(UnityEngine.InputSystem.InputControl<TValue> control, TValue value, double time = -1d);
585571
public struct Record : System.IEquatable<UnityEngine.InputSystem.LowLevel.InputStateHistory<TValue>>
586572
public UnityEngine.InputSystem.LowLevel.InputStateHistory<TValue> next { get; }
587-
public UnityEngine.InputSystem.LowLevel.InputStateHistory<TValue> owner { get; }
588573
public UnityEngine.InputSystem.LowLevel.InputStateHistory<TValue> previous { get; }
589574
public void CopyFrom(UnityEngine.InputSystem.LowLevel.InputStateHistory<TValue> record);
590575
public bool Equals(UnityEngine.InputSystem.LowLevel.InputStateHistory<TValue> other);
591-
public SteamHandle(ulong handle) {}
592-
public static ulong op_Explicit(UnityEngine.InputSystem.Steam.SteamHandle<TObject> handle);
576+
public class InputStateHistory<TValue> : InputStateHistory, System.Collections.Generic.IEnumerable<UnityEngine.InputSystem.LowLevel.InputStateHistory<TValue>>, System.Collections.Generic.IReadOnlyCollection<UnityEngine.InputSystem.LowLevel.InputStateHistory<TValue>>, System.Collections.Generic.IReadOnlyList<UnityEngine.InputSystem.LowLevel.InputStateHistory<TValue>>, System.Collections.IEnumerable where TValue : struct, new()
593577
")]
594578
// Api scraper seems to be unstable with fields with default values, sometimes "= 0;" appears (locally) and sometimes (on CI) doesn't.
595579
[Property("Exclusions", @"1.0.0
@@ -605,10 +589,13 @@ public SteamHandle(ulong handle) {}
605589
[ScopedExclusionProperty("1.0.0", "UnityEngine.InputSystem.LowLevel", "public struct KeyboardState : IInputStateTypeInfo", "public fixed byte keys[14];")]
606590
// Allow Key.IMESelected to be marked as Obsolete
607591
[ScopedExclusionProperty("1.0.0", "UnityEngine.InputSystem", "public enum Key", "IMESelected = 111,")]
608-
609-
#if !UNITY_ENABLE_STEAM_CONTROLLER_SUPPORT
610592
// Steam support is conditional (#if UNITY_ENABLE_STEAM_CONTROLLER_SUPPORT) and absent when
611593
// the steam plugin is not installed, so all Steam types are excluded from the comparison.
594+
[Property("Exclusions", @"1.0.0
595+
public SteamHandle(ulong handle) {}
596+
public static ulong op_Explicit(UnityEngine.InputSystem.Steam.SteamHandle<TObject> handle);
597+
")]
598+
#if !UNITY_ENABLE_STEAM_CONTROLLER_SUPPORT
612599
[Property("Exclusions", @"1.0.0
613600
namespace UnityEngine.InputSystem.Steam
614601
public interface ISteamControllerAPI

Assets/Tests/InputSystem/CoreTests_Actions.cs

Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,6 +1404,45 @@ public void Actions_ValueActionsEnabledInOnEvent_DoNotReactToCurrentStateOfContr
14041404
}
14051405
}
14061406

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+
14071446
// https://fogbugz.unity3d.com/f/cases/1192972/
14081447
[Test]
14091448
[Category("Actions")]
@@ -12484,17 +12523,20 @@ public void Actions_WithMultipleCompositeBindings_WithoutEvaluateMagnitude_Works
1248412523

1248512524
// Now when enabling actionMap ..
1248612525
actionMap.Enable();
12487-
// On the following update we will trigger OnBeforeUpdate which will rise started/performed
12488-
// 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.
1248912530
InputSystem.Update();
12490-
Assert.That(values.Count, Is.EqualTo(prepopulateTouchesBeforeEnablingAction ? 2 : 0)); // started+performed arrive from OnBeforeUpdate
12531+
Assert.That(values.Count, Is.EqualTo(0));
1249112532
values.Clear();
1249212533

12493-
// Now subsequent touches should not be ignored
1249412534
BeginTouch(200, new Vector2(1, 1));
12495-
Assert.That(values.Count, Is.EqualTo(1));
12496-
Assert.That(values[0].InputId, Is.EqualTo(200));
12497-
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)));
1249812540
}
1249912541

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

0 commit comments

Comments
 (0)