public void ShouldReturnTheCorrectTypeWhenImageHasColorProfile()
 {
     using (var image = HeifImage.Decode(TestFiles.Dog))
     {
         Assert.Equal(HeifColorProfileType.Prof, image.ColorProfileType);
     }
 }
 public void ShouldReturnNotPresentWhenImageHasNoColorProfile()
 {
     using (var image = HeifImage.Decode(TestFiles.C034))
     {
         Assert.Equal(HeifColorProfileType.NotPresent, image.ColorProfileType);
     }
 }
Beispiel #3
0
 public void ShouldBeAbleToDecodeAvifFile()
 {
     using (var image = HeifImage.Decode(TestFiles.Bbb_4k))
     {
         Assert.Equal(3840, image.Metadata.Width);
         Assert.Equal(2160, image.Metadata.Height);
     }
 }
Beispiel #4
0
 public void ShouldLoadTheMetadata()
 {
     using (var image = HeifImage.Decode(TestFiles.Camel))
     {
         Assert.Equal(1596, image.Metadata.Width);
         Assert.Equal(1064, image.Metadata.Height);
     }
 }
Beispiel #5
0
            public void ShouldThrowExceptionWhenFileIsInvalid()
            {
                var data = new byte[] { 42 };

                var exception = Assert.Throws <HeifException>(() => HeifImage.Decode(data));

                Assert.Equal("Unable to create heif context.", exception.Message);
            }
Beispiel #6
0
            public void ShouldReturnNullForImageWithoutRawColorProfile()
            {
                using (var image = HeifImage.Decode(TestFiles.Camel))
                {
                    var profile = image.GetRawColorProfile();

                    Assert.Null(profile);
                }
            }
            public void ShouldReturnTheProfile()
            {
                using (var image = HeifImage.Decode(TestFiles.C034))
                {
                    var profile = image.GetExifProfile();

                    Assert.NotNull(profile);
                    Assert.Equal(176, profile.Length);
                }
            }
            public void ShouldReturnByteArrayWithCorrectSize()
            {
                using (var image = HeifImage.Decode(TestFiles.Camel))
                {
                    var data = image.ToYCbCrByteArray();

                    Assert.NotNull(data);
                    Assert.Equal(1596 * 1064 * 3, data.Length);
                }
            }
Beispiel #9
0
            public void ShouldReturnThePlane(HeifChannel channel, int stride)
            {
                using (var image = HeifImage.Decode(TestFiles.Camel))
                {
                    var plane = image.GetPlane(channel);

                    Assert.Equal(stride, plane.Stride);
                    Assert.NotEqual(IntPtr.Zero, plane.Data);
                }
            }
Beispiel #10
0
            public void ShouldReturnTheProfile()
            {
                using (var image = HeifImage.Decode(TestFiles.Dog))
                {
                    var profile = image.GetRawColorProfile();

                    Assert.NotNull(profile);
                    Assert.Equal(HeifColorProfileType.Prof, profile.Type);
                    Assert.NotNull(profile.Data);
                    Assert.Equal(548, profile.Data.Length);
                }
            }