Skip to content

Commit 89f99b5

Browse files
authored
MERGE: develop => stable
1 parent 6e8cbe0 commit 89f99b5

44 files changed

Lines changed: 1177 additions & 239 deletions

Some content is hidden

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

.yamato/config.metadata

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ editors:
22
- version: 2020.3
33
disable_tvos_run: true
44
- version: 2021.3
5-
- version: 2022.1
6-
- version: 2022.2
5+
- version: 2022.3
76
- version: 2023.1
87
- version: trunk
98
disable_tvos_run: true

.yamato/upm-ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ build_ios_{{ editor.version }}:
7878
name: Build Tests on {{ editor.version }} on ios
7979
agent:
8080
type: Unity::VM::osx
81-
image: package-ci/macos-12:default
81+
image: package-ci/macos-12:v4.19.0
8282
flavor: b1.large
8383
commands:
8484
- {{ utr_install_nix }}
@@ -97,7 +97,7 @@ run_ios_{{ editor.version }}:
9797
name: Run Tests on {{ editor.version }} on ios
9898
agent:
9999
type: Unity::mobile::iPhone
100-
image: package-ci/macos-12:default
100+
image: package-ci/macos-12:v4.19.0
101101
model: SE
102102
flavor: b1.medium
103103
skip_checkout: true
@@ -115,7 +115,7 @@ build_tvos_{{ editor.version }}:
115115
name: Build Tests on {{ editor.version }} on tvos
116116
agent:
117117
type: Unity::VM::osx
118-
image: package-ci/macos-12:default
118+
image: package-ci/macos-12:v4.19.0
119119
flavor: b1.large
120120
commands:
121121
- {{ utr_install_nix }}
@@ -134,7 +134,7 @@ run_tvos_{{ editor.version }}:
134134
name: Run Tests on {{ editor.version }} on tvos
135135
agent:
136136
type: Unity::mobile::appletv
137-
image: package-ci/macos-12:default
137+
image: package-ci/macos-12:v4.19.0
138138
flavor: b1.medium
139139
skip_checkout: true
140140
dependencies:

Assets/Samples/InGameHints/InGameHintsActions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//------------------------------------------------------------------------------
22
// <auto-generated>
33
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
4-
// version 1.6.1
4+
// version 1.6.2
55
// from Assets/Samples/InGameHints/InGameHintsActions.inputactions
66
//
77
// Changes to this file may cause incorrect behavior and will be lost if

Assets/Samples/SimpleDemo/SimpleControls.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//------------------------------------------------------------------------------
22
// <auto-generated>
33
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
4-
// version 1.6.1
4+
// version 1.6.2
55
// from Assets/Samples/SimpleDemo/SimpleControls.inputactions
66
//
77
// Changes to this file may cause incorrect behavior and will be lost if

