Skip to content

Commit 230667f

Browse files
committed
Added test case that reproduces the reported bug.
1 parent 0eb0e77 commit 230667f

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

Assets/Tests/InputSystem/CorePerformanceTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public void Performance_ReadEveryKey()
126126
int keyIndex = 0;
127127
foreach (var key in keyboard.allKeys)
128128
{
129-
if (++keyIndex == (int)KeyEx.IMESelected) // Skip IMESelected as it's not a real key.
129+
if (++keyIndex == (int)KeyEx.IMESelected) // Skip IMESelected as it's not a real key. TODO This is incorrect, it should not even be there
130130
continue;
131131
key.ReadValue();
132132
}

Assets/Tests/InputSystem/CoreTests_Devices.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5894,4 +5894,18 @@ public unsafe void Devices_DoesntErrorOutOnMaxTouchCount()
58945894
BeginTouch(i, new Vector2(i * 1.0f, i * 2.0f), time: 0);
58955895
}, Throws.Nothing);
58965896
}
5897+
5898+
// Note: Tested inside this class for now since there are no dedicated device test classes for built-in devices,
5899+
// only for plugin devices.
5900+
[Test, Description("https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1541")]
5901+
[Category("Devices")]
5902+
public void Devices_KeyboardAllKeys_EnumeratesAllKeyControls()
5903+
{
5904+
var keyboard = InputSystem.AddDevice<Keyboard>();
5905+
int index = 0;
5906+
foreach (var key in keyboard.allKeys)
5907+
{
5908+
Assert.NotNull(key, $"Key at index {index++} was null");
5909+
}
5910+
}
58975911
}

0 commit comments

Comments
 (0)