-
Notifications
You must be signed in to change notification settings - Fork 329
FIX: InputActionMap warnings when the UI map is not setup correctly (ISXB-1560) #2229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 13 commits
6c1586c
2efad11
bcae7e7
0778d3e
284d736
56527d6
e74d53f
8ca84f4
76f6071
ba8fc29
8d7373e
4cbf7ec
c4306ad
62301af
b5ee4ff
6d0f19d
765ee06
4a697c3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,7 @@ | |
| using UnityEngine.InputSystem.Editor; | ||
| #endif | ||
| using UnityEngine.InputSystem.Plugins.InputForUI; | ||
| using UnityEngine.InputSystem.Utilities; | ||
| using Event = UnityEngine.InputForUI.Event; | ||
| using EventProvider = UnityEngine.InputForUI.EventProvider; | ||
| using Is = NUnit.Framework.Is; | ||
|
|
@@ -535,19 +536,34 @@ public void DefaultActions_ShouldNotGenerateAnyVerificationWarnings(bool useProj | |
| LogAssert.NoUnexpectedReceived(); | ||
| } | ||
|
|
||
| [Ignore("We currently allow a PWA asset without an UI action map and rely on defaults instead. This allows users that do not want it or use something else to avoid using it.")] | ||
| [Test(Description = "Verifies that user-supplied project-wide input actions generates warnings if action map is missing.")] | ||
| [Test(Description = "Verifies that user-supplied project-wide actions do not generate warnings if action map is missing. We use default actions in this case.")] | ||
| [Category(kTestCategory)] | ||
| public void ActionsWithoutUIMap_ShouldGenerateWarnings() | ||
| public void ActionsWithoutUIMap_ShouldNotGenerateWarnings() | ||
| { | ||
| var asset = ProjectWideActionsAsset.CreateDefaultAssetAtPath(kAssetPath); | ||
| asset.RemoveActionMap(asset.FindActionMap("UI", throwIfNotFound: true)); | ||
|
|
||
| InputSystem.s_Manager.actions = asset; | ||
| Update(); | ||
|
|
||
| LogAssert.NoUnexpectedReceived(); | ||
| } | ||
|
|
||
| [Test(Description = "Verifies that user-supplied project-wide input actions generates warnings if the UI map is present but actions are missing.")] | ||
| [Category(kTestCategory)] | ||
| public void ActionsWithUIMap_MissingActions_ShouldGenerateWarnings() | ||
| { | ||
| var asset = ProjectWideActionsAsset.CreateDefaultAssetAtPath(kAssetPath); | ||
| var uiActionMap = asset.FindActionMap("UI", true); | ||
| for (int i = uiActionMap.m_Actions.Length - 1; i >= 0; i--) | ||
|
||
| { | ||
| ArrayHelpers.EraseAt(ref uiActionMap.m_Actions, uiActionMap.m_Actions.Length - 1); | ||
| } | ||
|
|
||
| InputSystem.s_Manager.actions = asset; | ||
| Update(); | ||
|
|
||
| var link = EditorHelpers.GetHyperlink(kAssetPath); | ||
| LogAssert.Expect(LogType.Warning, new Regex($"^InputActionMap with path 'UI' in asset '{link}' could not be found.")); | ||
| if (InputActionAssetVerifier.DefaultReportPolicy == InputActionAssetVerifier.ReportPolicy.ReportAll) | ||
| { | ||
| LogAssert.Expect(LogType.Warning, new Regex($"^InputAction with path 'UI/Point' in asset '{link}' could not be found.")); | ||
|
|
@@ -559,8 +575,6 @@ public void ActionsWithoutUIMap_ShouldGenerateWarnings() | |
| LogAssert.Expect(LogType.Warning, new Regex($"^InputAction with path 'UI/RightClick' in asset '{link}' could not be found.")); | ||
| LogAssert.Expect(LogType.Warning, new Regex($"^InputAction with path 'UI/ScrollWheel' in asset '{link}' could not be found.")); | ||
| } | ||
| // else: expect suppression of child errors | ||
| LogAssert.NoUnexpectedReceived(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Had an issue here with Teardown logging the warnings again causing the logs to be there twice and fail. If you think I should do this another way let me know. |
||
| } | ||
|
|
||
| [Test(Description = "Verifies that user-supplied project-wide input actions generates warnings if any required action is missing.")] | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.