Assets/Tests/InputSystem/InputActionCodeGeneratorActions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//------------------------------------------------------------------------------
22
// <auto-generated>
33
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
4-
// version 1.6.1
4+
// version 1.6.2
55
// from Assets/Tests/InputSystem/InputActionCodeGeneratorActions.inputactions
66
//
77
// Changes to this file may cause incorrect behavior and will be lost if
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
#if UNITY_2023_2_OR_NEWER // UnityEngine.InputForUI Module unavailable in earlier releases
2+
using System.Collections.Generic;
3+
using NUnit.Framework;
4+
using UnityEngine;
5+
using UnityEngine.InputForUI;
6+
using UnityEngine.InputSystem;
7+
using UnityEngine.InputSystem.Plugins.InputForUI;
8+
using Event = UnityEngine.InputForUI.Event;
9+
using EventProvider = UnityEngine.InputForUI.EventProvider;
10+
11+
// These tests are not meant to test the InputForUI module itself, but rather the integration between the InputForUI
12+
// module and the InputSystem package.
13+
// Be aware that these tests don't account for events dispatched by the InputEventPartialProvider. Those events are
14+
// already tested in the Input Manager provider.
15+
// Also, the internals to test InputEventPartialProvider are not exposed publicly, so we can't test them here.
16+
public class InputForUITests : InputTestFixture
17+
{
18+
readonly List<Event> m_InputForUIEvents = new List<Event>();
19+
InputSystemProvider m_InputSystemProvider;
20+
21+
[SetUp]
22+
public void SetUp()
23+
{
24+
base.Setup();
25+
26+
var defaultActions = new DefaultInputActions();
27+
defaultActions.Enable();
28+
29+
m_InputSystemProvider = new InputSystemProvider();
30+
EventProvider.SetMockProvider(m_InputSystemProvider);
31+
// Register at least one consumer so the mock update gets invoked
32+
EventProvider.Subscribe(InputForUIOnEvent);
33+
}
34+
35+
[TearDown]
36+
public void TearDown()
37+
{
38+
EventProvider.Unsubscribe(InputForUIOnEvent);
39+
EventProvider.ClearMockProvider();
40+
m_InputForUIEvents.Clear();
41+
}
42+
43+
private bool InputForUIOnEvent(in Event ev)
44+
{
45+
m_InputForUIEvents.Add(ev);
46+
return true;
47+
}
48+
49+
[Test]
50+
[Category("InputForUI")]
51+
public void PointerEventsAreDispatchedFromMouse()
52+
{
53+
var mouse = InputSystem.AddDevice<Mouse>();
54+
Update();
55+
56+
PressAndRelease(mouse.leftButton);
57+
58+
Update();
59+
60+
Assert.IsTrue(m_InputForUIEvents.Count == 2);
61+
Assert.That(m_InputForUIEvents[0].type, Is.EqualTo(Event.Type.PointerEvent));
62+
Assert.That(m_InputForUIEvents[0].asPointerEvent.type, Is.EqualTo(PointerEvent.Type.ButtonPressed));
63+
Assert.That(m_InputForUIEvents[1].type, Is.EqualTo(Event.Type.PointerEvent));
64+
Assert.That(m_InputForUIEvents[1].asPointerEvent.type, Is.EqualTo(PointerEvent.Type.ButtonReleased));
65+
}
66+
67+
[Test]
68+
[Category("InputForUI")]
69+
// Checks that mouse events are ignored when a touch is active.
70+
// This is to workaround the issue ISXB-269 on Windows.
71+
public void TouchIsPressedAndMouseEventsAreIgnored()
72+
{
73+
var touch = InputSystem.AddDevice<Touchscreen>();
74+
var mouse = InputSystem.AddDevice<Mouse>();
75+
// Set initial mouse position to (0.5, 0.5) so that we get a delta when the mouse is moved, to dispatch
76+
// a pointer move event
77+
Set(mouse.position, new Vector2(0.5f, 0.5f));
78+
Update();
79+
80+
// Start touch and move mouse to the same position to replicate the issue of duplicated Mouse events for
81+
// Touch events on Windows.
82+
BeginTouch(1, new Vector2(100f, 0.5f));
83+
Move(mouse.position, new Vector2(100f, 0.5f));
84+
Update();
85+
86+
Assert.IsTrue(m_InputForUIEvents.Count == 1);
87+
Assert.That(m_InputForUIEvents[0] is Event
88+
{
89+
type: Event.Type.PointerEvent,
90+
asPointerEvent: { type: PointerEvent.Type.ButtonPressed,
91+
eventSource: EventSource.Touch }
92+
});
93+
}
94+
95+
[Test]
96+
[Category("InputForUI")]
97+
// Presses a gamepad left stick left and verifies that a navigation move event is dispatched
98+
public void NavigationMoveWorks()
99+
{
100+
var gamepad = InputSystem.AddDevice<Gamepad>();
101+
Update();
102+
Press(gamepad.leftStick.left);
103+
Update();
104+
Release(gamepad.leftStick.left);
105+
Update();
106+
107+
Assert.IsTrue(m_InputForUIEvents.Count == 1);
108+
Assert.That(m_InputForUIEvents[0] is Event
109+
{
110+
type: Event.Type.NavigationEvent,
111+
asNavigationEvent: { type: NavigationEvent.Type.Move,
112+
direction: NavigationEvent.Direction.Left,
113+
eventSource: EventSource.Gamepad}
114+
});
115+
}
116+
117+
[Test]
118+
[Category("InputForUI")]
119+
public void SendWheelEvent()
120+
{
121+
var kScrollUGUIScaleFactor = 3.0f; // See InputSystemProvider OnScrollWheelPerformed() callback
122+
var mouse = InputSystem.AddDevice<Mouse>();
123+
Update();
124+
// Make the minimum step of scroll delta to be ±1.0f
125+
Set(mouse.scroll.y, -1f / kScrollUGUIScaleFactor);
126+
Update();
127+
Assert.IsTrue(m_InputForUIEvents.Count == 1);
128+
Assert.That(m_InputForUIEvents[0].asPointerEvent.scroll, Is.EqualTo(new Vector2(0, 1)));
129+
}
130+
131+
static void Update()
132+
{
133+
EventProvider.NotifyUpdate();
134+
InputSystem.Update();
135+
}
136+
}
137+
#endif

Assets/Tests/InputSystem/Plugins/InputForUITests.cs.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Tests/InputSystem/Plugins/OnScreenTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,7 @@ public IEnumerator Devices_CanHaveOnScreenJoystickControls()
467467
}
468468

