Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .yamato/upm-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ build_android_{{ editor.version }}_{{ backend.name }}:
name: Build Tests on {{ editor.version }} on android {{ backend.name }}
agent:
type: Unity::VM
image: mobile/android-execution-base:stable
image: mobile/android-package-ci-win:latest
flavor: b1.xlarge
commands:
- pip install unity-downloader-cli --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple
Expand All @@ -127,7 +127,7 @@ run_android_{{ editor.version }}_{{ backend.name }}:
name: Run Tests on {{ editor.version }} on android {{ backend.name }}
agent:
type: Unity::mobile::shield
image: mobile/android-execution-base:stable
image: mobile/android-package-ci-win:latest
flavor: b1.medium
# Skip repository cloning
skip_checkout: true
Expand Down
3 changes: 3 additions & 0 deletions Assets/Tests/InputSystem/Plugins/OnScreenTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ public void Devices_DisablingLastOnScreenControlRemovesCreatedDevice()
Assert.That(InputSystem.devices, Has.None.InstanceOf<Keyboard>());
}

#if !TEMP_DISABLE_UI_TESTS_ON_TRUNK
// https://fogbugz.unity3d.com/f/cases/1271942
[UnityTest]
[Category("Devices")]
Expand Down Expand Up @@ -263,6 +264,8 @@ public IEnumerator Devices_CanHaveOnScreenJoystickControls()
Assert.That(Gamepad.all[0].buttonSouth.isPressed, Is.False);
}

#endif

