mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-22 20:38:47 +00:00
[X10D.Unity] Add tests for Color(32).Deconstruct
This commit is contained in:
parent
55a2e99b82
commit
3607034818
@ -18,6 +18,25 @@ namespace X10D.Unity.Tests.Drawing
|
||||
private static readonly Color32 Magenta = new(255, 0, 255, 255);
|
||||
private static readonly Color32 Yellow = new(255, 255, 0, 255);
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator Deconstruct_ShouldDeconstruct_ToCorrectValues()
|
||||
{
|
||||
byte a, r, g, b;
|
||||
|
||||
(r, g, b) = White;
|
||||
Assert.AreEqual(255, r);
|
||||
Assert.AreEqual(255, g);
|
||||
Assert.AreEqual(255, b);
|
||||
|
||||
(a, r, g, b) = Yellow;
|
||||
Assert.AreEqual(255, a);
|
||||
Assert.AreEqual(255, r);
|
||||
Assert.AreEqual(255, g);
|
||||
Assert.AreEqual(0, b);
|
||||
|
||||
yield break;
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator GetClosestConsoleColor_ShouldReturnClosestColor_GivenValidColor()
|
||||
{
|
||||
|
@ -20,6 +20,25 @@ namespace X10D.Unity.Tests.Drawing
|
||||
private static readonly Color Magenta = new(1, 0, 1);
|
||||
private static readonly Color Yellow = new(1, 1, 0);
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator Deconstruct_ShouldDeconstruct_ToCorrectValues()
|
||||
{
|
||||
float a, r, g, b;
|
||||
|
||||
(r, g, b) = White;
|
||||
Assert.AreEqual(1.0f, r);
|
||||
Assert.AreEqual(1.0f, g);
|
||||
Assert.AreEqual(1.0f, b);
|
||||
|
||||
(a, r, g, b) = Yellow;
|
||||
Assert.AreEqual(1.0f, a);
|
||||
Assert.AreEqual(1.0f, r);
|
||||
Assert.AreEqual(1.0f, g);
|
||||
Assert.AreEqual(0.0f, b);
|
||||
|
||||
yield break;
|
||||
}
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator GetClosestConsoleColor_ShouldReturnClosestColor_GivenValidColor()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user