469469
[UnityTest]
470+
[Ignore("Failing on 2023.3.3f1 https://jira.unity3d.com/browse/ISX-1462")]
470471
[Category("Devices")]
471472
public IEnumerator Devices_OnScreenStickDoesNotReceivePointerUpEventsInIsolatedMode()
472473
{

Assets/Tests/InputSystem/Plugins/UITests.cs

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1398,6 +1398,37 @@ public IEnumerator UI_CanDriveUIFromMultiplePointers(UIPointerBehavior pointerBe
13981398
Assert.That(scene.rightChildReceiver.events, Has.None.With.Property("type").EqualTo(EventType.Dragging));
13991399
break;
14001400
}
1401+
1402+
scene.leftChildReceiver.events.Clear();
1403+
scene.rightChildReceiver.events.Clear();
1404+
1405+
// Test if creating Pointer events from different devices at the same time results in only one event
1406+
BeginTouch(0, firstPosition, screen: touch1, queueEventOnly: true);
1407+
Press(mouse1.leftButton);
1408+
yield return null;
1409+
EndTouch(0, firstPosition, screen: touch1, queueEventOnly: true);
1410+
Release(mouse1.leftButton);
1411+
yield return null;
1412+
1413+
switch (pointerBehavior)
1414+
{
1415+
case UIPointerBehavior.SingleUnifiedPointer:
1416+
//// Getting "Drop" event even if using only one type of input device for Press/Release.
1417+
//// E.g. the following test would also produce only a Drop event:
1418+
//// Press(mouse1.leftButton);
1419+
//// yield return null;
1420+
//// Release(mouse1.leftButton);
1421+
//// yield return null;
1422+
break;
1423+
case UIPointerBehavior.SingleMouseOrPenButMultiTouchAndTrack:
1424+
case UIPointerBehavior.AllPointersAsIs:
1425+
// Single pointer click on the left object
1426+
Assert.That(scene.leftChildReceiver.events,
1427+
Has.Exactly(1).With.Property("type").EqualTo(EventType.PointerClick).And
1428+
.Matches((UICallbackReceiver.Event e) => e.pointerData.device == mouse1).And
1429+
.Matches((UICallbackReceiver.Event e) => e.pointerData.position == firstPosition));
1430+
break;
1431+
}
14011432
}
14021433

14031434
[UnityTest]
@@ -3798,7 +3829,7 @@ public IEnumerator UI_WhenCursorIsLockedToScreenCenter_PointerEnterAndExitEvents
37983829
}
37993830

38003831
#region Multi Display Tests
3801-
#if UNITY_2023_1_OR_NEWER // displayIndex is only available from 2023.1 onwards
3832+
#if UNITY_2022_3_OR_NEWER // displayIndex is only available from 2022.3 onwards
38023833

38033834
[UnityTest]
38043835
#if UNITY_TVOS
@@ -3854,6 +3885,8 @@ public IEnumerator UI_DisplayIndexMatchesDisplayWithTouchscreenOnScreenSpaceCanv
38543885
[UnityTest]
38553886
#if UNITY_TVOS
38563887
[Ignore("Failing on tvOS https://jira.unity3d.com/browse/ISX-448")]
3888+
#else
3889+
[Ignore("Failing on 2023.3.3f1 https://jira.unity3d.com/browse/ISX-1462")]
38573890
#endif
38583891
public IEnumerator UI_DisplayIndexMatchesDisplayWithTouchscreenOnOverlayCanvas()
38593892
{
@@ -3956,6 +3989,7 @@ public IEnumerator UI_DisplayIndexMatchesDisplayWithMouseOnScreenSpaceCanvas()
39563989
}
39573990

39583991
[UnityTest]
3992+
[Ignore("Failing on 2023.3.3f1 https://jira.unity3d.com/browse/ISX-1462")]
39593993
public IEnumerator UI_DisplayIndexMatchesDisplayWithMouseOnOverlayCanvas()
39603994
{
39613995
// Setup the Test Scene
@@ -4346,7 +4380,7 @@ private static ExtendedPointerEventData ClonePointerEventData(PointerEventData e
43464380
radius = eventData.radius,
43474381
radiusVariance = eventData.radiusVariance,
43484382
#endif
4349-
#if UNITY_2023_1_OR_NEWER
4383+
#if UNITY_2022_3_OR_NEWER
43504384
displayIndex = eventData.displayIndex,
43514385
#endif
43524386
};

Assets/Tests/InputSystem/Unity.InputSystem.Tests.asmdef

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"UnityEngine.TestRunner",
1010
"UnityEditor.TestRunner",
1111
"Unity.PerformanceTesting",
12-
"Unity.Coding.Editor"
12+
"Unity.Coding.Editor",
13+
"Unity.InputSystem.ForUI"
1314
],
1415
"includePlatforms": [],
1516
"excludePlatforms": [],

0 commit comments

Comments
 (0)