diff --git a/UnitTests/Drawing/GradientTests.cs b/UnitTests/Drawing/GradientTests.cs index 0ff4c4a68..8fcfc1354 100644 --- a/UnitTests/Drawing/GradientTests.cs +++ b/UnitTests/Drawing/GradientTests.cs @@ -45,7 +45,7 @@ public class GradientTests var g = new Gradient (stops, steps, loop: false); - // Note that + // Note that maxRow and maxCol are inclusive so this results in 1x1 area i.e. a single cell. var c = Assert.Single (g.BuildCoordinateColorMapping (0, 0, direction)); Assert.Equal (c.Key, new Point(0,0)); Assert.Equal (c.Value, new Color (0, 0, 255)); diff --git a/UnitTests/Drawing/SolidFillTests.cs b/UnitTests/Drawing/SolidFillTests.cs new file mode 100644 index 000000000..50eaa9f9f --- /dev/null +++ b/UnitTests/Drawing/SolidFillTests.cs @@ -0,0 +1,40 @@ + +using Terminal.Gui.Drawing; + +namespace Terminal.Gui.DrawingTests; + +public class SolidFillTests +{ + [Fact] + public void GetColor_ReturnsCorrectColor () + { + // Arrange + var expectedColor = new Color (100, 150, 200); + var solidFill = new SolidFill (expectedColor); + + // Act + var resultColor = solidFill.GetColor (new Point (0, 0)); + + // Assert + Assert.Equal (expectedColor, resultColor); + } + + [Theory] + [InlineData (0, 0)] + [InlineData (1, 1)] + [InlineData (-1, -1)] + [InlineData (100, 100)] + [InlineData (-100, -100)] + public void GetColor_ReturnsSameColorForDifferentPoints (int x, int y) + { + // Arrange + var expectedColor = new Color (50, 100, 150); + var solidFill = new SolidFill (expectedColor); + + // Act + var resultColor = solidFill.GetColor (new Point (x, y)); + + // Assert + Assert.Equal (expectedColor, resultColor); + } +} \ No newline at end of file