mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-09 22:55:42 +00:00
[ci skip] Define colors as fields
This commit is contained in:
parent
df0257f498
commit
176ad9fa09
@ -1,4 +1,4 @@
|
||||
using System.Drawing;
|
||||
using System.Drawing;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using X10D.Drawing;
|
||||
|
||||
@ -7,26 +7,26 @@ namespace X10D.Tests.Drawing;
|
||||
[TestClass]
|
||||
public class ColorTests
|
||||
{
|
||||
private static readonly Color Black = Color.FromArgb(0, 0, 0);
|
||||
private static readonly Color White = Color.FromArgb(255, 255, 255);
|
||||
private static readonly Color Red = Color.FromArgb(255, 0, 0);
|
||||
private static readonly Color Green = Color.FromArgb(0, 255, 0);
|
||||
private static readonly Color Blue = Color.FromArgb(0, 0, 255);
|
||||
private static readonly Color Cyan = Color.FromArgb(0, 255, 255);
|
||||
private static readonly Color Magenta = Color.FromArgb(255, 0, 255);
|
||||
private static readonly Color Yellow = Color.FromArgb(255, 255, 0);
|
||||
|
||||
[TestMethod]
|
||||
public void Inverted_ShouldReturnInvertedColor()
|
||||
{
|
||||
Color black = Color.FromArgb(0, 0, 0);
|
||||
Color white = Color.FromArgb(255, 255, 255);
|
||||
Color red = Color.FromArgb(255, 0, 0);
|
||||
Color green = Color.FromArgb(0, 255, 0);
|
||||
Color blue = Color.FromArgb(0, 0, 255);
|
||||
Color cyan = Color.FromArgb(0, 255, 255);
|
||||
Color magenta = Color.FromArgb(255, 0, 255);
|
||||
Color yellow = Color.FromArgb(255, 255, 0);
|
||||
|
||||
Assert.AreEqual(white, black.Inverted());
|
||||
Assert.AreEqual(black, white.Inverted());
|
||||
Assert.AreEqual(red, cyan.Inverted());
|
||||
Assert.AreEqual(cyan, red.Inverted());
|
||||
Assert.AreEqual(green, magenta.Inverted());
|
||||
Assert.AreEqual(magenta, green.Inverted());
|
||||
Assert.AreEqual(yellow, blue.Inverted());
|
||||
Assert.AreEqual(blue, yellow.Inverted());
|
||||
Assert.AreEqual(White, Black.Inverted());
|
||||
Assert.AreEqual(Black, White.Inverted());
|
||||
Assert.AreEqual(Red, Cyan.Inverted());
|
||||
Assert.AreEqual(Cyan, Red.Inverted());
|
||||
Assert.AreEqual(Green, Magenta.Inverted());
|
||||
Assert.AreEqual(Magenta, Green.Inverted());
|
||||
Assert.AreEqual(Yellow, Blue.Inverted());
|
||||
Assert.AreEqual(Blue, Yellow.Inverted());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
@ -8,26 +8,26 @@ namespace X10D.Unity.Tests.Drawing
|
||||
{
|
||||
public class Color32Tests
|
||||
{
|
||||
private static readonly Color32 Black = new(0, 0, 0, 1);
|
||||
private static readonly Color32 White = new(255, 255, 255, 1);
|
||||
private static readonly Color32 Red = new(255, 0, 0, 1);
|
||||
private static readonly Color32 Green = new(0, 255, 0, 1);
|
||||
private static readonly Color32 Blue = new(0, 0, 255, 1);
|
||||
private static readonly Color32 Cyan = new(0, 255, 255, 1);
|
||||
private static readonly Color32 Magenta = new(255, 0, 255, 1);
|
||||
private static readonly Color32 Yellow = new(255, 255, 0, 1);
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator Inverted_ShouldReturnInvertedColor()
|
||||
{
|
||||
var black = new Color32(0, 0, 0, 1);
|
||||
var white = new Color32(255, 255, 255, 1);
|
||||
var red = new Color32(255, 0, 0, 1);
|
||||
var green = new Color32(0, 255, 0, 1);
|
||||
var blue = new Color32(0, 0, 255, 1);
|
||||
var cyan = new Color32(0, 255, 255, 1);
|
||||
var magenta = new Color32(255, 0, 255, 1);
|
||||
var yellow = new Color32(255, 255, 0, 1);
|
||||
|
||||
Assert.AreEqual(white, black.Inverted());
|
||||
Assert.AreEqual(black, white.Inverted());
|
||||
Assert.AreEqual(red, cyan.Inverted());
|
||||
Assert.AreEqual(cyan, red.Inverted());
|
||||
Assert.AreEqual(green, magenta.Inverted());
|
||||
Assert.AreEqual(magenta, green.Inverted());
|
||||
Assert.AreEqual(yellow, blue.Inverted());
|
||||
Assert.AreEqual(blue, yellow.Inverted());
|
||||
Assert.AreEqual(White, Black.Inverted());
|
||||
Assert.AreEqual(Black, White.Inverted());
|
||||
Assert.AreEqual(Red, Cyan.Inverted());
|
||||
Assert.AreEqual(Cyan, Red.Inverted());
|
||||
Assert.AreEqual(Green, Magenta.Inverted());
|
||||
Assert.AreEqual(Magenta, Green.Inverted());
|
||||
Assert.AreEqual(Yellow, Blue.Inverted());
|
||||
Assert.AreEqual(Blue, Yellow.Inverted());
|
||||
|
||||
yield break;
|
||||
}
|
||||
|
@ -8,26 +8,26 @@ namespace X10D.Unity.Tests.Drawing
|
||||
{
|
||||
public class ColorTests
|
||||
{
|
||||
private static readonly Color Black = new(0, 0, 0);
|
||||
private static readonly Color White = new(1, 1, 1);
|
||||
private static readonly Color Red = new(1, 0, 0);
|
||||
private static readonly Color Green = new(0, 1, 0);
|
||||
private static readonly Color Blue = new(0, 0, 1);
|
||||
private static readonly Color Cyan = new(0, 1, 1);
|
||||
private static readonly Color Magenta = new(1, 0, 1);
|
||||
private static readonly Color Yellow = new(1, 1, 0);
|
||||
|
||||
[UnityTest]
|
||||
public IEnumerator Inverted_ShouldReturnInvertedColor()
|
||||
{
|
||||
var black = new Color(0, 0, 0);
|
||||
var white = new Color(1, 1, 1);
|
||||
var red = new Color(1, 0, 0);
|
||||
var green = new Color(0, 1, 0);
|
||||
var blue = new Color(0, 0, 1);
|
||||
var cyan = new Color(0, 1, 1);
|
||||
var magenta = new Color(1, 0, 1);
|
||||
var yellow = new Color(1, 1, 0);
|
||||
|
||||
Assert.AreEqual(white, black.Inverted());
|
||||
Assert.AreEqual(black, white.Inverted());
|
||||
Assert.AreEqual(red, cyan.Inverted());
|
||||
Assert.AreEqual(cyan, red.Inverted());
|
||||
Assert.AreEqual(green, magenta.Inverted());
|
||||
Assert.AreEqual(magenta, green.Inverted());
|
||||
Assert.AreEqual(yellow, blue.Inverted());
|
||||
Assert.AreEqual(blue, yellow.Inverted());
|
||||
Assert.AreEqual(White, Black.Inverted());
|
||||
Assert.AreEqual(Black, White.Inverted());
|
||||
Assert.AreEqual(Red, Cyan.Inverted());
|
||||
Assert.AreEqual(Cyan, Red.Inverted());
|
||||
Assert.AreEqual(Green, Magenta.Inverted());
|
||||
Assert.AreEqual(Magenta, Green.Inverted());
|
||||
Assert.AreEqual(Yellow, Blue.Inverted());
|
||||
Assert.AreEqual(Blue, Yellow.Inverted());
|
||||
|
||||
yield break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user