Add full constructor to ColorScheme

This commit is contained in:
tznind
2024-03-22 20:30:48 +00:00
parent 37c8969169
commit b5747cce50
2 changed files with 38 additions and 0 deletions

View File

@@ -48,6 +48,21 @@ public record ColorScheme : IEqualityOperators<ColorScheme, ColorScheme, bool>
_hotFocus = attribute;
}
/// <summary>Creates a new instance, initialized with the values provided.</summary>
public ColorScheme (
Attribute normal,
Attribute focus,
Attribute hotNormal,
Attribute disabled,
Attribute hotFocus)
{
_normal = normal;
_focus = focus;
_hotNormal = hotNormal;
_disabled = disabled;
_hotFocus = hotFocus;
}
/// <summary>The default foreground and background color for text when the view is disabled.</summary>
public Attribute Disabled
{

View File

@@ -38,4 +38,27 @@ public class ColorSchemeTests
lbl.ColorScheme = scheme;
lbl.Draw ();
}
[Fact]
public void ColorScheme_BigConstructor ()
{
var a = new Attribute (1);
var b = new Attribute (2);
var c = new Attribute (3);
var d = new Attribute (4);
var e = new Attribute (5);
var cs = new ColorScheme (
normal: a,
focus: b,
hotNormal: c,
disabled: d,
hotFocus: e);
Assert.Equal (a, cs.Normal);
Assert.Equal (b, cs.Focus);
Assert.Equal (c, cs.HotNormal);
Assert.Equal (d, cs.Disabled);
Assert.Equal (e, cs.HotFocus);
}
}