Removed Attribute.Make (use new)

This commit is contained in:
Tigger Kindel
2023-10-10 11:14:15 -06:00
committed by Tig
parent d6412c731d
commit 59339ebe22
6 changed files with 86 additions and 208 deletions

View File

@@ -232,11 +232,11 @@ namespace Terminal.Gui.ConfigurationTests {
{
// Arrange
var expectedColorScheme = new ColorScheme {
Normal = Attribute.Make (Color.White, Color.Blue),
Focus = Attribute.Make (Color.Black, Color.Gray),
HotNormal = Attribute.Make (Color.BrightCyan, Color.Blue),
HotFocus = Attribute.Make (Color.BrightBlue, Color.Gray),
Disabled = Attribute.Make (Color.DarkGray, Color.Blue)
Normal = new Attribute (Color.White, Color.Blue),
Focus = new Attribute (Color.Black, Color.Gray),
HotNormal = new Attribute (Color.BrightCyan, Color.Blue),
HotFocus = new Attribute (Color.BrightBlue, Color.Gray),
Disabled = new Attribute (Color.DarkGray, Color.Blue)
};
var serializedColorScheme = JsonSerializer.Serialize<ColorScheme> (expectedColorScheme, ConfigurationManagerTests._jsonOptions);

View File

@@ -30,7 +30,7 @@ public class AttributeTests {
var attribute = new Attribute (42);
// Assert
Assert.False (attribute.Initialized);
Assert.True (attribute.Initialized);
Assert.Equal (42, attribute.Value);
Assert.Equal ((Color)Color.White, attribute.Foreground);
Assert.Equal ((Color)Color.Black, attribute.Background);
@@ -138,7 +138,7 @@ public class AttributeTests {
var backgroundColor = new Color (255, 255, 255);
// Act
var attribute = Attribute.Make (foregroundColor, backgroundColor);
var attribute = new Attribute (foregroundColor, backgroundColor);
// Assert
Assert.Equal (foregroundColor, attribute.Foreground);
@@ -153,7 +153,7 @@ public class AttributeTests {
var backgroundColorName = ColorNames.Black;
// Act
var attribute = Attribute.Make (foregroundColorName, backgroundColorName);
var attribute = new Attribute (foregroundColorName, backgroundColorName);
// Assert
Assert.Equal ((Color)foregroundColorName, attribute.Foreground);
@@ -168,7 +168,7 @@ public class AttributeTests {
var backgroundColor = new Color (128, 128, 128);
// Act
var attribute = Attribute.Make (foregroundColorName, backgroundColor);
var attribute = new Attribute (foregroundColorName, backgroundColor);
// Assert
Assert.Equal ((Color)foregroundColorName, attribute.Foreground);
@@ -183,7 +183,7 @@ public class AttributeTests {
var backgroundColorName = ColorNames.White;
// Act
var attribute = Attribute.Make (foregroundColor, backgroundColorName);
var attribute = new Attribute (foregroundColor, backgroundColorName);
// Assert
Assert.Equal (foregroundColor, attribute.Foreground);
@@ -228,7 +228,7 @@ public class AttributeTests {
var bg = new Color ();
bg = (Color)Color.Blue;
var a = Attribute.Make (fg, bg);
var a = new Attribute (fg, bg);
Assert.False (a.Initialized);
}
@@ -246,7 +246,7 @@ public class AttributeTests {
var bg = new Color ();
bg = (Color)Color.Blue;
var attr = Attribute.Make (fg, bg);
var attr = new Attribute (fg, bg);
Assert.True (attr.Initialized);
Assert.Equal (fg, attr.Foreground);
Assert.Equal (bg, attr.Background);
@@ -265,7 +265,7 @@ public class AttributeTests {
var bg = new Color ();
bg = (Color)Color.Blue;
var attr = Attribute.Make (fg, bg);
var attr = new Attribute (fg, bg);
Assert.False (attr.Initialized);
Assert.Equal (fg, attr.Foreground);
Assert.Equal (bg, attr.Background);

View File

@@ -904,10 +904,10 @@ namespace Terminal.Gui.ViewsTests {
tv.Bounds = new Rect (0, 0, 5, 4);
var rowHighlight = new ColorScheme () {
Normal = Attribute.Make (Color.BrightCyan, Color.DarkGray),
HotNormal = Attribute.Make (Color.Green, Color.Blue),
HotFocus = Attribute.Make (Color.BrightYellow, Color.White),
Focus = Attribute.Make (Color.Cyan, Color.Magenta),
Normal = new Attribute (Color.BrightCyan, Color.DarkGray),
HotNormal = new Attribute (Color.Green, Color.Blue),
HotFocus = new Attribute (Color.BrightYellow, Color.White),
Focus = new Attribute (Color.Cyan, Color.Magenta),
};
// when B is 2 use the custom highlight colour for the row
@@ -995,10 +995,10 @@ namespace Terminal.Gui.ViewsTests {
// when B is 2 use the custom highlight colour
var cellHighlight = new ColorScheme () {
Normal = Attribute.Make (Color.BrightCyan, Color.DarkGray),
HotNormal = Attribute.Make (Color.Green, Color.Blue),
HotFocus = Attribute.Make (Color.BrightYellow, Color.White),
Focus = Attribute.Make (Color.Cyan, Color.Magenta),
Normal = new Attribute (Color.BrightCyan, Color.DarkGray),
HotNormal = new Attribute (Color.Green, Color.Blue),
HotFocus = new Attribute (Color.BrightYellow, Color.White),
Focus = new Attribute (Color.Cyan, Color.Magenta),
};
bStyle.ColorGetter = (a) => Convert.ToInt32 (a.CellValue) == 2 ? cellHighlight : null;