-
Notifications
You must be signed in to change notification settings - Fork 335
FIX: GetBindingDisplayString returns empty for composites filtered by group-based binding mask [UUM-141423] #2414
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
base: develop
Are you sure you want to change the base?
Changes from all commits
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 |
|---|---|---|
|
|
@@ -9238,6 +9238,38 @@ public void Actions_WhenGettingDisplayTextForBindingsOnAction_CompositesAreForma | |
| Assert.That(action.GetBindingDisplayString(8), Is.EqualTo("Left Shift|Right Shift+A")); | ||
| } | ||
|
|
||
| // https://issuetracker.unity3d.com/product/unity/issues/guid/UUM-141423 | ||
| [Test] | ||
| [Category("Actions")] | ||
| public void Actions_WhenGettingDisplayTextForBindingsOnAction_CompositeIsIncludedWhenAtLeastOnePartMatchesBindingMask() | ||
| { | ||
| var action = new InputAction(); | ||
|
|
||
| action.AddCompositeBinding("1DAxis") | ||
| .With("Negative", "<Keyboard>/a", groups: "Keyboard") | ||
| .With("Positive", "<Keyboard>/d", groups: "Keyboard"); | ||
|
|
||
| Assert.That(action.GetBindingDisplayString(InputBinding.MaskByGroup("Keyboard")), | ||
| Is.EqualTo("A/D")); | ||
| } | ||
|
|
||
| // https://issuetracker.unity3d.com/product/unity/issues/guid/UUM-141423 | ||
| [Test] | ||
| [Category("Actions")] | ||
| public void Actions_WhenGettingDisplayTextForBindingsOnAction_MixedGroupCompositeIsRenderedAtomicallyWhenAnyPartMatchesBindingMask() | ||
| { | ||
| var action = new InputAction(); | ||
|
|
||
| action.AddCompositeBinding("1DAxis") | ||
| .With("Negative", "<Keyboard>/a", groups: "Keyboard") | ||
| .With("Positive", "<Mouse>/leftButton", groups: "Mouse"); | ||
|
|
||
| Assert.That(action.GetBindingDisplayString(InputBinding.MaskByGroup("Keyboard")), | ||
| Is.EqualTo("A/Left Button")); | ||
| Assert.That(action.GetBindingDisplayString(InputBinding.MaskByGroup("Mouse")), | ||
| Is.EqualTo("A/Left Button")); | ||
| } | ||
|
Contributor
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. To address the missing coverage reported by Codecov and verify that composites are correctly excluded when no parts match the mask, consider adding a test case like this: [Test]
[Category("Actions")]
public void Actions_WhenGettingDisplayTextForCompositeWithNoMatchingGroups_IsExcluded()
{
var action = new InputAction();
action.AddCompositeBinding("1DAxis")
.With("Negative", "<Keyboard>/a", groups: "Keyboard")
.With("Positive", "<Keyboard>/d", groups: "Keyboard");
// Should return empty because the 'Gamepad' mask doesn't match any part of the composite
Assert.That(action.GetBindingDisplayString(InputBinding.MaskByGroup("Gamepad")),
Is.Empty);
}🤖 Helpful? 👍/👎
Collaborator
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. This makes sense to add. |
||
|
|
||
| // https://fogbugz.unity3d.com/f/cases/1321175/ | ||
| [Test] | ||
| [Category("Actions")] | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.