public void Write_Do_Not_Change_On_ProcessKey() { var win = new Window(); Application.Begin(win); ((FakeDriver)Application.Driver).SetBufferSize(20, 8); System.Threading.Tasks.Task.Run(() => { System.Threading.Tasks.Task.Delay(500).Wait(); Application.MainLoop.Invoke(() => { var lbl = new Label("Hello World") { X = Pos.Center() }; var dlg = new Dialog("Test", new Button("Ok")); dlg.Add(lbl); Application.Begin(dlg); var expected = @" ┌──────────────────┐ │┌ Test ─────────┐ │ ││ Hello World │ │ ││ │ │ ││ │ │ ││ [ Ok ] │ │ │└───────────────┘ │ └──────────────────┘ "; var pos = GraphViewTests.AssertDriverContentsWithFrameAre(expected, output); Assert.Equal(new Rect(0, 0, 20, 8), pos); Assert.True(dlg.ProcessKey(new KeyEvent(Key.Tab, new KeyModifiers()))); dlg.Redraw(dlg.Bounds); expected = @" ┌──────────────────┐ │┌ Test ─────────┐ │ ││ Hello World │ │ ││ │ │ ││ │ │ ││ [ Ok ] │ │ │└───────────────┘ │ └──────────────────┘ "; pos = GraphViewTests.AssertDriverContentsWithFrameAre(expected, output); Assert.Equal(new Rect(0, 0, 20, 8), pos); win.RequestStop(); }); }); Application.Run(win); Application.Shutdown(); }
public void AddRune_On_Clip_Left_Or_Right_Replace_Previous_Or_Next_Wide_Rune_With_Space() { var tv = new TextView() { Width = Dim.Fill(), Height = Dim.Fill(), Text = @"これは広いルーンラインです。 これは広いルーンラインです。 これは広いルーンラインです。 これは広いルーンラインです。 これは広いルーンラインです。 これは広いルーンラインです。 これは広いルーンラインです。 これは広いルーンラインです。" }; var win = new Window("ワイドルーン") { Width = Dim.Fill(), Height = Dim.Fill() }; win.Add(tv); Application.Top.Add(win); var lbl = new Label("ワイドルーン。"); var dg = new Dialog("テスト", 14, 4, new Button("選ぶ")); dg.Add(lbl); Application.Begin(Application.Top); Application.Begin(dg); ((FakeDriver)Application.Driver).SetBufferSize(30, 10); var expected = @" ┌ ワイドルーン ──────────────┐ │これは広いルーンラインです。│ │これは広いルーンラインです。│ │これは ┌ テスト ────┐ です。│ │これは │ワイドルーン│ です。│ │これは │ [ 選ぶ ] │ です。│ │これは └────────────┘ です。│ │これは広いルーンラインです。│ │これは広いルーンラインです。│ └────────────────────────────┘ "; var pos = GraphViewTests.AssertDriverContentsWithFrameAre(expected, output); Assert.Equal(new Rect(0, 0, 30, 10), pos); }