UnicodeTests.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using Xunit;
  2. using Xunit.Abstractions;
  3. // Alias Console to MockConsole so we don't accidentally use Console
  4. namespace Terminal.Gui.TextTests;
  5. public class UnicodeTests {
  6. readonly ITestOutputHelper _output;
  7. public UnicodeTests (ITestOutputHelper output)
  8. {
  9. this._output = output;
  10. }
  11. [Fact, AutoInitShutdown]
  12. public void AddRune_On_Clip_Left_Or_Right_Replace_Previous_Or_Next_Wide_Rune_With_Space ()
  13. {
  14. var tv = new TextView () {
  15. Width = Dim.Fill (),
  16. Height = Dim.Fill (),
  17. Text = @"これは広いルーンラインです。
  18. これは広いルーンラインです。
  19. これは広いルーンラインです。
  20. これは広いルーンラインです。
  21. これは広いルーンラインです。
  22. これは広いルーンラインです。
  23. これは広いルーンラインです。
  24. これは広いルーンラインです。"
  25. };
  26. var win = new Window () { Width = Dim.Fill (), Height = Dim.Fill () };
  27. win.Add (tv);
  28. Application.Top.Add (win);
  29. var lbl = new Label ("ワイドルーン。");
  30. var dg = new Dialog (new Button ("選ぶ")) { Width = 14, Height = 4 };
  31. dg.Add (lbl);
  32. Application.Begin (Application.Top);
  33. Application.Begin (dg);
  34. ((FakeDriver)Application.Driver).SetBufferSize (30, 10);
  35. var expected = @$"
  36. ┌────────────────────────────┐
  37. │これは広いルーンラインです。│
  38. │これは広いルーンラインです。│
  39. │これは ┌────────────┐ です。│
  40. │これは │ワイドルーン│ です。│
  41. │これは │ {CM.Glyphs.LeftBracket} 選ぶ {CM.Glyphs.RightBracket} │ です。│
  42. │これは └────────────┘ です。│
  43. │これは広いルーンラインです。│
  44. │これは広いルーンラインです。│
  45. └────────────────────────────┘
  46. ";
  47. var pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
  48. Assert.Equal (new Rect (0, 0, 30, 10), pos);
  49. }
  50. }