Skip to content

Commit c564749

Browse files
committed
Fix test helpers
1 parent 71cbe4e commit c564749

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Assets/Tests/InputSystem.Editor/InputActionsEditorTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ IEnumerator WaitForActionRename(int index, bool isActive, double timeoutSecs = 5
6363
return WaitUntil(() =>
6464
{
6565
var actionItems = m_Window.rootVisualElement.Q("actions-container").Query<InputActionsTreeViewItem>().ToList();
66-
if (actionItems.Count > index && actionItems[index].IsFocused == isActive)
66+
if (actionItems.Count > index && actionItems[index].IsTextFieldFocused == isActive)
6767
{
6868
return true;
6969
}
@@ -211,7 +211,7 @@ public IEnumerator CanRenameAction()
211211
// Click twice to start the rename
212212
SimulateClickOn(actionItem[1]);
213213
// If the item is already focused, don't click again
214-
if (!actionItem[1].IsFocused)
214+
if (!actionItem[1].IsTextFieldFocused)
215215
{
216216
SimulateClickOn(actionItem[1]);
217217
}

Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/InputActionsTreeViewItem.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ internal class InputActionsTreeViewItem : VisualElement
1818
public event EventCallback<string> EditTextFinished;
1919

2020
// for testing purposes to know if the item is focused to accept input
21-
internal bool IsFocused { get; private set; } = false;
21+
internal bool IsTextFieldFocused { get; private set; } = false;
2222

2323
private bool m_IsEditing;
2424
private static InputActionsTreeViewItem s_EditingItem = null;
@@ -38,11 +38,11 @@ public InputActionsTreeViewItem()
3838
renameTextfield.selectAllOnMouseUp = false;
3939

4040
RegisterCallback<MouseDownEvent>(OnMouseDownEventForRename);
41-
renameTextfield.RegisterCallback<FocusInEvent>(e => IsFocused = true);
41+
renameTextfield.RegisterCallback<FocusInEvent>(e => IsTextFieldFocused = true);
4242
renameTextfield.RegisterCallback<FocusOutEvent>(e =>
4343
{
4444
OnEditTextFinished();
45-
IsFocused = false;
45+
IsTextFieldFocused = false;
4646
});
4747
}
4848

@@ -116,6 +116,7 @@ public void FocusOnRenameFinish()
116116
//Everything else has already been taken restored in OnEditTextFinished() but this has to happen after
117117
//listView/treeView reclaims the focus in RedrawUI
118118
label.Q<Label>().Focus();
119+
IsTextFieldFocused = false;
119120
}
120121

121122
async void DelayCall()

0 commit comments

Comments
 (0)