From 3806968c82841c787bc9f4608ccd575a5c9f7da4 Mon Sep 17 00:00:00 2001 From: Trudy Spiller Date: Fri, 1 Nov 2024 15:34:16 +0000 Subject: [PATCH 1/7] Add RenameAction test --- .../InputActionsEditorTests.cs | 64 ++++++++++++++++++- .../Views/InputActionsTreeViewItem.cs | 11 +++- 2 files changed, 72 insertions(+), 3 deletions(-) diff --git a/Assets/Tests/InputSystem.Editor/InputActionsEditorTests.cs b/Assets/Tests/InputSystem.Editor/InputActionsEditorTests.cs index ffe160c38f..b47f6e488d 100644 --- a/Assets/Tests/InputSystem.Editor/InputActionsEditorTests.cs +++ b/Assets/Tests/InputSystem.Editor/InputActionsEditorTests.cs @@ -21,9 +21,12 @@ public override void OneTimeSetUp() { base.OneTimeSetUp(); m_Asset = AssetDatabaseUtils.CreateAsset(); - m_Asset.AddActionMap("First Name"); + var actionMap = m_Asset.AddActionMap("First Name"); m_Asset.AddActionMap("Second Name"); m_Asset.AddActionMap("Third Name"); + + actionMap.AddAction("Action One"); + actionMap.AddAction("Action Two"); } public override void OneTimeTearDown() @@ -55,6 +58,19 @@ IEnumerator WaitForActionMapRename(int index, bool isActive, double timeoutSecs }, $"WaitForActionMapRename {index} {isActive}", timeoutSecs); } + IEnumerator WaitForActionRename(int index, bool isActive, double timeoutSecs = 5.0) + { + return WaitUntil(() => + { + var actionItems = m_Window.rootVisualElement.Q("actions-container").Query().ToList(); + if (actionItems.Count > index && actionItems[index].IsFocused == isActive) + { + return true; + } + return false; + }, $"WaitForActionRename {index} {isActive}", timeoutSecs); + } + #endregion [Test] @@ -173,5 +189,51 @@ public IEnumerator CanDeleteActionMap() Assert.That(m_Window.currentAssetInEditor.actionMaps[0].name, Is.EqualTo("First Name")); Assert.That(m_Window.currentAssetInEditor.actionMaps[1].name, Is.EqualTo("Third Name")); } + + [UnityTest] + public IEnumerator CanRenameAction() + { + var actionContainer = m_Window.rootVisualElement.Q("actions-container"); + var actionItem = actionContainer.Query().ToList(); + Assume.That(actionItem[1].Q