KeyGestureParseTests.cs 903 B

12345678910111213141516171819202122232425262728
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using Xunit;
  7. namespace Avalonia.Input.UnitTests
  8. {
  9. public class KeyGestureParseTests
  10. {
  11. private static readonly Dictionary<string, KeyGesture> SampleData = new Dictionary<string, KeyGesture>
  12. {
  13. {"Ctrl+A", new KeyGesture {Key = Key.A, Modifiers = InputModifiers.Control}},
  14. {" \tShift\t+Alt +B", new KeyGesture {Key = Key.B, Modifiers = InputModifiers.Shift|InputModifiers.Alt} },
  15. {"Control++", new KeyGesture {Key = Key.OemPlus, Modifiers = InputModifiers.Control} }
  16. };
  17. [Fact]
  18. public void Key_Gesture_Is_Able_To_Parse_Sample_Data()
  19. {
  20. foreach (var d in SampleData)
  21. Assert.Equal(d.Value, KeyGesture.Parse(d.Key));
  22. }
  23. }
  24. }