예제 #1
0
    private static void AreEqual(QuantumType expected, QuantumType actual, MagickColor actualColor, float delta, string channel)
    {
#if (Q16HDRI)
      if (double.IsNaN(actual))
        actual = 0;
#endif

      Assert.AreEqual(expected, actual, delta, channel + " is not equal (" + actualColor.ToString() + ")");
    }
예제 #2
0
 public static void AreNotEqual(MagickColor notExpected, MagickColor actual)
 {
   if (notExpected.R == actual.R && notExpected.G == actual.G &&
      notExpected.B == actual.B && notExpected.A == actual.A)
     Assert.Fail("Colors are the same (" + actual.ToString() + ")");
 }
예제 #3
0
    public void Test_ToString()
    {
      MagickColor color = new MagickColor(Color.Red);
#if Q8
      Assert.AreEqual("#FF0000FF", color.ToString());
#elif Q16 || Q16HDRI
      Assert.AreEqual("#FFFF00000000FFFF", color.ToString());
#else
#error Not implemented!
#endif

#if Q8
      color = new MagickColor(0, Quantum.Max, 0, 0, (System.Byte)(Quantum.Max / 3));
#elif Q16
      color = new MagickColor(0, Quantum.Max, 0, 0, (System.UInt16)(Quantum.Max / 3));
#elif Q16HDRI
      color = new MagickColor(0, Quantum.Max, 0, 0, (System.Single)(Quantum.Max / 3));
#else
#error Not implemented!
#endif
      Assert.AreEqual("cmyka(0," + Quantum.Max + ",0,0,0.3333)", color.ToString());

      color = new MagickColor(0, Quantum.Max, 0, 0, Quantum.Max);
      Assert.AreEqual("cmyka(0," + Quantum.Max + ",0,0,1.0)", color.ToString());
    }