Smarter focuscolor fix just for Border

This commit is contained in:
Tig
2024-04-15 00:08:26 -06:00
parent c34b23762b
commit 00cc59add2
2 changed files with 12 additions and 50 deletions

View File

@@ -11,7 +11,13 @@ public class BorderTests
[SetupFakeDriver]
public void Border_Parent_HasFocus_Title_Uses_FocusAttribute ()
{
var superView = new View { Width = 10, Height = 10, CanFocus = true };
var otherView = new View { Width = 0, Height = 0, CanFocus = true };
superView.Add (otherView);
var view = new View { Title = "A", Height = 2, Width = 5 };
superView.Add (view);
view.Border.Thickness = new Thickness (0, 1, 0, 0);
view.Border.LineStyle = LineStyle.Single;
@@ -25,9 +31,9 @@ public class BorderTests
Assert.Equal (ColorName.Green, view.Border.GetFocusColor ().Foreground.GetClosestNamedColor ());
Assert.Equal (view.GetFocusColor (), view.Border.GetFocusColor ());
view.BeginInit ();
view.EndInit ();
view.Draw ();
superView.BeginInit ();
superView.EndInit ();
superView.Draw ();
var expected = @"─┤A├─";
TestHelpers.AssertDriverContentsAre (expected, _output);

View File

@@ -250,7 +250,7 @@ public class DrawTests (ITestOutputHelper output)
Assert.Equal (2, r.GetColumns ());
var win = new Window { Title = us };
var view = new View { Text = r.ToString (), Height = Dim.Fill (), Width = Dim.Fill () };
var view = new View { Text = r.ToString (), Height = Dim.Fill (), Width = Dim.Fill ()};
var tf = new TextField { Text = us, Y = 1, Width = 3 };
win.Add (view, tf);
Toplevel top = new ();
@@ -270,29 +270,7 @@ public class DrawTests (ITestOutputHelper output)
TestHelpers.AssertDriverContentsAre (expectedOutput, output);
Attribute [] expectedColors =
{
// 0
Colors.ColorSchemes ["Base"].Normal,
// 1
Colors.ColorSchemes ["Base"].Focus,
// 2
Colors.ColorSchemes ["Base"].HotNormal
};
TestHelpers.AssertDriverAttributesAre (
"""
0011000000
0000000000
0111000000
0000000000
""",
Application.Driver,
expectedColors
);
// This test has nothing to do with color - removing as it is not relevant and fragile
}
// TODO: Refactor this test to not depend on TextView etc... Make it as primitive as possible
@@ -927,29 +905,7 @@ public class DrawTests (ITestOutputHelper output)
TestHelpers.AssertDriverContentsAre (expected, output);
Attribute [] expectedColors =
{
// 0
Colors.ColorSchemes ["Base"].Normal,
// 1
Colors.ColorSchemes ["Base"].Focus,
// 2
Colors.ColorSchemes ["Base"].HotNormal
};
TestHelpers.AssertDriverAttributesAre (
"""
0010000000
0000000000
0111000000
0000000000
""",
Application.Driver,
expectedColors
);
// This test has nothing to do with color - removing as it is not relevant and fragile
}
[Fact]