mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-01 16:59:35 +01:00
Add unit test for the MapChar method
This commit is contained in:
@@ -1538,6 +1538,22 @@ public class EscSeqUtilsTests
|
||||
Assert.Equal (expected, actual);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData ('\u001B', KeyCode.Esc)]
|
||||
[InlineData ('\r', KeyCode.Enter)]
|
||||
[InlineData ('1', KeyCode.D1)]
|
||||
[InlineData ('!', (KeyCode)'!')]
|
||||
[InlineData ('a', KeyCode.A)]
|
||||
[InlineData ('A', KeyCode.A | KeyCode.ShiftMask)]
|
||||
public void MapChar_Returns_Modifiers_If_Needed (char ch, KeyCode keyCode)
|
||||
{
|
||||
ConsoleKeyInfo cki = EscSeqUtils.MapChar (ch);
|
||||
Key key = EscSeqUtils.MapKey (cki);
|
||||
Key expectedKey = keyCode;
|
||||
|
||||
Assert.Equal (key, expectedKey);
|
||||
}
|
||||
|
||||
private void ClearAll ()
|
||||
{
|
||||
EscSeqRequests.Clear ();
|
||||
|
||||
Reference in New Issue
Block a user