Browse Source

Added two unit tests to check for the MakePrintable cases.

Alexandru Ciobanu 2 năm trước cách đây
mục cha
commit
441960e25e
1 tập tin đã thay đổi với 24 bổ sung0 xóa
  1. 24 0
      UnitTests/ConsoleDriverTests.cs

+ 24 - 0
UnitTests/ConsoleDriverTests.cs

@@ -608,5 +608,29 @@ namespace Terminal.Gui.ConsoleDrivers {
 			Application.Run (win);
 			Application.Shutdown ();
 		}
+		
+		[Theory]
+		[InlineData(0x0000001F, 0x241F)]
+		[InlineData(0x0000007F, 0x247F)]
+		[InlineData(0x0000009F, 0x249F)]
+		[InlineData(0x0001001A, 0x241A)]
+		public void MakePrintable_Converts_Control_Chars_To_Proper_Unicode (uint code, uint expected)
+		{
+			var actual = ConsoleDriver.MakePrintable(code);
+				
+			Assert.Equal (expected, actual.Value);
+		}
+		
+		[Theory]
+		[InlineData(0x20)]
+		[InlineData(0x7E)]
+		[InlineData(0xA0)]
+		[InlineData(0x010020)]
+		public void MakePrintable_Does_Not_Convert_Ansi_Chars_To_Unicode (uint code)
+		{
+			var actual = ConsoleDriver.MakePrintable(code);
+				
+			Assert.Equal (code, actual.Value);
+		}
 	}
 }