|
4 | 4 | using System.Runtime.Intrinsics.X86;
|
5 | 5 | using SixLabors.ImageSharp.Formats;
|
6 | 6 | using SixLabors.ImageSharp.Formats.Webp;
|
| 7 | +using SixLabors.ImageSharp.Metadata; |
7 | 8 | using SixLabors.ImageSharp.PixelFormats;
|
8 | 9 | using SixLabors.ImageSharp.Tests.TestUtilities;
|
9 | 10 | using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
|
@@ -493,4 +494,32 @@ private static void RunDecodeLossyWithComplexFilterTest()
|
493 | 494 |
|
494 | 495 | [Fact]
|
495 | 496 | public void DecodeLossyWithComplexFilterTest_WithoutHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunDecodeLossyWithComplexFilterTest, HwIntrinsics.DisableHWIntrinsic);
|
| 497 | + |
| 498 | + [Theory] |
| 499 | + [InlineData(Lossy.BikeWithExif)] |
| 500 | + public void Decode_VerifyRatio(string imagePath) |
| 501 | + { |
| 502 | + TestFile testFile = TestFile.Create(imagePath); |
| 503 | + using MemoryStream stream = new(testFile.Bytes, false); |
| 504 | + using Image image = WebpDecoder.Instance.Decode(DecoderOptions.Default, stream); |
| 505 | + ImageMetadata meta = image.Metadata; |
| 506 | + |
| 507 | + Assert.Equal(37.8, meta.HorizontalResolution); |
| 508 | + Assert.Equal(37.8, meta.VerticalResolution); |
| 509 | + Assert.Equal(PixelResolutionUnit.PixelsPerCentimeter, meta.ResolutionUnits); |
| 510 | + } |
| 511 | + |
| 512 | + [Theory] |
| 513 | + [InlineData(Lossy.BikeWithExif)] |
| 514 | + public void Identify_VerifyRatio(string imagePath) |
| 515 | + { |
| 516 | + TestFile testFile = TestFile.Create(imagePath); |
| 517 | + using MemoryStream stream = new(testFile.Bytes, false); |
| 518 | + ImageInfo image = WebpDecoder.Instance.Identify(DecoderOptions.Default, stream); |
| 519 | + ImageMetadata meta = image.Metadata; |
| 520 | + |
| 521 | + Assert.Equal(37.8, meta.HorizontalResolution); |
| 522 | + Assert.Equal(37.8, meta.VerticalResolution); |
| 523 | + Assert.Equal(PixelResolutionUnit.PixelsPerCentimeter, meta.ResolutionUnits); |
| 524 | + } |
496 | 525 | }
|
0 commit comments