Explorar o código

Updated tests for cleaner representation of new functionality

tznind %!s(int64=2) %!d(string=hai) anos
pai
achega
98441c580e
Modificáronse 1 ficheiros con 13 adicións e 6 borrados
  1. 13 6
      UnitTests/ConsoleDriverTests.cs

+ 13 - 6
UnitTests/ConsoleDriverTests.cs

@@ -617,18 +617,25 @@ namespace Terminal.Gui.ConsoleDrivers {
 		/// see: https://github.com/gui-cs/Terminal.Gui/issues/2008
 		/// </summary>
 		[Theory]
-		[InlineData ('A', true, false, false, Key.A)]
-		[InlineData ('z', false, false, false, Key.z)]
-		[InlineData ('=', false, false, false, (Key)'=')]
-		[InlineData ('+', true, false, false, (Key)'+')]
-		public void TestVKPacket (char unicodeCharacter, bool shift, bool alt, bool control, Key expectedRemapping)
+		[InlineData ('A', Key.A)]
+		[InlineData ('z', Key.z)]
+		[InlineData ('=', (Key)'=')]
+		[InlineData ('英', (Key)'英')]
+		[InlineData ('+', (Key)'+')]
+		public void TestVKPacket (char unicodeCharacter, Key expectedRemapping)
 		{
-			var before = new ConsoleKeyInfo (unicodeCharacter, ConsoleKey.Packet, shift, alt, control);
+			var before = new ConsoleKeyInfo (unicodeCharacter, ConsoleKey.Packet, false, false, false);
 			Assert.True (WindowsDriver.TryRemapPacketKey (before, out var after));
 
 			// The thing we are really interested in, did we correctly convert
 			// the input ConsoleKey.Packet to the correct physical key
 			Assert.Equal (expectedRemapping, after);
 		}
+		[Fact]
+		public void TestVKPacketWithZero ()
+		{
+			var before = new ConsoleKeyInfo ('\0', ConsoleKey.Packet, false, false, false);
+			Assert.False (WindowsDriver.TryRemapPacketKey (before, out var after),"Expected there to be no attempt to map \\0 to a Key");
+		}
 	}
 }