-
Notifications
You must be signed in to change notification settings - Fork 328
FIX: ISXB-1674 - Input actions asset not converted correctly when upgrading from 1.14.1 (Regression) #2244
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?
FIX: ISXB-1674 - Input actions asset not converted correctly when upgrading from 1.14.1 (Regression) #2244
Changes from all commits
a260324
00b37a5
d637adf
4e76813
a8ba533
ff05b1d
829c4aa
9467adf
3e490f1
a31d971
817ff0e
2914bf7
6daabc9
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 |
---|---|---|
|
@@ -47,15 +47,19 @@ public override float Process(float value, InputControl control) | |
internal class CustomProcessorEnumTest : UIToolkitBaseTestWindow<InputActionsEditorWindow> | ||
{ | ||
InputActionAsset m_Asset; | ||
InputActionMap m_ActionMap; | ||
|
||
public override void OneTimeSetUp() | ||
{ | ||
base.OneTimeSetUp(); | ||
m_Asset = AssetDatabaseUtils.CreateAsset<InputActionAsset>(); | ||
|
||
var actionMap = m_Asset.AddActionMap("Action Map"); | ||
m_ActionMap = m_Asset.AddActionMap("Action Map"); | ||
|
||
actionMap.AddAction("Action", InputActionType.Value, processors: "Custom(SomeEnum=10)"); | ||
var action = m_ActionMap.AddAction("Action", InputActionType.Value, processors: "InvertVector2(invertX=false), Custom(SomeEnum=10)"); | ||
|
||
// A binding is needed to resolve during test. | ||
action.AddBinding("<Gamepad>/leftTrigger"); | ||
} | ||
|
||
public override void OneTimeTearDown() | ||
|
@@ -108,5 +112,24 @@ public IEnumerator ProcessorEnum_ShouldSerializeByValue_WhenSerializedToAsset() | |
|
||
yield return null; | ||
} | ||
|
||
[Test] | ||
public void Migration_ShouldProduceValidActionAsset_WithAllProcessors_AndEnumConverted() | ||
{ | ||
m_ActionMap.ResolveBindings(); | ||
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 test passes without the fix, this means this is not testing what we want. The asset in the editor is created with version 1 already, the migration code is not being run at all as part of this test. There are 2 problems with the way we create the asset:
Also the start data already has the CustomProcessor with the value being 10, the initial value should be 1, and then the conversion should run and upgrade it to 10. This test is not a UI test, but its part of the UIToolkitBaseTestWindow class, I would recommend splitting this test into its own class that has no dependency on the UI. |
||
|
||
var action = m_ActionMap.actions.First(); | ||
var migratedList = UnityEngine.InputSystem.Utilities.NameAndParameters.ParseMultiple(action.processors).ToList(); | ||
|
||
Assert.That(migratedList.Count, Is.EqualTo(2), "Expected two processors."); | ||
Assert.That(migratedList[0].name, Is.EqualTo("InvertVector2"), "First processor should be InvertVector2."); | ||
|
||
var invertX = migratedList[0].parameters.FirstOrDefault(p => p.name == "invertX"); | ||
Assert.That(invertX.name, Is.EqualTo("invertX")); | ||
Assert.That(invertX.value.ToBoolean(), Is.False, "invertX should be false for the first processor."); | ||
|
||
Assert.That(m_ActionMap.m_State.processors[1].GetType(), Is.EqualTo(typeof(CustomProcessor))); | ||
Assert.That((m_ActionMap.m_State.processors[1] as CustomProcessor).SomeEnum, Is.EqualTo(SomeEnum.OptionA)); | ||
} | ||
} | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are missing a test case here that tests that an action map containing 2 processors are working. It's the whole reason we are doing this fix. We know that with a single processor everything was working.