Esempio n. 1
0
    public void Equals_Same()
    {
        var first  = new xyYColor(x: .1, y: .205, luminance: .45445);
        var second = new xyYColor(x: .1, y: .205, luminance: .45445);

        CustomAssert.EqualsWithHashCode(first, second);
    }
Esempio n. 2
0
    public void FromGrayCtor()
    {
        var first  = new LinearRGBColor(r: .4, g: .4, b: .4);
        var second = LinearRGBColor.FromGray(.4);

        CustomAssert.EqualsWithHashCode(first, second);
    }
Esempio n. 3
0
    public void Equals_Same()
    {
        var first  = new LinearRGBColor(r: .1, g: .205, b: .45445);
        var second = new LinearRGBColor(r: .1, g: .205, b: .45445);

        CustomAssert.EqualsWithHashCode(first, second);
    }
Esempio n. 4
0
    public void Equals_Same()
    {
        var first  = new JzCzhzColor(jz: 0.6, cz: 0.3, hz: 150);
        var second = new JzCzhzColor(jz: 0.6, cz: 0.3, hz: 150);

        CustomAssert.EqualsWithHashCode(first, second);
    }
Esempio n. 5
0
    public void Equals_Same()
    {
        var first  = new LuvColor(l: 10, u: 20.5, v: 45.445);
        var second = new LuvColor(l: 10, u: 20.5, v: 45.445);

        CustomAssert.EqualsWithHashCode(first, second);
    }
Esempio n. 6
0
    public void Equals_Same()
    {
        var first  = new xyChromaticity(x: .1, y: .205);
        var second = new xyChromaticity(x: .1, y: .205);

        CustomAssert.EqualsWithHashCode(first, second);
    }
    public void Equals_Same()
    {
        var first  = new HunterLabColor(l: 10, a: 20.5, b: 45.445);
        var second = new HunterLabColor(l: 10, a: 20.5, b: 45.445);

        CustomAssert.EqualsWithHashCode(first, second);
    }
Esempio n. 8
0
    public void Equals_Same()
    {
        var first  = new JzazbzColor(jz: 0.6, az: -0.3, bz: 0.01);
        var second = new JzazbzColor(jz: 0.6, az: -0.3, bz: 0.01);

        CustomAssert.EqualsWithHashCode(first, second);
    }
Esempio n. 9
0
    public void Equals_Same()
    {
        var first  = new LMSColor(l: .1, m: .205, s: .45445);
        var second = new LMSColor(l: .1, m: .205, s: .45445);

        CustomAssert.EqualsWithHashCode(first, second);
    }
Esempio n. 10
0
    public void VectorCtor()
    {
        var first  = new LinearRGBColor(r: .2, g: .205, b: .45445);
        var vector = new[] { .2, .205, .45445 };
        var second = new LinearRGBColor(vector);

        CustomAssert.EqualsWithHashCode(first, second);
        Assert.Equal(vector, second.Vector);
    }
Esempio n. 11
0
    public void VectorCtor()
    {
        var first  = new xyYColor(x: .2, y: .205, luminance: .45445);
        var vector = new[] { .2, .205, .45445 };
        var second = new xyYColor(vector);

        CustomAssert.EqualsWithHashCode(first, second);
        Assert.Equal(vector, second.Vector);
    }
Esempio n. 12
0
    public void VectorCtor()
    {
        var first  = new xyChromaticity(x: .1, y: .205);
        var vector = new[] { .1, .205 };
        var second = new xyChromaticity(vector);

        CustomAssert.EqualsWithHashCode(first, second);
        Assert.Equal(vector, second.Vector);
    }
Esempio n. 13
0
    public void FromSaturationCtor()
    {
        var          first      = new LChabColor(l: 10, c: 3, h: 20);
        const double saturation = 30d;
        var          second     = LChabColor.FromSaturation(lightness: 10, hue: 20, saturation);

        CustomAssert.EqualsWithHashCode(first, second);
        Assert.Equal(saturation, second.Saturation);
    }
Esempio n. 14
0
    public void VectorCtor()
    {
        var first  = new JzazbzColor(jz: 0.6, az: -0.3, bz: 0.01);
        var vector = new[] { 0.6, -0.3, 0.01 };
        var second = new JzazbzColor(vector);

        CustomAssert.EqualsWithHashCode(first, second);
        Assert.Equal(vector, second.Vector);
    }
