Skip to content
6 changes: 2 additions & 4 deletions Assets/Tests/InputSystem.Editor/InputActionsEditorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public override IEnumerator UnitySetup()

#region Helper methods

IEnumerator WaitForActionMapRename(int index, bool isActive, double timeoutSecs = 5.0)
IEnumerator WaitForActionMapRename(int index, bool isActive, double timeoutSecs = kDefaultTimeoutSecs)
{
return WaitUntil(() =>
{
Expand All @@ -58,7 +58,7 @@ IEnumerator WaitForActionMapRename(int index, bool isActive, double timeoutSecs
}, $"WaitForActionMapRename {index} {isActive}", timeoutSecs);
}

IEnumerator WaitForActionRename(int index, bool isActive, double timeoutSecs = 5.0)
IEnumerator WaitForActionRename(int index, bool isActive, double timeoutSecs = kDefaultTimeoutSecs)
{
return WaitUntil(() =>
{
Expand Down Expand Up @@ -208,10 +208,8 @@ public IEnumerator CanRenameAction()
// Re-fetch the actions since the UI may have refreshed.
actionItem = actionContainer.Query<InputActionsTreeViewItem>().ToList();

// Click twice to start the rename
SimulateClickOn(actionItem[1]);
yield return WaitForNotDirty();

// If the item is already focused, don't click again
if (!actionItem[1].IsFocused)
{
Expand Down
9 changes: 5 additions & 4 deletions Assets/Tests/InputSystem.Editor/UIToolkitBaseTestWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
public class UIToolkitBaseTestWindow<T> where T : EditorWindow
{
protected T m_Window;
protected const double kDefaultTimeoutSecs = 10.0f;

#region setup and teardown
[OneTimeSetUp]
Expand Down Expand Up @@ -124,7 +125,7 @@ protected void SimulateDeleteCommand()
/// Wait for UI toolkit scheduler to process the frame
/// </summary>
/// <param name="timeoutSecs">Maximum time to wait in seconds.</param>
protected IEnumerator WaitForSchedulerLoop(double timeoutSecs = 5.0)
protected IEnumerator WaitForSchedulerLoop(double timeoutSecs = kDefaultTimeoutSecs)
{
bool done = false;
m_Window.rootVisualElement.schedule.Execute(() => done = true);
Expand All @@ -136,7 +137,7 @@ protected IEnumerator WaitForSchedulerLoop(double timeoutSecs = 5.0)
/// </summary>
/// <param name="ve">VisualElement to be focused</param>
/// <param name="timeoutSecs">Maximum time to wait in seconds.</param>
protected IEnumerator WaitForFocus(VisualElement ve, double timeoutSecs = 5.0)
protected IEnumerator WaitForFocus(VisualElement ve, double timeoutSecs = kDefaultTimeoutSecs)
{
return WaitUntil(() => ve.focusController.focusedElement == ve, "WaitForFocus", timeoutSecs);
}
Expand All @@ -145,7 +146,7 @@ protected IEnumerator WaitForFocus(VisualElement ve, double timeoutSecs = 5.0)
/// Wait for the windows to be not dirty
/// </summary>
/// <param name="timeoutSecs">Maximum time to wait in seconds.</param>
protected IEnumerator WaitForNotDirty(double timeoutSecs = 5.0)
protected IEnumerator WaitForNotDirty(double timeoutSecs = kDefaultTimeoutSecs)
{
return WaitUntil(() => m_Window.rootVisualElement.panel.isDirty == false, "WaitForNotDirty", timeoutSecs);
}
Expand All @@ -156,7 +157,7 @@ protected IEnumerator WaitForNotDirty(double timeoutSecs = 5.0)
/// <param name="action">Lambda to call between frame</param>
/// <param name="assertMessage">Assert Message</param>
/// <param name="timeoutSecs">Maximum time to wait in seconds.</param>
protected IEnumerator WaitUntil(Func<bool> action, string assertMessage, double timeoutSecs = 5.0)
protected IEnumerator WaitUntil(Func<bool> action, string assertMessage, double timeoutSecs = kDefaultTimeoutSecs)
{
var endTime = EditorApplication.timeSinceStartup + timeoutSecs;
do
Expand Down