Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
5829249
FIX: 'Pointer should have exited' error on screen rotation.
Jun 17, 2021
b260316
FIX: Initial-state-check flag no handled correctly in editor.
Jul 5, 2021
bed0619
MERGE: develop => fix-pointer-should-have-exited-error.
Jul 9, 2021
1591c51
DOCS: Improve 'initial state check' explanations.
Jul 9, 2021
30e7d70
FIX: Broken test.
Jul 19, 2021
6dd9f89
MERGE: develop => fix-pointer-should-have-exited-error.
Jul 19, 2021
9cd325f
FIX: Broken touch release logic in UI module.
Jul 20, 2021
1de2e78
MERGE: develop => fix-pointer-should-have-exited-error.
Jul 20, 2021
0c30a30
MERGE: develop => fix-pointer-should-have-exited-error.
Jul 26, 2021
903f5ff
FIX: CoreTestsFixture not cleaning up additional scenes.
Jul 26, 2021
034ea1a
FIX: XMLDoc error.
Jul 26, 2021
277f643
MERGE: develop => fix-pointer-should-have-exited-error.
Aug 16, 2021
edd58e0
Updated ignoreFocus to new syntax introduced via focus work
ekcoh Aug 16, 2021
95127ec
FIX: Failing tests.
Aug 17, 2021
1253c68
FIX: Failing tests.
Aug 17, 2021
2052bc3
Small improvement to cleanup code
ekcoh Aug 17, 2021
76f8c8c
Additional changes core test cleanup
ekcoh Aug 17, 2021
df3961f
Temporarily deacativated cleanup code
ekcoh Aug 17, 2021
8fd30b8
Merge branch 'develop' into fix-pointer-should-have-exited-error
ekcoh Aug 17, 2021
9f95be2
Ignored test subject for failed CI
ekcoh Aug 17, 2021
356b3ed
Temporarily ignoring test to find root cause of failing CI
ekcoh Aug 18, 2021
1827ca2
Temporarily disabled state check
ekcoh Aug 18, 2021
ad22256
FIX: Try fix test failures.
Aug 18, 2021
b14865d
MERGE: develop => fix-pointer-should-have-exited-error.
Aug 18, 2021
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
15 changes: 10 additions & 5 deletions Assets/Samples/InGameHints/InGameHintsActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,39 +35,44 @@ public @InGameHintsActions()
""id"": ""7e7492e7-1329-48bb-9fdc-279fd15473b4"",
""expectedControlType"": ""Vector2"",
""processors"": """",
""interactions"": """"
""interactions"": """",
""initialStateCheck"": true
},
{
""name"": ""Look"",
""type"": ""Value"",
""id"": ""981fecc2-2e7a-4d6a-b041-00b47626e0a1"",
""expectedControlType"": ""Vector2"",
""processors"": """",
""interactions"": """"
""interactions"": """",
""initialStateCheck"": true
},
{
""name"": ""PickUp"",
""type"": ""Button"",
""id"": ""5a59bbc2-a3d4-4cbd-88bb-01120d97dc69"",
""expectedControlType"": """",
""processors"": """",
""interactions"": """"
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""Drop"",
""type"": ""Button"",
""id"": ""f37bbe7e-e241-443f-b868-c784e1219f25"",
""expectedControlType"": """",
""processors"": """",
""interactions"": """"
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""Throw"",
""type"": ""Button"",
""id"": ""e450d71c-7cc5-4879-afb5-f3ed682d9824"",
""expectedControlType"": """",
""processors"": """",
""interactions"": """"
""interactions"": """",
""initialStateCheck"": false
}
],
""bindings"": [
Expand Down
9 changes: 6 additions & 3 deletions Assets/Samples/SimpleDemo/SimpleControls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,26 @@ public @SimpleControls()
""id"": ""1077f913-a9f9-41b1-acb3-b9ee0adbc744"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": ""Tap,SlowTap""
""interactions"": ""Tap,SlowTap"",
""initialStateCheck"": false
},
{
""name"": ""move"",
""type"": ""Value"",
""id"": ""50fd2809-3aa3-4a90-988e-1facf6773553"",
""expectedControlType"": ""Vector2"",
""processors"": """",
""interactions"": """"
""interactions"": """",
""initialStateCheck"": true
},
{
""name"": ""look"",
""type"": ""Value"",
""id"": ""c60e0974-d140-4597-a40e-9862193067e9"",
""expectedControlType"": ""Vector2"",
""processors"": """",
""interactions"": """"
""interactions"": """",
""initialStateCheck"": true
}
],
""bindings"": [
Expand Down
19 changes: 16 additions & 3 deletions Assets/Tests/InputSystem/CoreTestsFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,24 @@ public class CoreTestsFixture : InputTestFixture
{
public override void TearDown()
{
// Destroy any GameObject in the current scene that isn't hidden and isn't the
// Unload any additional scenes.
if (SceneManager.sceneCount > 1)
{
// Switch back to UTR scene if this is currently not the active scene
var utrScene = SceneManager.GetSceneAt(0);
if (SceneManager.GetActiveScene() != utrScene)
SceneManager.SetActiveScene(utrScene);

// Unload all other scenes
for (var i = SceneManager.sceneCount - 1; i != 0; --i)
SceneManager.UnloadSceneAsync(SceneManager.GetSceneAt(i));
}

// Destroy any GameObject in the first scene that isn't hidden and isn't the
// test runner object. Do this first so that any cleanup finds the system in the
// state it expects.
var scene = SceneManager.GetActiveScene();
foreach (var go in scene.GetRootGameObjects())
var activeScene = SceneManager.GetActiveScene();
foreach (var go in activeScene.GetRootGameObjects())
{
if (go.hideFlags != 0 || go.name.Contains("tests runner"))
continue;
Expand Down
26 changes: 26 additions & 0 deletions Assets/Tests/InputSystem/CoreTests_Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,32 @@ public void Actions_ButtonActions_DoNotReactToCurrentStateOfControlWhenEnabled()
}
}

[Test]
[Category("Actions")]
public void Actions_ButtonAndPassThroughActions_CanTurnOnInitialStateCheck()
{
var gamepad = InputSystem.AddDevice<Gamepad>();
Press(gamepad.buttonSouth);

var buttonAction = new InputAction(type: InputActionType.Button, binding: "<Gamepad>/buttonSouth");
var passThroughAction = new InputAction(type: InputActionType.PassThrough, binding: "<Gamepad>/buttonSouth");

buttonAction.wantsInitialStateCheck = true;
passThroughAction.wantsInitialStateCheck = true;

using (var buttonTrace = new InputActionTrace(buttonAction))
using (var passThroughTrace = new InputActionTrace(passThroughAction))
{
buttonAction.Enable();
passThroughAction.Enable();

InputSystem.Update();

Assert.That(buttonTrace, Started(buttonAction).AndThen(Performed(buttonAction)));
Assert.That(passThroughTrace, Performed(passThroughAction));
}
}

// It can be useful to react to the value of a control immediately when an action is enabled rather
// than wait for the first time the control changes value. To do so, "Initial State Check" needs to
// be enabled on an action. If this is done and a bound is actuated at the time an action is enabled,
Expand Down
1 change: 1 addition & 0 deletions Assets/Tests/InputSystem/CoreTests_Devices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1899,6 +1899,7 @@ long DeviceCallback(int deviceId, InputDeviceCommand* command, ref bool received

Assert.That(receivedResetDeviceChange, Is.EqualTo(InputDeviceChange.SoftReset));
Assert.That(receivedTouchReset, Is.False);
Assert.That(touch.position.ReadValue(), Is.EqualTo(new Vector2(234, 345)));
Assert.That(touch.primaryTouch.touchId.ReadValue(), Is.EqualTo(1));
Assert.That(touch.primaryTouch.position.ReadValue(), Is.EqualTo(new Vector2(234, 345)));
Assert.That(touch.primaryTouch.press.ReadValue(), Is.Zero);
Expand Down
50 changes: 50 additions & 0 deletions Assets/Tests/InputSystem/Plugins/UITests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2926,6 +2926,56 @@ public IEnumerator UI_CanPreventAutomaticDeselectionOfGameObjects()
Assert.That(scene.eventSystem.currentSelectedGameObject, Is.SameAs(scene.leftGameObject));
}

[UnityTest]
[Category("UI")]
public IEnumerator UI_WhenBindingsAreReResolved_PointerStatesAreKeptInSync()
{
InputSystem.AddDevice<Touchscreen>();

var actions = ScriptableObject.CreateInstance<InputActionAsset>();
var uiActions = actions.AddActionMap("UI");
var pointAction = uiActions.AddAction("Point", type: InputActionType.PassThrough, binding: "<Touchscreen>/position");
var clickAction = uiActions.AddAction("Click", type: InputActionType.PassThrough, binding: "<Touchscreen>/press");

pointAction.wantsInitialStateCheck = true;
clickAction.wantsInitialStateCheck = true;

actions.Enable();

var scene = CreateTestUI();

scene.uiModule.actionsAsset = actions;
scene.uiModule.point = InputActionReference.Create(pointAction);
scene.uiModule.leftClick = InputActionReference.Create(clickAction);

yield return null;

BeginTouch(1, scene.From640x480ToScreen(100, 100), queueEventOnly: true);
yield return null;

Assert.That(EventSystem.current.IsPointerOverGameObject(), Is.True);

actions.Disable();
yield return null;

// UI module keeps pointer over GO in frame of release.
Assert.That(EventSystem.current.IsPointerOverGameObject(), Is.True);

yield return null;

Assert.That(EventSystem.current.IsPointerOverGameObject(), Is.False);

actions.Enable();
yield return null;

Assert.That(EventSystem.current.IsPointerOverGameObject(), Is.True);

pointAction.ApplyBindingOverride("<Touchscreen>/primaryTouch/position");
yield return null;

Assert.That(EventSystem.current.IsPointerOverGameObject(), Is.True);
}

////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
6 changes: 0 additions & 6 deletions Assets/Tests/InputSystem/Utilities/NumberHelpersTests.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
using System;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using UnityEngine;
using UnityEngine.InputSystem.LowLevel;
using UnityEngine.InputSystem.Utilities;

internal class NumberHelpersTests
Expand Down
Loading