Implement 3 digit hex parsing (#1708)

This commit is contained in:
Martijn Straathof
2024-12-04 16:31:21 +01:00
committed by GitHub
parent 29ab313bb9
commit 58bf89a56a
2 changed files with 24 additions and 0 deletions

View File

@ -68,6 +68,23 @@ public sealed class ColorTests
color.ShouldBe(Color.Default);
}
[Theory]
[InlineData("ffffff")]
[InlineData("#ffffff")]
[InlineData("fff")]
[InlineData("#fff")]
public void Should_Parse_3_Digit_Hex_Colors_From_Hex(string color)
{
// Given
var expected = new Color(255, 255, 255);
// When
var result = Color.FromHex(color);
// Then
result.ShouldBe(expected);
}
[Fact]
public void Should_Consider_Color_And_Non_Color_Equal()
{