2
0

ConsoleDriverTests.cs 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using Xunit;
  6. using Xunit.Abstractions;
  7. // Alias Console to MockConsole so we don't accidentally use Console
  8. using Console = Terminal.Gui.FakeConsole;
  9. namespace Terminal.Gui.DriverTests {
  10. public class ConsoleDriverTests {
  11. readonly ITestOutputHelper output;
  12. public ConsoleDriverTests (ITestOutputHelper output)
  13. {
  14. this.output = output;
  15. }
  16. [Theory]
  17. [InlineData (typeof (FakeDriver))]
  18. //[InlineData (typeof (NetDriver))]
  19. //[InlineData (typeof (CursesDriver))]
  20. //[InlineData (typeof (WindowsDriver))]
  21. public void Init_Inits (Type driverType)
  22. {
  23. var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
  24. Application.Init (driver);
  25. driver.Init (() => { });
  26. Assert.Equal (80, Console.BufferWidth);
  27. Assert.Equal (25, Console.BufferHeight);
  28. // MockDriver is always 80x25
  29. Assert.Equal (Console.BufferWidth, driver.Cols);
  30. Assert.Equal (Console.BufferHeight, driver.Rows);
  31. driver.End ();
  32. // Shutdown must be called to safely clean up Application if Init has been called
  33. Application.Shutdown ();
  34. }
  35. [Theory]
  36. [InlineData (typeof (FakeDriver))]
  37. //[InlineData (typeof (NetDriver))]
  38. //[InlineData (typeof (CursesDriver))]
  39. //[InlineData (typeof (WindowsDriver))]
  40. public void End_Cleans_Up (Type driverType)
  41. {
  42. var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
  43. Application.Init (driver);
  44. driver.Init (() => { });
  45. Console.ForegroundColor = ConsoleColor.Red;
  46. Assert.Equal (ConsoleColor.Red, Console.ForegroundColor);
  47. Console.BackgroundColor = ConsoleColor.Green;
  48. Assert.Equal (ConsoleColor.Green, Console.BackgroundColor);
  49. driver.Move (2, 3);
  50. Assert.Equal (2, Console.CursorLeft);
  51. Assert.Equal (3, Console.CursorTop);
  52. driver.End ();
  53. Assert.Equal (0, Console.CursorLeft);
  54. Assert.Equal (0, Console.CursorTop);
  55. Assert.Equal (ConsoleColor.Gray, Console.ForegroundColor);
  56. Assert.Equal (ConsoleColor.Black, Console.BackgroundColor);
  57. // Shutdown must be called to safely clean up Application if Init has been called
  58. Application.Shutdown ();
  59. }
  60. [Theory]
  61. [InlineData (typeof (FakeDriver))]
  62. public void FakeDriver_Only_Sends_Keystrokes_Through_MockKeyPresses (Type driverType)
  63. {
  64. var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
  65. Application.Init (driver);
  66. var top = Application.Top;
  67. var view = new View ();
  68. var count = 0;
  69. var wasKeyPressed = false;
  70. view.KeyPress += (e) => {
  71. wasKeyPressed = true;
  72. };
  73. top.Add (view);
  74. Application.Iteration += () => {
  75. count++;
  76. if (count == 10) Application.RequestStop ();
  77. };
  78. Application.Run ();
  79. Assert.False (wasKeyPressed);
  80. // Shutdown must be called to safely clean up Application if Init has been called
  81. Application.Shutdown ();
  82. }
  83. [Theory]
  84. [InlineData (typeof (FakeDriver))]
  85. public void FakeDriver_MockKeyPresses (Type driverType)
  86. {
  87. var driver = (ConsoleDriver)Activator.CreateInstance (driverType);
  88. Application.Init (driver);
  89. var text = "MockKeyPresses";
  90. var mKeys = new Stack<ConsoleKeyInfo> ();
  91. foreach (var r in text.Reverse ()) {
  92. var ck = char.IsLetter (r) ? (ConsoleKey)char.ToUpper (r) : (ConsoleKey)r;
  93. var cki = new ConsoleKeyInfo (r, ck, false, false, false);
  94. mKeys.Push (cki);
  95. }
  96. Console.MockKeyPresses = mKeys;
  97. var top = Application.Top;
  98. var view = new View ();
  99. var rText = "";
  100. var idx = 0;
  101. view.KeyPress += (e) => {
  102. Assert.Equal (text [idx], (char)e.KeyEvent.Key);
  103. rText += (char)e.KeyEvent.Key;
  104. Assert.Equal (rText, text.Substring (0, idx + 1));
  105. e.Handled = true;
  106. idx++;
  107. };
  108. top.Add (view);
  109. Application.Iteration += () => {
  110. if (mKeys.Count == 0) Application.RequestStop ();
  111. };
  112. Application.Run ();
  113. Assert.Equal ("MockKeyPresses", rText);
  114. // Shutdown must be called to safely clean up Application if Init has been called
  115. Application.Shutdown ();
  116. }
  117. [Theory]
  118. [InlineData (typeof (FakeDriver))]
  119. public void TerminalResized_Simulation (Type driverType)
  120. {
  121. var driver = (FakeDriver)Activator.CreateInstance (driverType);
  122. Application.Init (driver);
  123. var wasTerminalResized = false;
  124. Application.Resized = (e) => {
  125. wasTerminalResized = true;
  126. Assert.Equal (120, e.Cols);
  127. Assert.Equal (40, e.Rows);
  128. };
  129. Assert.Equal (80, Console.BufferWidth);
  130. Assert.Equal (25, Console.BufferHeight);
  131. // MockDriver is by default 80x25
  132. Assert.Equal (Console.BufferWidth, driver.Cols);
  133. Assert.Equal (Console.BufferHeight, driver.Rows);
  134. Assert.False (wasTerminalResized);
  135. // MockDriver will now be sets to 120x40
  136. driver.SetBufferSize (120, 40);
  137. Assert.Equal (120, Application.Driver.Cols);
  138. Assert.Equal (40, Application.Driver.Rows);
  139. Assert.True (wasTerminalResized);
  140. // MockDriver will still be 120x40
  141. wasTerminalResized = false;
  142. Application.HeightAsBuffer = true;
  143. driver.SetWindowSize (40, 20);
  144. Assert.Equal (120, Application.Driver.Cols);
  145. Assert.Equal (40, Application.Driver.Rows);
  146. Assert.Equal (120, Console.BufferWidth);
  147. Assert.Equal (40, Console.BufferHeight);
  148. Assert.Equal (40, Console.WindowWidth);
  149. Assert.Equal (20, Console.WindowHeight);
  150. Assert.True (wasTerminalResized);
  151. Application.Shutdown ();
  152. }
  153. [Theory]
  154. [InlineData (typeof (FakeDriver))]
  155. public void HeightAsBuffer_Is_False_Left_And_Top_Is_Always_Zero (Type driverType)
  156. {
  157. var driver = (FakeDriver)Activator.CreateInstance (driverType);
  158. Application.Init (driver);
  159. Assert.False (Application.HeightAsBuffer);
  160. Assert.Equal (0, Console.WindowLeft);
  161. Assert.Equal (0, Console.WindowTop);
  162. driver.SetWindowPosition (5, 5);
  163. Assert.Equal (0, Console.WindowLeft);
  164. Assert.Equal (0, Console.WindowTop);
  165. Application.Shutdown ();
  166. }
  167. [Theory]
  168. [InlineData (typeof (FakeDriver))]
  169. public void HeightAsBuffer_Is_True_Left_Cannot_Be_Greater_Than_WindowWidth (Type driverType)
  170. {
  171. var driver = (FakeDriver)Activator.CreateInstance (driverType);
  172. Application.Init (driver);
  173. Application.HeightAsBuffer = true;
  174. Assert.True (Application.HeightAsBuffer);
  175. driver.SetWindowPosition (81, 25);
  176. Assert.Equal (0, Console.WindowLeft);
  177. Assert.Equal (0, Console.WindowTop);
  178. Application.Shutdown ();
  179. }
  180. [Theory]
  181. [InlineData (typeof (FakeDriver))]
  182. public void HeightAsBuffer_Is_True_Left_Cannot_Be_Greater_Than_BufferWidth_Minus_WindowWidth (Type driverType)
  183. {
  184. var driver = (FakeDriver)Activator.CreateInstance (driverType);
  185. Application.Init (driver);
  186. Application.HeightAsBuffer = true;
  187. Assert.True (Application.HeightAsBuffer);
  188. driver.SetWindowPosition (81, 25);
  189. Assert.Equal (0, Console.WindowLeft);
  190. Assert.Equal (0, Console.WindowTop);
  191. // MockDriver will now be sets to 120x25
  192. driver.SetBufferSize (120, 25);
  193. Assert.Equal (120, Application.Driver.Cols);
  194. Assert.Equal (25, Application.Driver.Rows);
  195. Assert.Equal (120, Console.BufferWidth);
  196. Assert.Equal (25, Console.BufferHeight);
  197. Assert.Equal (80, Console.WindowWidth);
  198. Assert.Equal (25, Console.WindowHeight);
  199. driver.SetWindowPosition (121, 25);
  200. Assert.Equal (40, Console.WindowLeft);
  201. Assert.Equal (0, Console.WindowTop);
  202. driver.SetWindowSize (90, 25);
  203. Assert.Equal (120, Application.Driver.Cols);
  204. Assert.Equal (25, Application.Driver.Rows);
  205. Assert.Equal (120, Console.BufferWidth);
  206. Assert.Equal (25, Console.BufferHeight);
  207. Assert.Equal (90, Console.WindowWidth);
  208. Assert.Equal (25, Console.WindowHeight);
  209. driver.SetWindowPosition (121, 25);
  210. Assert.Equal (30, Console.WindowLeft);
  211. Assert.Equal (0, Console.WindowTop);
  212. Application.Shutdown ();
  213. }
  214. [Theory]
  215. [InlineData (typeof (FakeDriver))]
  216. public void HeightAsBuffer_Is_True_Top_Cannot_Be_Greater_Than_WindowHeight (Type driverType)
  217. {
  218. var driver = (FakeDriver)Activator.CreateInstance (driverType);
  219. Application.Init (driver);
  220. Application.HeightAsBuffer = true;
  221. Assert.True (Application.HeightAsBuffer);
  222. driver.SetWindowPosition (80, 26);
  223. Assert.Equal (0, Console.WindowLeft);
  224. Assert.Equal (0, Console.WindowTop);
  225. Application.Shutdown ();
  226. }
  227. [Theory]
  228. [InlineData (typeof (FakeDriver))]
  229. public void HeightAsBuffer_Is_True_Top_Cannot_Be_Greater_Than_BufferHeight_Minus_WindowHeight (Type driverType)
  230. {
  231. var driver = (FakeDriver)Activator.CreateInstance (driverType);
  232. Application.Init (driver);
  233. Application.HeightAsBuffer = true;
  234. Assert.True (Application.HeightAsBuffer);
  235. driver.SetWindowPosition (80, 26);
  236. Assert.Equal (0, Console.WindowLeft);
  237. Assert.Equal (0, Console.WindowTop);
  238. // MockDriver will now be sets to 80x40
  239. driver.SetBufferSize (80, 40);
  240. Assert.Equal (80, Application.Driver.Cols);
  241. Assert.Equal (40, Application.Driver.Rows);
  242. Assert.Equal (80, Console.BufferWidth);
  243. Assert.Equal (40, Console.BufferHeight);
  244. Assert.Equal (80, Console.WindowWidth);
  245. Assert.Equal (25, Console.WindowHeight);
  246. Assert.Equal (0, Console.WindowLeft);
  247. Assert.Equal (0, Console.WindowTop);
  248. driver.SetWindowPosition (80, 40);
  249. Assert.Equal (0, Console.WindowLeft);
  250. Assert.Equal (15, Console.WindowTop);
  251. driver.SetWindowSize (80, 20);
  252. Assert.Equal (80, Application.Driver.Cols);
  253. Assert.Equal (40, Application.Driver.Rows);
  254. Assert.Equal (80, Console.BufferWidth);
  255. Assert.Equal (40, Console.BufferHeight);
  256. Assert.Equal (80, Console.WindowWidth);
  257. Assert.Equal (20, Console.WindowHeight);
  258. Assert.Equal (0, Console.WindowLeft);
  259. Assert.Equal (15, Console.WindowTop);
  260. driver.SetWindowPosition (80, 41);
  261. Assert.Equal (0, Console.WindowLeft);
  262. Assert.Equal (20, Console.WindowTop);
  263. Application.Shutdown ();
  264. }
  265. [Fact, AutoInitShutdown]
  266. public void AddRune_On_Clip_Left_Or_Right_Replace_Previous_Or_Next_Wide_Rune_With_Space ()
  267. {
  268. var tv = new TextView () {
  269. Width = Dim.Fill (),
  270. Height = Dim.Fill (),
  271. Text = @"これは広いルーンラインです。
  272. これは広いルーンラインです。
  273. これは広いルーンラインです。
  274. これは広いルーンラインです。
  275. これは広いルーンラインです。
  276. これは広いルーンラインです。
  277. これは広いルーンラインです。
  278. これは広いルーンラインです。"
  279. };
  280. var win = new Window ("ワイドルーン") { Width = Dim.Fill (), Height = Dim.Fill () };
  281. win.Add (tv);
  282. Application.Top.Add (win);
  283. var lbl = new Label ("ワイドルーン。");
  284. var dg = new Dialog ("テスト", 14, 4, new Button ("選ぶ"));
  285. dg.Add (lbl);
  286. Application.Begin (Application.Top);
  287. Application.Begin (dg);
  288. ((FakeDriver)Application.Driver).SetBufferSize (30, 10);
  289. var expected = @"
  290. ┌ ワイドルーン ──────────────┐
  291. │これは広いルーンラインです。│
  292. │これは広いルーンラインです。│
  293. │これは ┌ テスト ────┐ です。│
  294. │これは │ワイドルーン│ です。│
  295. │これは │ [ 選ぶ ] │ です。│
  296. │これは └────────────┘ です。│
  297. │これは広いルーンラインです。│
  298. │これは広いルーンラインです。│
  299. └────────────────────────────┘
  300. ";
  301. var pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
  302. Assert.Equal (new Rect (0, 0, 30, 10), pos);
  303. }
  304. [Fact, AutoInitShutdown]
  305. public void Write_Do_Not_Change_On_ProcessKey ()
  306. {
  307. var win = new Window ();
  308. Application.Begin (win);
  309. ((FakeDriver)Application.Driver).SetBufferSize (20, 8);
  310. System.Threading.Tasks.Task.Run (() => {
  311. System.Threading.Tasks.Task.Delay (500).Wait ();
  312. Application.MainLoop.Invoke (() => {
  313. var lbl = new Label ("Hello World") { X = Pos.Center () };
  314. var dlg = new Dialog ("Test", new Button ("Ok"));
  315. dlg.Add (lbl);
  316. Application.Begin (dlg);
  317. var expected = @"
  318. ┌──────────────────┐
  319. │┌ Test ─────────┐ │
  320. ││ Hello World │ │
  321. ││ │ │
  322. ││ │ │
  323. ││ [ Ok ] │ │
  324. │└───────────────┘ │
  325. └──────────────────┘
  326. ";
  327. var pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
  328. Assert.Equal (new Rect (0, 0, 20, 8), pos);
  329. Assert.True (dlg.ProcessKey (new KeyEvent (Key.Tab, new KeyModifiers ())));
  330. dlg.Redraw (dlg.Bounds);
  331. expected = @"
  332. ┌──────────────────┐
  333. │┌ Test ─────────┐ │
  334. ││ Hello World │ │
  335. ││ │ │
  336. ││ │ │
  337. ││ [ Ok ] │ │
  338. │└───────────────┘ │
  339. └──────────────────┘
  340. ";
  341. pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
  342. Assert.Equal (new Rect (0, 0, 20, 8), pos);
  343. win.RequestStop ();
  344. });
  345. });
  346. Application.Run (win);
  347. Application.Shutdown ();
  348. }
  349. [Theory]
  350. [InlineData (0x0000001F, 0x241F)]
  351. [InlineData (0x0000007F, 0x247F)]
  352. [InlineData (0x0000009F, 0x249F)]
  353. [InlineData (0x0001001A, 0x1001A)]
  354. public void MakePrintable_Converts_Control_Chars_To_Proper_Unicode (uint code, uint expected)
  355. {
  356. var actual = ConsoleDriver.MakePrintable (code);
  357. Assert.Equal (expected, actual.Value);
  358. }
  359. [Theory]
  360. [InlineData (0x20)]
  361. [InlineData (0x7E)]
  362. [InlineData (0xA0)]
  363. [InlineData (0x010020)]
  364. public void MakePrintable_Does_Not_Convert_Ansi_Chars_To_Unicode (uint code)
  365. {
  366. var actual = ConsoleDriver.MakePrintable (code);
  367. Assert.Equal (code, actual.Value);
  368. }
  369. /// <summary>
  370. /// Sometimes when using remote tools EventKeyRecord sends 'virtual keystrokes'.
  371. /// These are indicated with the wVirtualKeyCode of 231. When we see this code
  372. /// then we need to look to the unicode character (UnicodeChar) instead of the key
  373. /// when telling the rest of the framework what button was pressed. For full details
  374. /// see: https://github.com/gui-cs/Terminal.Gui/issues/2008
  375. /// </summary>
  376. [Theory, AutoInitShutdown]
  377. [ClassData (typeof (PacketTest))]
  378. public void TestVKPacket (uint unicodeCharacter, bool shift, bool alt, bool control, uint initialVirtualKey, uint initialScanCode, Key expectedRemapping, uint expectedVirtualKey, uint expectedScanCode)
  379. {
  380. var modifiers = new ConsoleModifiers ();
  381. if (shift) modifiers |= ConsoleModifiers.Shift;
  382. if (alt) modifiers |= ConsoleModifiers.Alt;
  383. if (control) modifiers |= ConsoleModifiers.Control;
  384. var mappedConsoleKey = ConsoleKeyMapping.GetConsoleKeyFromKey (unicodeCharacter, modifiers, out uint scanCode, out uint outputChar);
  385. if ((scanCode > 0 || mappedConsoleKey == 0) && mappedConsoleKey == initialVirtualKey) Assert.Equal (mappedConsoleKey, initialVirtualKey);
  386. else Assert.Equal (mappedConsoleKey, outputChar < 0xff ? outputChar & 0xff | 0xff << 8 : outputChar);
  387. Assert.Equal (scanCode, initialScanCode);
  388. var keyChar = ConsoleKeyMapping.GetKeyCharFromConsoleKey (mappedConsoleKey, modifiers, out uint consoleKey, out scanCode);
  389. //if (scanCode > 0 && consoleKey == keyChar && consoleKey > 48 && consoleKey > 57 && consoleKey < 65 && consoleKey > 91) {
  390. if (scanCode > 0 && keyChar == 0 && consoleKey == mappedConsoleKey) Assert.Equal (0, (double)keyChar);
  391. else Assert.Equal (keyChar, unicodeCharacter);
  392. Assert.Equal (consoleKey, expectedVirtualKey);
  393. Assert.Equal (scanCode, expectedScanCode);
  394. var top = Application.Top;
  395. top.KeyPress += (e) => {
  396. var after = ShortcutHelper.GetModifiersKey (e.KeyEvent);
  397. Assert.Equal (expectedRemapping, after);
  398. e.Handled = true;
  399. Application.RequestStop ();
  400. };
  401. var iterations = -1;
  402. Application.Iteration += () => {
  403. iterations++;
  404. if (iterations == 0) Application.Driver.SendKeys ((char)mappedConsoleKey, ConsoleKey.Packet, shift, alt, control);
  405. };
  406. Application.Run ();
  407. Application.Shutdown ();
  408. }
  409. public class PacketTest : IEnumerable, IEnumerable<object []> {
  410. public IEnumerator<object []> GetEnumerator ()
  411. {
  412. yield return new object [] { 'a', false, false, false, 'A', 30, Key.a, 'A', 30 };
  413. yield return new object [] { 'A', true, false, false, 'A', 30, Key.A | Key.ShiftMask, 'A', 30 };
  414. yield return new object [] { 'A', true, true, false, 'A', 30, Key.A | Key.ShiftMask | Key.AltMask, 'A', 30 };
  415. yield return new object [] { 'A', true, true, true, 'A', 30, Key.A | Key.ShiftMask | Key.AltMask | Key.CtrlMask, 'A', 30 };
  416. yield return new object [] { 'z', false, false, false, 'Z', 44, Key.z, 'Z', 44 };
  417. yield return new object [] { 'Z', true, false, false, 'Z', 44, Key.Z | Key.ShiftMask, 'Z', 44 };
  418. yield return new object [] { 'Z', true, true, false, 'Z', 44, Key.Z | Key.ShiftMask | Key.AltMask, 'Z', 44 };
  419. yield return new object [] { 'Z', true, true, true, 'Z', 44, Key.Z | Key.ShiftMask | Key.AltMask | Key.CtrlMask, 'Z', 44 };
  420. yield return new object [] { '英', false, false, false, '\0', 0, (Key)'英', '\0', 0 };
  421. yield return new object [] { '英', true, false, false, '\0', 0, (Key)'英' | Key.ShiftMask, '\0', 0 };
  422. yield return new object [] { '英', true, true, false, '\0', 0, (Key)'英' | Key.ShiftMask | Key.AltMask, '\0', 0 };
  423. yield return new object [] { '英', true, true, true, '\0', 0, (Key)'英' | Key.ShiftMask | Key.AltMask | Key.CtrlMask, '\0', 0 };
  424. yield return new object [] { '+', false, false, false, 187, 26, (Key)'+', 187, 26 };
  425. yield return new object [] { '*', true, false, false, 187, 26, (Key)'*' | Key.ShiftMask, 187, 26 };
  426. yield return new object [] { '+', true, true, false, 187, 26, (Key)'+' | Key.ShiftMask | Key.AltMask, 187, 26 };
  427. yield return new object [] { '+', true, true, true, 187, 26, (Key)'+' | Key.ShiftMask | Key.AltMask | Key.CtrlMask, 187, 26 };
  428. yield return new object [] { '1', false, false, false, '1', 2, Key.D1, '1', 2 };
  429. yield return new object [] { '!', true, false, false, '1', 2, (Key)'!' | Key.ShiftMask, '1', 2 };
  430. yield return new object [] { '1', true, true, false, '1', 2, Key.D1 | Key.ShiftMask | Key.AltMask, '1', 2 };
  431. yield return new object [] { '1', true, true, true, '1', 2, Key.D1 | Key.ShiftMask | Key.AltMask | Key.CtrlMask, '1', 2 };
  432. yield return new object [] { '1', false, true, true, '1', 2, Key.D1 | Key.AltMask | Key.CtrlMask, '1', 2 };
  433. yield return new object [] { '2', false, false, false, '2', 3, Key.D2, '2', 3 };
  434. yield return new object [] { '"', true, false, false, '2', 3, (Key)'"' | Key.ShiftMask, '2', 3 };
  435. yield return new object [] { '2', true, true, false, '2', 3, Key.D2 | Key.ShiftMask | Key.AltMask, '2', 3 };
  436. yield return new object [] { '2', true, true, true, '2', 3, Key.D2 | Key.ShiftMask | Key.AltMask | Key.CtrlMask, '2', 3 };
  437. yield return new object [] { '@', false, true, true, '2', 3, (Key)'@' | Key.AltMask | Key.CtrlMask, '2', 3 };
  438. yield return new object [] { '3', false, false, false, '3', 4, Key.D3, '3', 4 };
  439. yield return new object [] { '#', true, false, false, '3', 4, (Key)'#' | Key.ShiftMask, '3', 4 };
  440. yield return new object [] { '3', true, true, false, '3', 4, Key.D3 | Key.ShiftMask | Key.AltMask, '3', 4 };
  441. yield return new object [] { '3', true, true, true, '3', 4, Key.D3 | Key.ShiftMask | Key.AltMask | Key.CtrlMask, '3', 4 };
  442. yield return new object [] { '£', false, true, true, '3', 4, (Key)'£' | Key.AltMask | Key.CtrlMask, '3', 4 };
  443. yield return new object [] { '4', false, false, false, '4', 5, Key.D4, '4', 5 };
  444. yield return new object [] { '$', true, false, false, '4', 5, (Key)'$' | Key.ShiftMask, '4', 5 };
  445. yield return new object [] { '4', true, true, false, '4', 5, Key.D4 | Key.ShiftMask | Key.AltMask, '4', 5 };
  446. yield return new object [] { '4', true, true, true, '4', 5, Key.D4 | Key.ShiftMask | Key.AltMask | Key.CtrlMask, '4', 5 };
  447. yield return new object [] { '§', false, true, true, '4', 5, (Key)'§' | Key.AltMask | Key.CtrlMask, '4', 5 };
  448. yield return new object [] { '5', false, false, false, '5', 6, Key.D5, '5', 6 };
  449. yield return new object [] { '%', true, false, false, '5', 6, (Key)'%' | Key.ShiftMask, '5', 6 };
  450. yield return new object [] { '5', true, true, false, '5', 6, Key.D5 | Key.ShiftMask | Key.AltMask, '5', 6 };
  451. yield return new object [] { '5', true, true, true, '5', 6, Key.D5 | Key.ShiftMask | Key.AltMask | Key.CtrlMask, '5', 6 };
  452. yield return new object [] { '€', false, true, true, '5', 6, (Key)'€' | Key.AltMask | Key.CtrlMask, '5', 6 };
  453. yield return new object [] { '6', false, false, false, '6', 7, Key.D6, '6', 7 };
  454. yield return new object [] { '&', true, false, false, '6', 7, (Key)'&' | Key.ShiftMask, '6', 7 };
  455. yield return new object [] { '6', true, true, false, '6', 7, Key.D6 | Key.ShiftMask | Key.AltMask, '6', 7 };
  456. yield return new object [] { '6', true, true, true, '6', 7, Key.D6 | Key.ShiftMask | Key.AltMask | Key.CtrlMask, '6', 7 };
  457. yield return new object [] { '6', false, true, true, '6', 7, Key.D6 | Key.AltMask | Key.CtrlMask, '6', 7 };
  458. yield return new object [] { '7', false, false, false, '7', 8, Key.D7, '7', 8 };
  459. yield return new object [] { '/', true, false, false, '7', 8, (Key)'/' | Key.ShiftMask, '7', 8 };
  460. yield return new object [] { '7', true, true, false, '7', 8, Key.D7 | Key.ShiftMask | Key.AltMask, '7', 8 };
  461. yield return new object [] { '7', true, true, true, '7', 8, Key.D7 | Key.ShiftMask | Key.AltMask | Key.CtrlMask, '7', 8 };
  462. yield return new object [] { '{', false, true, true, '7', 8, (Key)'{' | Key.AltMask | Key.CtrlMask, '7', 8 };
  463. yield return new object [] { '8', false, false, false, '8', 9, Key.D8, '8', 9 };
  464. yield return new object [] { '(', true, false, false, '8', 9, (Key)'(' | Key.ShiftMask, '8', 9 };
  465. yield return new object [] { '8', true, true, false, '8', 9, Key.D8 | Key.ShiftMask | Key.AltMask, '8', 9 };
  466. yield return new object [] { '8', true, true, true, '8', 9, Key.D8 | Key.ShiftMask | Key.AltMask | Key.CtrlMask, '8', 9 };
  467. yield return new object [] { '[', false, true, true, '8', 9, (Key)'[' | Key.AltMask | Key.CtrlMask, '8', 9 };
  468. yield return new object [] { '9', false, false, false, '9', 10, Key.D9, '9', 10 };
  469. yield return new object [] { ')', true, false, false, '9', 10, (Key)')' | Key.ShiftMask, '9', 10 };
  470. yield return new object [] { '9', true, true, false, '9', 10, Key.D9 | Key.ShiftMask | Key.AltMask, '9', 10 };
  471. yield return new object [] { '9', true, true, true, '9', 10, Key.D9 | Key.ShiftMask | Key.AltMask | Key.CtrlMask, '9', 10 };
  472. yield return new object [] { ']', false, true, true, '9', 10, (Key)']' | Key.AltMask | Key.CtrlMask, '9', 10 };
  473. yield return new object [] { '0', false, false, false, '0', 11, Key.D0, '0', 11 };
  474. yield return new object [] { '=', true, false, false, '0', 11, (Key)'=' | Key.ShiftMask, '0', 11 };
  475. yield return new object [] { '0', true, true, false, '0', 11, Key.D0 | Key.ShiftMask | Key.AltMask, '0', 11 };
  476. yield return new object [] { '0', true, true, true, '0', 11, Key.D0 | Key.ShiftMask | Key.AltMask | Key.CtrlMask, '0', 11 };
  477. yield return new object [] { '}', false, true, true, '0', 11, (Key)'}' | Key.AltMask | Key.CtrlMask, '0', 11 };
  478. yield return new object [] { '\'', false, false, false, 219, 12, (Key)'\'', 219, 12 };
  479. yield return new object [] { '?', true, false, false, 219, 12, (Key)'?' | Key.ShiftMask, 219, 12 };
  480. yield return new object [] { '\'', true, true, false, 219, 12, (Key)'\'' | Key.ShiftMask | Key.AltMask, 219, 12 };
  481. yield return new object [] { '\'', true, true, true, 219, 12, (Key)'\'' | Key.ShiftMask | Key.AltMask | Key.CtrlMask, 219, 12 };
  482. yield return new object [] { '«', false, false, false, 221, 13, (Key)'«', 221, 13 };
  483. yield return new object [] { '»', true, false, false, 221, 13, (Key)'»' | Key.ShiftMask, 221, 13 };
  484. yield return new object [] { '«', true, true, false, 221, 13, (Key)'«' | Key.ShiftMask | Key.AltMask, 221, 13 };
  485. yield return new object [] { '«', true, true, true, 221, 13, (Key)'«' | Key.ShiftMask | Key.AltMask | Key.CtrlMask, 221, 13 };
  486. yield return new object [] { 'á', false, false, false, 'á', 0, (Key)'á', 'A', 30 };
  487. yield return new object [] { 'Á', true, false, false, 'Á', 0, (Key)'Á' | Key.ShiftMask, 'A', 30 };
  488. yield return new object [] { 'à', false, false, false, 'à', 0, (Key)'à', 'A', 30 };
  489. yield return new object [] { 'À', true, false, false, 'À', 0, (Key)'À' | Key.ShiftMask, 'A', 30 };
  490. yield return new object [] { 'é', false, false, false, 'é', 0, (Key)'é', 'E', 18 };
  491. yield return new object [] { 'É', true, false, false, 'É', 0, (Key)'É' | Key.ShiftMask, 'E', 18 };
  492. yield return new object [] { 'è', false, false, false, 'è', 0, (Key)'è', 'E', 18 };
  493. yield return new object [] { 'È', true, false, false, 'È', 0, (Key)'È' | Key.ShiftMask, 'E', 18 };
  494. yield return new object [] { 'í', false, false, false, 'í', 0, (Key)'í', 'I', 23 };
  495. yield return new object [] { 'Í', true, false, false, 'Í', 0, (Key)'Í' | Key.ShiftMask, 'I', 23 };
  496. yield return new object [] { 'ì', false, false, false, 'ì', 0, (Key)'ì', 'I', 23 };
  497. yield return new object [] { 'Ì', true, false, false, 'Ì', 0, (Key)'Ì' | Key.ShiftMask, 'I', 23 };
  498. yield return new object [] { 'ó', false, false, false, 'ó', 0, (Key)'ó', 'O', 24 };
  499. yield return new object [] { 'Ó', true, false, false, 'Ó', 0, (Key)'Ó' | Key.ShiftMask, 'O', 24 };
  500. yield return new object [] { 'ò', false, false, false, 'Ó', 0, (Key)'ò', 'O', 24 };
  501. yield return new object [] { 'Ò', true, false, false, 'Ò', 0, (Key)'Ò' | Key.ShiftMask, 'O', 24 };
  502. yield return new object [] { 'ú', false, false, false, 'ú', 0, (Key)'ú', 'U', 22 };
  503. yield return new object [] { 'Ú', true, false, false, 'Ú', 0, (Key)'Ú' | Key.ShiftMask, 'U', 22 };
  504. yield return new object [] { 'ù', false, false, false, 'ù', 0, (Key)'ù', 'U', 22 };
  505. yield return new object [] { 'Ù', true, false, false, 'Ù', 0, (Key)'Ù' | Key.ShiftMask, 'U', 22 };
  506. yield return new object [] { 'ö', false, false, false, 'ó', 0, (Key)'ö', 'O', 24 };
  507. yield return new object [] { 'Ö', true, false, false, 'Ó', 0, (Key)'Ö' | Key.ShiftMask, 'O', 24 };
  508. yield return new object [] { '<', false, false, false, 226, 86, (Key)'<', 226, 86 };
  509. yield return new object [] { '>', true, false, false, 226, 86, (Key)'>' | Key.ShiftMask, 226, 86 };
  510. yield return new object [] { '<', true, true, false, 226, 86, (Key)'<' | Key.ShiftMask | Key.AltMask, 226, 86 };
  511. yield return new object [] { '<', true, true, true, 226, 86, (Key)'<' | Key.ShiftMask | Key.AltMask | Key.CtrlMask, 226, 86 };
  512. yield return new object [] { 'ç', false, false, false, 192, 39, (Key)'ç', 192, 39 };
  513. yield return new object [] { 'Ç', true, false, false, 192, 39, (Key)'Ç' | Key.ShiftMask, 192, 39 };
  514. yield return new object [] { 'ç', true, true, false, 192, 39, (Key)'ç' | Key.ShiftMask | Key.AltMask, 192, 39 };
  515. yield return new object [] { 'ç', true, true, true, 192, 39, (Key)'ç' | Key.ShiftMask | Key.AltMask | Key.CtrlMask, 192, 39 };
  516. yield return new object [] { '¨', false, true, true, 187, 26, (Key)'¨' | Key.AltMask | Key.CtrlMask, 187, 26 };
  517. yield return new object [] { (uint)Key.PageUp, false, false, false, 33, 73, Key.PageUp, 33, 73 };
  518. yield return new object [] { (uint)Key.PageUp, true, false, false, 33, 73, Key.PageUp | Key.ShiftMask, 33, 73 };
  519. yield return new object [] { (uint)Key.PageUp, true, true, false, 33, 73, Key.PageUp | Key.ShiftMask | Key.AltMask, 33, 73 };
  520. yield return new object [] { (uint)Key.PageUp, true, true, true, 33, 73, Key.PageUp | Key.ShiftMask | Key.AltMask | Key.CtrlMask, 33, 73 };
  521. }
  522. IEnumerator IEnumerable.GetEnumerator () => GetEnumerator ();
  523. }
  524. }
  525. }