📷 A modern, cross-platform, 2D Graphics library for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

43 lines
1.6 KiB

// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System.IO;
using Xunit;
// ReSharper disable InconsistentNaming
namespace SixLabors.ImageSharp.Tests.Formats.WebP
{
using SixLabors.ImageSharp.Metadata;
using static SixLabors.ImageSharp.Tests.TestImages.WebP;
using static TestImages.Bmp;
public class WebPDecoderTests
{
public static readonly TheoryData<string, int, int, PixelResolutionUnit> RatioFiles =
new TheoryData<string, int, int, PixelResolutionUnit>
{
{ Car, 3780, 3780 , PixelResolutionUnit.PixelsPerMeter },
{ V5Header, 3780, 3780 , PixelResolutionUnit.PixelsPerMeter },
{ RLE8, 2835, 2835, PixelResolutionUnit.PixelsPerMeter }
};
[Theory]
[InlineData(Lossless.Lossless1, 1000, 307)]
[InlineData(Lossless.Lossless2, 1000, 307)]
[InlineData(Lossy.Alpha.LossyAlpha1, 1000, 307)]
[InlineData(Lossy.Alpha.LossyAlpha2, 1000, 307)]
[InlineData(Animated.Animated1, 400, 400)]
public void Identify_DetectsCorrectDimensions(string imagePath, int expectedWidth, int expectedHeight)
{
var testFile = TestFile.Create(imagePath);
using (var stream = new MemoryStream(testFile.Bytes, false))
{
IImageInfo imageInfo = Image.Identify(stream);
Assert.NotNull(imageInfo);
Assert.Equal(expectedWidth, imageInfo.Width);
Assert.Equal(expectedHeight, imageInfo.Height);
}
}
}
}