Exemplo n.º 1
0
        public void Identify_DetectsCorrectComponentType(string imagePath, PbmComponentType expectedComponentType)
        {
            var testFile = TestFile.Create(imagePath);

            using var stream = new MemoryStream(testFile.Bytes, false);
            IImageInfo imageInfo = Image.Identify(stream);

            Assert.NotNull(imageInfo);
            PbmMetadata bitmapMetadata = imageInfo.Metadata.GetPbmMetadata();

            Assert.NotNull(bitmapMetadata);
            Assert.Equal(expectedComponentType, bitmapMetadata.ComponentType);
        }
Exemplo n.º 2
0
        public void CloneIsDeep()
        {
            var meta = new PbmMetadata {
                ColorType = PbmColorType.Grayscale
            };
            var clone = (PbmMetadata)meta.DeepClone();

            clone.ColorType     = PbmColorType.Rgb;
            clone.ComponentType = PbmComponentType.Short;

            Assert.False(meta.ColorType.Equals(clone.ColorType));
            Assert.False(meta.ComponentType.Equals(clone.ComponentType));
        }
Exemplo n.º 3
0
        public void ImageLoadCanDecode(string imagePath, PbmColorType expectedColorType, PbmComponentType expectedComponentType)
        {
            // Arrange
            var testFile = TestFile.Create(imagePath);

            using var stream = new MemoryStream(testFile.Bytes, false);

            // Act
            using var image = Image.Load(stream);

            // Assert
            Assert.NotNull(image);
            PbmMetadata metadata = image.Metadata.GetPbmMetadata();

            Assert.NotNull(metadata);
            Assert.Equal(expectedColorType, metadata.ColorType);
            Assert.Equal(expectedComponentType, metadata.ComponentType);
        }