public void Parse_ThumbnailData() { var dir = new ExifThumbnailDirectory(); dir.Set(ExifThumbnailDirectory.TagThumbnailOffset, 0); dir.Set(ExifThumbnailDirectory.TagThumbnailLength, 2); var segment = new JpegSegment(JpegSegmentType.App1, new byte[] { (byte)'E', (byte)'x', (byte)'i', (byte)'f', (byte)'\0', (byte)'\0', 0x12, 0x23, 0x34 }, 0); var metadata = new Mock <IExifMetadata>(); metadata.Setup(mock => mock.Segment).Returns(segment); metadata.Setup(mock => mock.GetDirectoryOfType <ExifDirectoryBase>()).Returns(dir); var parser = new ThumbnaiExifAttributeParser <ExifDirectoryBase>("thumbnail"); var thumbnail = parser.Parse(metadata.Object).Value as ImageValue; CollectionAssert.AreEqual(new byte[] { 0x12, 0x23 }, thumbnail.Value); }
public void GetYCbCrSubsamplingDescription() { var directory = new ExifThumbnailDirectory(); var descriptor = new ExifThumbnailDescriptor(directory); directory.Set(ExifDirectoryBase.TagYCbCrSubsampling, new[] { 2, 1 }); Assert.Equal("YCbCr4:2:2", descriptor.GetDescription(ExifDirectoryBase.TagYCbCrSubsampling)); Assert.Equal("YCbCr4:2:2", descriptor.GetYCbCrSubsamplingDescription()); directory.Set(ExifDirectoryBase.TagYCbCrSubsampling, new[] { 2, 2 }); Assert.Equal("YCbCr4:2:0", descriptor.GetDescription(ExifDirectoryBase.TagYCbCrSubsampling)); Assert.Equal("YCbCr4:2:0", descriptor.GetYCbCrSubsamplingDescription()); }