Merge branch 'v2_develop' into copilot/port-parallelizable-unit-tests

This commit is contained in:
Tig
2025-10-19 09:46:41 -06:00
committed by GitHub
33 changed files with 1419 additions and 303 deletions

View File

@@ -0,0 +1,27 @@
using Xunit;
namespace Terminal.Gui.DrawingTests;
public class ColorStandardColorTests
{
[Fact]
public void ToString_Returns_Standard_Name_For_StandardColor_CadetBlue()
{
// Without the fix, this uses Color(in StandardColor) -> this((int)colorName),
// which sets A=0x00 and prevents name resolution (expects A=0xFF).
var c = new Terminal.Gui.Drawing.Color(Terminal.Gui.Drawing.StandardColor.CadetBlue);
// Expected: named color
Assert.Equal("CadetBlue", c.ToString());
}
[Fact]
public void ToString_G_Prints_Opaque_ARGB_For_StandardColor_CadetBlue()
{
// Without the fix, A=0x00, so "G" prints "#005F9EA0" instead of "#FF5F9EA0".
var c = new Terminal.Gui.Drawing.Color(Terminal.Gui.Drawing.StandardColor.CadetBlue);
// Expected: #AARRGGBB with A=FF (opaque)
Assert.Equal("#FF5F9EA0", c.ToString("G", null));
}
}

View File

@@ -10,7 +10,6 @@ public class SchemeGetAttributeForRoleAlgorithmTests
Attribute normal = new ("Red", "Blue");
Scheme scheme = new (normal);
Assert.NotNull (scheme.Normal);
Assert.Equal (normal, scheme.GetAttributeForRole (VisualRole.Normal));
}

View File

@@ -39,6 +39,40 @@ public class SchemeTests
Assert.True (schemes.ContainsKey ("TopLevel"));
}
[Fact]
public void GetHardCodedSchemes_Have_Expected_Normal_Attributes ()
{
var schemes = Scheme.GetHardCodedSchemes ();
Assert.NotNull (schemes);
// Base
var baseScheme = schemes! ["Base"];
Assert.NotNull (baseScheme);
Assert.Equal (new Attribute (StandardColor.LightBlue, StandardColor.RaisinBlack), baseScheme!.Normal);
// Dialog
var dialogScheme = schemes ["Dialog"];
Assert.NotNull (dialogScheme);
Assert.Equal (new Attribute (StandardColor.LightSkyBlue, StandardColor.OuterSpace), dialogScheme!.Normal);
// Error
var errorScheme = schemes ["Error"];
Assert.NotNull (errorScheme);
Assert.Equal (new Attribute (StandardColor.IndianRed, StandardColor.RaisinBlack), errorScheme!.Normal);
// Menu (Bold style)
var menuScheme = schemes ["Menu"];
Assert.NotNull (menuScheme);
Assert.Equal (new Attribute (StandardColor.Charcoal, StandardColor.LightBlue, TextStyle.Bold), menuScheme!.Normal);
// Toplevel
var toplevelScheme = schemes ["Toplevel"];
Assert.NotNull (toplevelScheme);
Assert.Equal (new Attribute (StandardColor.CadetBlue, StandardColor.Charcoal).ToString (), toplevelScheme!.Normal.ToString ());
}
[Fact]
public void Built_Ins_Are_Implicit ()
{