// https://fogbugz.unity3d.com/f/cases/1305016/
[Test]
[Category("Devices")]
Expand Down
81 changes: 60 additions & 21 deletions Assets/Tests/InputSystem/Plugins/UITests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,12 @@ public void UI_InputModuleHasDefaultActions()
// click like the docs say) and also has some questionable behaviors that we opt to do different (for example, we perform
// click detection *before* invoking click handlers so that clickCount and clickTime correspond to the current click instead
// of to the previous click).
#if !TEMP_DISABLE_UI_TESTS_ON_TRUNK
[UnityTest]
[Category("UI")]
#if UNITY_IOS || UNITY_TVOS
#if UNITY_IOS || UNITY_TVOS
[Ignore("Failing on iOS https://jira.unity3d.com/browse/ISX-448")]
#endif
#endif
// All pointer input goes through a single code path. Goes for Pointer-derived devices as well as for TrackedDevice input but
// also any other input that can deliver point and click functionality.
//
Expand Down Expand Up @@ -447,7 +448,7 @@ public IEnumerator UI_CanDriveUIFromPointer(string deviceLayout, UIPointerType p
// Touch has no ability to point without pressing so pointer enter event is followed
// right by pointer down event.

#if UNITY_2021_2_OR_NEWER
#if UNITY_2021_2_OR_NEWER
// PointerMove.
Assert.That(scene.leftChildReceiver.events[0 + kHaveMovementEvents].type, Is.EqualTo(EventType.PointerMove));
Assert.That(scene.leftChildReceiver.events[0 + kHaveMovementEvents].pointerData.button, Is.EqualTo(PointerEventData.InputButton.Left));
Expand Down Expand Up @@ -475,7 +476,7 @@ public IEnumerator UI_CanDriveUIFromPointer(string deviceLayout, UIPointerType p
Assert.That(scene.leftChildReceiver.events[0 + kHaveMovementEvents].pointerData.pointerPressRaycast.gameObject, Is.Null);
Assert.That(scene.leftChildReceiver.events[0 + kHaveMovementEvents].pointerData.pointerPressRaycast.screenPosition,
Is.EqualTo(default(Vector2)).Using(Vector2EqualityComparer.Instance));
#endif
#endif

// PointerDown.
Assert.That(scene.leftChildReceiver.events[1 + kHaveMovementEvents].type, Is.EqualTo(EventType.PointerDown));
Expand Down Expand Up @@ -702,7 +703,7 @@ public IEnumerator UI_CanDriveUIFromPointer(string deviceLayout, UIPointerType p
AllEvents("pointerCurrentRaycast.screenPosition", secondScreenPosition),

// PointerMove.
#if UNITY_2021_2_OR_NEWER
#if UNITY_2021_2_OR_NEWER
OneEvent("type", EventType.PointerMove),
OneEvent("dragging", false),
// Again, pointer movement is processed exclusively "from" the left button.
Expand All @@ -716,7 +717,7 @@ public IEnumerator UI_CanDriveUIFromPointer(string deviceLayout, UIPointerType p
OneEvent("lastPress", clickButton == PointerEventData.InputButton.Left ? null : scene.leftGameObject),
OneEvent("pointerPressRaycast.gameObject", clickButton == PointerEventData.InputButton.Left ? scene.leftGameObject : null),
OneEvent("pointerPressRaycast.screenPosition", clickButton == PointerEventData.InputButton.Left ? firstScreenPosition : Vector2.zero),
#endif
#endif

// BeginDrag.
OneEvent("type", EventType.BeginDrag),
Expand Down Expand Up @@ -751,9 +752,9 @@ public IEnumerator UI_CanDriveUIFromPointer(string deviceLayout, UIPointerType p
Assert.That(scene.rightChildReceiver.events, Is.Empty);
Assert.That(scene.parentReceiver.events,
EventSequence(
#if UNITY_2021_2_OR_NEWER
#if UNITY_2021_2_OR_NEWER
OneEvent("type", EventType.PointerMove)
#endif
#endif
)
);

Expand Down Expand Up @@ -782,9 +783,9 @@ public IEnumerator UI_CanDriveUIFromPointer(string deviceLayout, UIPointerType p
// children to another) but *should* have seen a move event.
Assert.That(scene.parentReceiver.events,
EventSequence(
#if UNITY_2021_2_OR_NEWER
#if UNITY_2021_2_OR_NEWER
OneEvent("type", EventType.PointerMove)
#endif
#endif
)
);

Expand Down Expand Up @@ -813,7 +814,7 @@ public IEnumerator UI_CanDriveUIFromPointer(string deviceLayout, UIPointerType p
// press positions on the moves will be zero.

// PointerMove.
#if UNITY_2021_2_OR_NEWER
#if UNITY_2021_2_OR_NEWER
OneEvent("type", EventType.PointerMove),
OneEvent("button", PointerEventData.InputButton.Left),
OneEvent("pointerEnter", scene.leftGameObject),
Expand All @@ -828,7 +829,7 @@ public IEnumerator UI_CanDriveUIFromPointer(string deviceLayout, UIPointerType p
OneEvent("dragging", clickButton == PointerEventData.InputButton.Left ? true : false),
OneEvent("pointerPressRaycast.gameObject", clickButton == PointerEventData.InputButton.Left ? scene.leftGameObject : null),
OneEvent("pointerPressRaycast.screenPosition", clickButton == PointerEventData.InputButton.Left ? firstScreenPosition : Vector2.zero),
#endif
#endif

// PointerExit.
OneEvent("type", EventType.PointerExit),
Expand Down Expand Up @@ -889,9 +890,9 @@ public IEnumerator UI_CanDriveUIFromPointer(string deviceLayout, UIPointerType p
AllEvents("pointerPressRaycast.screenPosition", clickButton == PointerEventData.InputButton.Left ? firstScreenPosition : Vector2.zero),

OneEvent("type", EventType.PointerEnter)
#if UNITY_2021_2_OR_NEWER
#if UNITY_2021_2_OR_NEWER
, OneEvent("type", EventType.PointerMove)
#endif
#endif
)
);

Expand Down Expand Up @@ -1103,7 +1104,10 @@ public IEnumerator UI_CanDriveUIFromPointer(string deviceLayout, UIPointerType p
}
}

#endif

// https://fogbugz.unity3d.com/f/cases/1232705/
#if !TEMP_DISABLE_UI_TESTS_ON_TRUNK
[UnityTest]
[Category("UI")]
public IEnumerator UI_CanReceivePointerExitsWhenChangingUIStateWithoutMovingPointer()
Expand Down Expand Up @@ -1136,14 +1140,17 @@ public IEnumerator UI_CanReceivePointerExitsWhenChangingUIStateWithoutMovingPoin
);
}

#endif

#if !TEMP_DISABLE_UI_TESTS_ON_TRUNK
[UnityTest]
[Category("UI")]
[TestCase(UIPointerBehavior.SingleUnifiedPointer, ExpectedResult = -1)]
[TestCase(UIPointerBehavior.AllPointersAsIs, ExpectedResult = -1)]
[TestCase(UIPointerBehavior.SingleMouseOrPenButMultiTouchAndTrack, ExpectedResult = -1)]
#if UNITY_IOS || UNITY_TVOS
#if UNITY_IOS || UNITY_TVOS
[Ignore("Failing on iOS https://jira.unity3d.com/browse/ISX-448")]
#endif
#endif
public IEnumerator UI_CanDriveUIFromMultiplePointers(UIPointerBehavior pointerBehavior)
{
InputSystem.RegisterLayout(kTrackedDeviceWithButton);
Expand Down Expand Up @@ -1354,6 +1361,9 @@ public IEnumerator UI_CanDriveUIFromMultiplePointers(UIPointerBehavior pointerBe
}
}

#endif

#if !TEMP_DISABLE_UI_TESTS_ON_TRUNK
[UnityTest]
[Category("UI")]
public IEnumerator UI_CanDriveUIFromMultipleTouches()
Expand Down Expand Up @@ -1558,7 +1568,10 @@ public IEnumerator UI_CanDriveUIFromMultipleTouches()
Assert.That(scene.leftChildReceiver.events, Is.Empty);
}

#endif

// https://fogbugz.unity3d.com/f/cases/1190150/
#if !TEMP_DISABLE_UI_TESTS_ON_TRUNK
[UnityTest]
[Category("UI")]
public IEnumerator UI_CanUseTouchSimulationWithUI()
Expand Down Expand Up @@ -1590,9 +1603,9 @@ public IEnumerator UI_CanUseTouchSimulationWithUI()
Is.EquivalentTo(new[]
{
EventType.PointerEnter,
#if UNITY_2021_2_OR_NEWER
#if UNITY_2021_2_OR_NEWER
EventType.PointerMove,
#endif
#endif
EventType.PointerDown,
EventType.InitializePotentialDrag
}));
Expand All @@ -1613,6 +1626,8 @@ public IEnumerator UI_CanUseTouchSimulationWithUI()
}
}

