Exemplo n.º 1
0
        public void Lab()
        {
            var whitepoint = new nfloat [] { 1, 2, 3 };
            var blackpoint = new nfloat [] { 3, 2, 1 };
            var range      = new nfloat [] { 1, 2, 3, 4 };

            Assert.Throws <ArgumentNullException> (() => CGColorSpace.CreateLab(null, blackpoint, range), "null whitepoint");
            Assert.Throws <ArgumentException> (() => CGColorSpace.CreateLab(new nfloat [0], blackpoint, range), "invalid whitepoint0");
            Assert.Throws <ArgumentException> (() => CGColorSpace.CreateLab(new nfloat [4], blackpoint, range), "invalid whitepoint4");

            Assert.Throws <ArgumentException> (() => CGColorSpace.CreateLab(whitepoint, new nfloat [0], range), "invalid blackpoint0");
            Assert.Throws <ArgumentException> (() => CGColorSpace.CreateLab(whitepoint, new nfloat [4], range), "invalid blackpoint4");

            Assert.Throws <ArgumentException> (() => CGColorSpace.CreateLab(whitepoint, blackpoint, new nfloat [0]), "invalid range0");
            Assert.Throws <ArgumentException> (() => CGColorSpace.CreateLab(whitepoint, blackpoint, new nfloat [3]), "invalid range3");

            using (var space = CGColorSpace.CreateLab(whitepoint, blackpoint, range)) {
                Assert.IsNotNull(space, "all non-null");
            }

            using (var space = CGColorSpace.CreateLab(whitepoint, null, range)) {
                Assert.IsNotNull(space, "null blackpoint");
            }

            using (var space = CGColorSpace.CreateLab(whitepoint, blackpoint, null)) {
                Assert.IsNotNull(space, "null gamma");
            }

            using (var space = CGColorSpace.CreateLab(whitepoint, null, null)) {
                Assert.IsNotNull(space, "all null");
            }
        }