Fixes #1846. TabView now clip the draw bounds (#1847)

This commit is contained in:
BDisp
2022-07-04 16:15:48 +01:00
committed by GitHub
parent d8fc1d0e85
commit 38100499a2
2 changed files with 12 additions and 14 deletions

View File

@@ -9,7 +9,7 @@ using System.Globalization;
using Xunit.Abstractions;
namespace Terminal.Gui.Views {
public class TabViewTests {
readonly ITestOutputHelper output;
@@ -25,7 +25,7 @@ namespace Terminal.Gui.Views {
private TabView GetTabView (out TabView.Tab tab1, out TabView.Tab tab2, bool initFakeDriver = true)
{
if(initFakeDriver)
if (initFakeDriver)
InitFakeDriver ();
var tv = new TabView ();
@@ -52,7 +52,6 @@ namespace Terminal.Gui.Views {
Application.Shutdown ();
}
[Fact]
public void EnsureSelectedTabVisible_NullSelect ()
{
@@ -92,7 +91,6 @@ namespace Terminal.Gui.Views {
Application.Shutdown ();
}
[Fact]
public void SelectedTabChanged_Called ()
{
@@ -119,6 +117,7 @@ namespace Terminal.Gui.Views {
// Shutdown must be called to safely clean up Application if Init has been called
Application.Shutdown ();
}
[Fact]
public void RemoveTab_ChangesSelection ()
{
@@ -224,8 +223,6 @@ namespace Terminal.Gui.Views {
Application.Shutdown ();
}
[Fact]
public void SwitchTabBy_OutOfTabsRange ()
{
@@ -242,13 +239,12 @@ namespace Terminal.Gui.Views {
// Shutdown must be called to safely clean up Application if Init has been called
Application.Shutdown ();
}
[Fact,AutoInitShutdown]
[Fact, AutoInitShutdown]
public void TestThinTabView_WithLongNames ()
{
var tv = GetTabView (out var tab1, out var tab2,false);
var tv = GetTabView (out var tab1, out var tab2, false);
tv.Width = 10;
tv.Height = 5;
@@ -306,10 +302,8 @@ namespace Terminal.Gui.Views {
◄ └┐
│hi2 │
└────────┘", output);
}
[Fact, AutoInitShutdown]
public void TestTabView_Width4 ()
{
@@ -327,6 +321,7 @@ namespace Terminal.Gui.Views {
│hi│
└──┘", output);
}
[Fact, AutoInitShutdown]
public void TestTabView_Width3 ()
{
@@ -339,9 +334,10 @@ namespace Terminal.Gui.Views {
GraphViewTests.AssertDriverContentsAre (@"
┌─┐
│hi
│h
└─┘", output);
}
private void InitFakeDriver ()
{
var driver = new FakeDriver ();