Skip to content

Commit bfaf110

Browse files
committed
Increase timeout in UIToolKitBaseTestWindow instead
1 parent e482d94 commit bfaf110

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

Assets/Tests/InputSystem.Editor/InputActionsEditorTests.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ internal class InputActionsEditorTests : UIToolkitBaseTestWindow<InputActionsEdi
1616
{
1717
#region setup and teardown
1818
InputActionAsset m_Asset;
19-
const double kTimeoutSecs = 10.0;
2019

2120
public override void OneTimeSetUp()
2221
{
@@ -46,7 +45,7 @@ public override IEnumerator UnitySetup()
4645

4746
#region Helper methods
4847

49-
IEnumerator WaitForActionMapRename(int index, bool isActive, double timeoutSecs = 10.0)
48+
IEnumerator WaitForActionMapRename(int index, bool isActive, double timeoutSecs = kDefaultTimeoutSecs)
5049
{
5150
return WaitUntil(() =>
5251
{
@@ -59,7 +58,7 @@ IEnumerator WaitForActionMapRename(int index, bool isActive, double timeoutSecs
5958
}, $"WaitForActionMapRename {index} {isActive}", timeoutSecs);
6059
}
6160

62-
IEnumerator WaitForActionRename(int index, bool isActive, double timeoutSecs = 10.0)
61+
IEnumerator WaitForActionRename(int index, bool isActive, double timeoutSecs = kDefaultTimeoutSecs)
6362
{
6463
return WaitUntil(() =>
6564
{
@@ -128,8 +127,8 @@ public IEnumerator CanRenameActionMap()
128127

129128
// changing the selection triggers a state change, wait for the scheduler to process the frame
130129
yield return WaitForSchedulerLoop();
131-
yield return WaitForNotDirty(kTimeoutSecs);
132-
yield return WaitForFocus(m_Window.rootVisualElement.Q("action-maps-list-view"), kTimeoutSecs);
130+
yield return WaitForNotDirty();
131+
yield return WaitForFocus(m_Window.rootVisualElement.Q("action-maps-list-view"));
133132

134133
// refetch the action map item since the ui may have refreshed.
135134
actionMapItem = actionMapsContainer.Query<InputActionMapsTreeViewItem>().ToList();
@@ -203,14 +202,14 @@ public IEnumerator CanRenameAction()
203202

204203
// Selection change triggers a state change, wait for the scheduler to process the frame
205204
yield return WaitForSchedulerLoop();
206-
yield return WaitForNotDirty(kTimeoutSecs);
207-
yield return WaitForFocus(m_Window.rootVisualElement.Q<TreeView>("actions-tree-view"), kTimeoutSecs);
205+
yield return WaitForNotDirty();
206+
yield return WaitForFocus(m_Window.rootVisualElement.Q<TreeView>("actions-tree-view"));
208207

209208
// Re-fetch the actions since the UI may have refreshed.
210209
actionItem = actionContainer.Query<InputActionsTreeViewItem>().ToList();
211210

212211
SimulateClickOn(actionItem[1]);
213-
yield return WaitForNotDirty(kTimeoutSecs);
212+
yield return WaitForNotDirty();
214213
// If the item is already focused, don't click again
215214
if (!actionItem[1].IsFocused)
216215
{

Assets/Tests/InputSystem.Editor/UIToolkitBaseTestWindow.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
public class UIToolkitBaseTestWindow<T> where T : EditorWindow
1616
{
1717
protected T m_Window;
18+
protected const double kDefaultTimeoutSecs = 10.0f;
1819

1920
#region setup and teardown
2021
[OneTimeSetUp]
@@ -124,7 +125,7 @@ protected void SimulateDeleteCommand()
124125
/// Wait for UI toolkit scheduler to process the frame
125126
/// </summary>
126127
/// <param name="timeoutSecs">Maximum time to wait in seconds.</param>
127-
protected IEnumerator WaitForSchedulerLoop(double timeoutSecs = 5.0)
128+
protected IEnumerator WaitForSchedulerLoop(double timeoutSecs = kDefaultTimeoutSecs)
128129
{
129130
bool done = false;
130131
m_Window.rootVisualElement.schedule.Execute(() => done = true);
@@ -136,7 +137,7 @@ protected IEnumerator WaitForSchedulerLoop(double timeoutSecs = 5.0)
136137
/// </summary>
137138
/// <param name="ve">VisualElement to be focused</param>
138139
/// <param name="timeoutSecs">Maximum time to wait in seconds.</param>
139-
protected IEnumerator WaitForFocus(VisualElement ve, double timeoutSecs = 5.0)
140+
protected IEnumerator WaitForFocus(VisualElement ve, double timeoutSecs = kDefaultTimeoutSecs)
140141
{
141142
return WaitUntil(() => ve.focusController.focusedElement == ve, "WaitForFocus", timeoutSecs);
142143
}
@@ -145,7 +146,7 @@ protected IEnumerator WaitForFocus(VisualElement ve, double timeoutSecs = 5.0)
145146
/// Wait for the windows to be not dirty
146147
/// </summary>
147148
/// <param name="timeoutSecs">Maximum time to wait in seconds.</param>
148-
protected IEnumerator WaitForNotDirty(double timeoutSecs = 5.0)
149+
protected IEnumerator WaitForNotDirty(double timeoutSecs = kDefaultTimeoutSecs)
149150
{
150151
return WaitUntil(() => m_Window.rootVisualElement.panel.isDirty == false, "WaitForNotDirty", timeoutSecs);
151152
}
@@ -156,7 +157,7 @@ protected IEnumerator WaitForNotDirty(double timeoutSecs = 5.0)
156157
/// <param name="action">Lambda to call between frame</param>
157158
/// <param name="assertMessage">Assert Message</param>
158159
/// <param name="timeoutSecs">Maximum time to wait in seconds.</param>
159-
protected IEnumerator WaitUntil(Func<bool> action, string assertMessage, double timeoutSecs = 5.0)
160+
protected IEnumerator WaitUntil(Func<bool> action, string assertMessage, double timeoutSecs = kDefaultTimeoutSecs)
160161
{
161162
var endTime = EditorApplication.timeSinceStartup + timeoutSecs;
162163
do

0 commit comments

Comments
 (0)