public void GetClampedTest() { ColorRGB input = new ColorRGB(2.0f, -3.0f, 0.5f, 1.0f); ColorRGB expected = new ColorRGB(1.0f, 0.0f, 0.5f, 1.0f); ColorRGB actual = input.GetClamped(); Assert.AreEqual(expected, actual); }
public void CompressTest() { ColorRGB actual = new ColorRGB(2.0f, 1.0f, 0.5f, 1.0f); ColorRGB expected = new ColorRGB(1.0f, 0.5f, 0.25f, 0.5f); actual.Normalize(); Assert.AreEqual(expected, actual); }
public void ClampTest() { ColorRGB actual = new ColorRGB(2.0f, -3.0f, 0.5f, 1.0f); ColorRGB expected = new ColorRGB(1.0f, 0.0f, 0.5f, 1.0f); actual.Clamp(); Assert.AreEqual(expected, actual); }
public void GetCompressedShouldEqualCompress() { ColorRGB input = new ColorRGB(1.5f, 0.4f, -51.5f, 0.0f); ColorRGB compress = input.GetCompressed(); input.Normalize(); bool expected = true; bool actual = compress == input; Assert.AreEqual(expected, actual); }
public void GetClampedShouldEqualClamp() { ColorRGB input = new ColorRGB(1.5f, 0.4f, -51.5f, 0.0f); ColorRGB clamp = input.GetClamped(); input.Clamp(); bool expected = true; bool actual = clamp == input; Assert.AreEqual(expected, actual); }
/// <summary> /// Indicates whether this instance and a specified <see cref="ColorRGB"/> are equal. /// </summary> /// <param name="other">A <see cref="ColorRGB"/> instance to compare.</param> /// <returns>true if both instances represent the same value; otherwise, false.</returns> public bool Equals(ColorRGB other) { return this == other; }
public static ColorRGB Clamp(ColorRGB color) { color.Clamp(); return color; }
/// <summary> /// Indicates whether this instance and a specified <see cref="ColorRGB"/> are equal. /// </summary> /// <param name="other">A <see cref="ColorRGB"/> instance to compare.</param> /// <returns>true if both instances represent the same value; otherwise, false.</returns> public bool Equals(ColorRGB other) { return(this == other); }
public static ColorRGB Clamp(ColorRGB color) { color.Clamp(); return(color); }