#endif

#if UNITY_IOS || UNITY_TVOS
[Ignore("Failing on iOS https://jira.unity3d.com/browse/ISX-448")]
#endif
Expand Down Expand Up @@ -1796,6 +1811,7 @@ public IEnumerator UI_CanDriveUIFromMultipleTrackedDevices()
// from non-pointer devices, we need to decide what to do. What the UI input module does is try to find a pointer (classic
// or tracked) into which to route the input. Only if it can't find an existing pointer to route the input into will it
// resort to turning the non-pointer device into a (likely non-functional) pointer.
#if !TEMP_DISABLE_UI_TESTS_ON_TRUNK
[UnityTest]
[Category("UI")]
public IEnumerator UI_CanTriggerPointerClicksFromNonPointerDevices()
Expand Down Expand Up @@ -1834,7 +1850,10 @@ public IEnumerator UI_CanTriggerPointerClicksFromNonPointerDevices()
.Matches((UICallbackReceiver.Event eventRecord) => eventRecord.pointerData.clickCount == 0));
}

#endif

// https://fogbugz.unity3d.com/f/cases/1317239/
#if !TEMP_DISABLE_UI_TESTS_ON_TRUNK
[UnityTest]
[Category("UI")]
public IEnumerator UI_CanDetectClicks_WithSuccessiveClicksReflectedInClickCount()
Expand Down Expand Up @@ -2008,11 +2027,14 @@ public IEnumerator UI_CanDetectClicks_WithSuccessiveClicksReflectedInClickCount(
);
}

#endif

// The UI input module needs to return true from IsPointerOverGameObject() for touches
// that have ended in the current frame. I.e. even though the touch is already concluded
// at the InputDevice level, the UI module needs to maintain state for one more frame.
//
// https://fogbugz.unity3d.com/f/cases/1347048/
#if !TEMP_DISABLE_UI_TESTS_ON_TRUNK
[UnityTest]
[Category("UI")]
public IEnumerator UI_TouchPointersAreKeptForOneFrameAfterRelease()
Expand Down Expand Up @@ -2048,6 +2070,8 @@ public IEnumerator UI_TouchPointersAreKeptForOneFrameAfterRelease()
Assert.That(EventSystem.current.IsPointerOverGameObject(), Is.False);
}

#endif

[UnityTest]
[Category("UI")]
public IEnumerator UI_CallingIsPointerOverGameObject_FromActionCallback_ResultsInWarning()
Expand Down Expand Up @@ -2274,6 +2298,7 @@ public IEnumerator UI_ClickDraggingMouseDoesNotAllocateGCMemory()
}, Is.Not.AllocatingGCMemory());
}

#if !TEMP_DISABLE_UI_TESTS_ON_TRUNK
[UnityTest]
[Category("UI")]
// Check that two players can have separate UI, and that both selections will stay active when
Expand Down Expand Up @@ -2362,6 +2387,8 @@ public IEnumerator UI_CanOperateMultiplayerUIGloballyUsingMouse()
Assert.That(players[1].eventSystem.currentSelectedGameObject, Is.SameAs(players[1].rightGameObject));
}

#endif

[UnityTest]
[Category("UI")]
// Check that two players can have separate UI and control it using separate gamepads, using
Expand Down Expand Up @@ -2667,6 +2694,7 @@ public void UI_CanReassignUIActions()
Assert.That(uiModule.point?.action, Is.Null);
}

#if !TEMP_DISABLE_UI_TESTS_ON_TRUNK
[UnityTest]
[Category("UI")]
public IEnumerator UI_CanChangeControlsOnActions()
Expand Down Expand Up @@ -2710,6 +2738,8 @@ public IEnumerator UI_CanChangeControlsOnActions()
.Matches((UICallbackReceiver.Event e) => e.pointerData.device == mouse));
}

#endif

