Ejemplo n.º 1
0
        public void TestEnum()
        {
            // the Interpretation enum is created when the first image is made --
            // make it ourselves in case we are run before the first image
            NetVips.VipsInterpretationGetType();
            var gtype = NetVips.TypeFromName("VipsInterpretation");

            string actual;

            using (var gv = new GValue())
            {
                gv.SetType(gtype);
                gv.Set("xyz");
                actual = (string)gv.Get();
            }

            Assert.Equal("xyz", actual);
        }
Ejemplo n.º 2
0
        public void TestFlags()
        {
            // the OperationFlags enum is created when the first op is made --
            // make it ourselves in case we are run before that
            NetVips.VipsOperationFlagsGetType();
            var gtype = NetVips.TypeFromName("VipsOperationFlags");

            uint actual;

            using (var gv = new GValue())
            {
                gv.SetType(gtype);
                gv.Set(12u);
                actual = (uint)gv.Get();
            }

            Assert.Equal(12u, actual);
        }
Ejemplo n.º 3
0
        public void TestArrayImage()
        {
            var images = Image.NewFromFile(Helper.JpegFile).Bandsplit();

            Image[] actualImages;
            using (var gv = new GValue())
            {
                gv.SetType(GValue.ArrayImageType);
                gv.Set(images);
                actualImages = (Image[])gv.Get();
            }

            for (var i = 0; i < actualImages.Length; i++)
            {
                var actual   = actualImages[i];
                var expected = images[i];

                Assert.Equal(expected, actual);
            }
        }