public void Adapt_LChab_D50_To_D65(double l1, double c1, double h1, double l2, double c2, double h2) { // arrange var input = new LChabColor(l1, c1, h1, Illuminants.D50); var expectedOutput = new LChabColor(l2, c2, h2); var converter = new ColourfulConverter { TargetLabWhitePoint = Illuminants.D65 }; // action LChabColor output = converter.Adapt(input); // assert Assert.That(output.L, Is.EqualTo(expectedOutput.L).Using(DoubleRoundingComparer)); Assert.That(output.C, Is.EqualTo(expectedOutput.C).Using(DoubleRoundingComparer)); Assert.That(output.h, Is.EqualTo(expectedOutput.h).Using(DoubleRoundingComparer)); }
public void Adapt_Lab_D65_To_D50(double l1, double a1, double b1, double l2, double a2, double b2) { // arrange var input = new LabColor(l1, a1, b1, Illuminants.D65); var expectedOutput = new LabColor(l2, a2, b2); var converter = new ColourfulConverter { TargetLabWhitePoint = Illuminants.D50 }; // action LabColor output = converter.Adapt(input); // assert Assert.That(output.L, Is.EqualTo(expectedOutput.L).Using(DoublePrecisionComparer)); Assert.That(output.a, Is.EqualTo(expectedOutput.a).Using(DoublePrecisionComparer)); Assert.That(output.b, Is.EqualTo(expectedOutput.b).Using(DoublePrecisionComparer)); }
public void Adapt_RGB_sRGB_To_WideGamutRGB(double r1, double g1, double b1, double r2, double g2, double b2) { // arrange var input = new RGBColor(r1, g1, b1, RGBWorkingSpaces.sRGB); var expectedOutput = new RGBColor(r2, g2, b2, RGBWorkingSpaces.WideGamutRGB); var converter = new ColourfulConverter { TargetRGBWorkingSpace = RGBWorkingSpaces.WideGamutRGB }; // action RGBColor output = converter.Adapt(input); // assert Assert.AreEqual(expectedOutput.WorkingSpace, output.WorkingSpace); Assert.That(output.R, Is.EqualTo(expectedOutput.R).Using(DoubleRoundingComparer)); Assert.That(output.G, Is.EqualTo(expectedOutput.G).Using(DoubleRoundingComparer)); Assert.That(output.B, Is.EqualTo(expectedOutput.B).Using(DoubleRoundingComparer)); }
public void Adapt_XYZ_D65_To_D50_XYZScaling(double x1, double y1, double z1, double x2, double y2, double z2) { // arrange var input = new XYZColor(x1, y1, z1); var expectedOutput = new XYZColor(x2, y2, z2); var converter = new ColourfulConverter { ChromaticAdaptation = new VonKriesChromaticAdaptation(LMSTransformationMatrix.XYZScaling), WhitePoint = Illuminants.D50 }; // action XYZColor output = converter.Adapt(input, Illuminants.D65); // assert Assert.That(output.X, Is.EqualTo(expectedOutput.X).Using(DoubleRoundingComparer)); Assert.That(output.Y, Is.EqualTo(expectedOutput.Y).Using(DoubleRoundingComparer)); Assert.That(output.Z, Is.EqualTo(expectedOutput.Z).Using(DoubleRoundingComparer)); }
public void Adapt_XYZ_D65_To_D50_Bradford(double x1, double y1, double z1, double x2, double y2, double z2) { // arrange var input = new XYZColor(x1, y1, z1); var expectedOutput = new XYZColor(x2, y2, z2); var converter = new ColourfulConverter { WhitePoint = Illuminants.D50 }; // action XYZColor output = converter.Adapt(input, Illuminants.D65); // assert Assert.That(output.X, Is.EqualTo(expectedOutput.X).Using(DoubleRoundingComparer)); Assert.That(output.Y, Is.EqualTo(expectedOutput.Y).Using(DoubleRoundingComparer)); Assert.That(output.Z, Is.EqualTo(expectedOutput.Z).Using(DoubleRoundingComparer)); }