mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Fix note comment and add tests for SolidFill class
This commit is contained in:
@@ -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));
|
||||
|
||||
40
UnitTests/Drawing/SolidFillTests.cs
Normal file
40
UnitTests/Drawing/SolidFillTests.cs
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user