Esempio n. 15
0
    public void VectorCtor()
    {
        var first  = new LuvColor(l: 10, u: 20.5, v: 45.445);
        var vector = new[] { 10, 20.5, 45.445 };
        var second = new LuvColor(vector);

        CustomAssert.EqualsWithHashCode(first, second);
        Assert.Equal(vector, second.Vector);
    }
Esempio n. 16
0
    public void VectorCtor()
    {
        var first  = new JzCzhzColor(jz: 0.6, cz: 0.3, hz: 150);
        var vector = new[] { 0.6, 0.3, 150 };
        var second = new JzCzhzColor(vector);

        CustomAssert.EqualsWithHashCode(first, second);
        Assert.Equal(vector, second.Vector);
    }
Esempio n. 17
0
    public void ComplexCompandingEqualityTest()
    {
        var compandings1 = new List <ICompanding>
        {
            new LCompanding(),
            new Rec2020Companding(),
            new Rec709Companding(),
            new sRGBCompanding(),
            new GammaCompanding(gamma: 2.0),
            new GammaCompanding(gamma: 3.0),
        };

        // same as above, separate instances
        var compandings2 = new List <ICompanding>
        {
            new LCompanding(),
            new Rec2020Companding(),
            new Rec709Companding(),
            new sRGBCompanding(),
            new GammaCompanding(gamma: 2.0),
            new GammaCompanding(gamma: 3.0),
        };

        // check that same are the same and different are different
        for (var i = 0; i < compandings1.Count; i++)
        {
            var c1 = compandings1[i];

            for (var j = 0; j < compandings2.Count; j++)
            {
                var c2 = compandings2[j];

                if (i == j)
                {
                    CustomAssert.EqualsWithHashCode(c1, c2);
                }
                else
                {
                    CustomAssert.NotEqualsWithHashCode(c1, c2);
                }
            }

            CustomAssert.NotEqualsWithHashCode(c1, (ICompanding)null);
        }
    }
Esempio n. 18
0
    public void ComplexRGBWorkingSpaceEqualityTest()
    {
        var spaces1 = new List <IRGBWorkingSpace>
        {
            sRGB,
            sRGBSimplified,
            Rec709,
            Rec2020,
            ECIRGBv2,
            AdobeRGB1998,
            ApplesRGB,
            BestRGB,
            BetaRGB,
            BruceRGB,
            CIERGB,
            ColorMatchRGB,
            DonRGB4,
            EktaSpacePS5,
            NTSCRGB,
            PALSECAMRGB,
            ProPhotoRGB,
            SMPTECRGB,
            WideGamutRGB,
            new RGBWorkingSpace(Illuminants.C, new GammaCompanding(15.77), new RGBPrimaries(new xyChromaticity(1, 2), new xyChromaticity(3, 4), new xyChromaticity(5, 6))),
        };

        // same as above (separate instance where non-static)
        var spaces2 = new List <IRGBWorkingSpace>
        {
            sRGB,
            sRGBSimplified,
            Rec709,
            Rec2020,
            ECIRGBv2,
            AdobeRGB1998,
            ApplesRGB,
            BestRGB,
            BetaRGB,
            BruceRGB,
            CIERGB,
            ColorMatchRGB,
            DonRGB4,
            EktaSpacePS5,
            NTSCRGB,
            PALSECAMRGB,
            ProPhotoRGB,
            SMPTECRGB,
            WideGamutRGB,
            new RGBWorkingSpace(Illuminants.C, new GammaCompanding(15.77), new RGBPrimaries(new xyChromaticity(1, 2), new xyChromaticity(3, 4), new xyChromaticity(5, 6))),
        };

        // check that same are the same and different are different
        for (var i = 0; i < spaces1.Count; i++)
        {
            var s1 = spaces1[i];

            for (var j = 0; j < spaces2.Count; j++)
            {
                var s2 = spaces2[j];

                if (i == j)
                {
                    CustomAssert.EqualsWithHashCode(s1, s2);
                }
                else
                {
                    CustomAssert.NotEqualsWithHashCode(s1, s2);
                }
            }

            CustomAssert.NotEqualsWithHashCode(s1, (IRGBWorkingSpace)null);
        }
    }