private class InputSystemUIInputModuleTestScene_Setup : IPrebuildSetup, IPostBuildCleanup
{
public void Setup()
Expand Down Expand Up @@ -2927,6 +2957,7 @@ public void UI_MovingAndClickingMouseDoesNotAllocateGCMemory()
}

// https://forum.unity.com/threads/feature-request-option-to-disable-deselect-in-ui-input-module.761531
#if !TEMP_DISABLE_UI_TESTS_ON_TRUNK
[UnityTest]
[Category("UI")]
public IEnumerator UI_CanPreventAutomaticDeselectionOfGameObjects()
Expand Down Expand Up @@ -2987,6 +3018,9 @@ public IEnumerator UI_CanPreventAutomaticDeselectionOfGameObjects()
Assert.That(scene.eventSystem.currentSelectedGameObject, Is.SameAs(scene.leftGameObject));
}

#endif

#if !TEMP_DISABLE_UI_TESTS_ON_TRUNK
[UnityTest]
[Category("UI")]
public IEnumerator UI_WhenBindingsAreReResolved_PointerStatesAreKeptInSync()
Expand Down Expand Up @@ -3037,6 +3071,8 @@ public IEnumerator UI_WhenBindingsAreReResolved_PointerStatesAreKeptInSync()
Assert.That(EventSystem.current.IsPointerOverGameObject(), Is.True);
}

#endif

////REVIEW: While `deselectOnBackgroundClick` does solve the problem of breaking keyboard and gamepad navigation, the question
//// IMO is whether navigation should even be affected that way by not having a current selection. Seems to me that the
//// the system should remember the last selected object and start up navigation from there when nothing is selected.
Expand Down Expand Up @@ -3274,7 +3310,7 @@ public void UI_CanDriveVirtualMouseCursorFromGamepad()
// to our manifest without breaking test runs with previous versions of Unity. However, in 2021.2, all the UITK functionality
// has moved into the com.unity.modules.uielements module which is also available in previous versions of Unity. This way we
// can have a reference to UITK that doesn't break things in previous versions of Unity.
#if UNITY_2021_2_OR_NEWER
#if UNITY_2021_2_OR_NEWER && !TEMP_DISABLE_UI_TESTS_ON_TRUNK
[UnityTest]
[Category("UI")]
#if UNITY_ANDROID || UNITY_IOS || UNITY_TVOS
Expand Down Expand Up @@ -3375,6 +3411,7 @@ public void Setup()
}
#endif

#if !TEMP_DISABLE_UI_TESTS_ON_TRUNK
[UnityTest]
[Category("Focus")]
public IEnumerator UI_WhenAppLosesAndRegainsFocus_WhileUIButtonIsPressed_UIButtonIsNotClicked()
Expand Down Expand Up @@ -3415,9 +3452,9 @@ public IEnumerator UI_WhenAppLosesAndRegainsFocus_WhileUIButtonIsPressed_UIButto
Assert.That(scene.leftChildReceiver.events,
EventSequence(
OneEvent("type", EventType.PointerEnter),
#if UNITY_2021_2_OR_NEWER
#if UNITY_2021_2_OR_NEWER
OneEvent("type", EventType.PointerMove),
#endif
#endif
OneEvent("type", EventType.PointerDown),
OneEvent("type", EventType.InitializePotentialDrag)
)
Expand Down Expand Up @@ -3447,6 +3484,8 @@ public IEnumerator UI_WhenAppLosesAndRegainsFocus_WhileUIButtonIsPressed_UIButto
Assert.That(clicked, Is.False);
}

#endif

public class MyButton : UnityEngine.UI.Button
{
public bool receivedPointerDown;
Expand Down
6 changes: 6 additions & 0 deletions Assets/Tests/InputSystem/Unity.InputSystem.Tests.asmdef
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "Unity.InputSystem.Tests",
"rootNamespace": "",
"references": [
"Unity.InputSystem",
"Unity.InputSystem.TestFramework",
Expand Down Expand Up @@ -28,6 +29,11 @@
"name": "com.unity.package-manager-doctools",
"expression": "1.0",
"define": "HAVE_DOCTOOLS_INSTALLED"
},
{
"name": "Unity",
"expression": "[2022.1.0a12,2022.1.0a16)",
"define": "TEMP_DISABLE_UI_TESTS_ON_TRUNK"
}
],
"noEngineReferences": false
Expand Down
7 changes: 6 additions & 1 deletion Packages/com.unity.inputsystem/ValidationExceptions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
{
"ValidationTest": "API Validation",
"ExceptionMessage": "Breaking changes require a new major version.",
"PackageVersion": "1.1.0"
"PackageVersion": "1.1.1"
},
{
"ValidationTest": "API Validation",
"ExceptionMessage": "Additions require a new minor or major version.",
"PackageVersion": "1.1.1"
}
],
"WarningExceptions": []
Expand Down