UnicodeTests.cs 2.1 KB

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