mirror of https://github.com/SixLabors/ImageSharp
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.
70 lines
2.2 KiB
70 lines
2.2 KiB
// <copyright file="JpegDecoderTests.cs" company="James Jackson-South">
|
|
// Copyright (c) James Jackson-South and contributors.
|
|
// Licensed under the Apache License, Version 2.0.
|
|
// </copyright>
|
|
|
|
// ReSharper disable InconsistentNaming
|
|
namespace ImageSharp.Tests
|
|
{
|
|
using System;
|
|
|
|
using Xunit;
|
|
|
|
public class JpegDecoderTests : TestBase
|
|
{
|
|
public static string[] BaselineTestJpegs =
|
|
{
|
|
TestImages.Jpeg.Baseline.Calliphora, TestImages.Jpeg.Baseline.Cmyk,
|
|
TestImages.Jpeg.Baseline.Jpeg400, TestImages.Jpeg.Baseline.Jpeg444,
|
|
TestImages.Jpeg.Baseline.Testimgorig
|
|
};
|
|
|
|
public static string[] ProgressiveTestJpegs = TestImages.Jpeg.Progressive.All;
|
|
|
|
[Theory]
|
|
[WithFileCollection(nameof(BaselineTestJpegs), PixelTypes.Color | PixelTypes.StandardImageClass | PixelTypes.Argb)]
|
|
public void OpenBaselineJpeg_SaveBmp<TColor>(TestImageProvider<TColor> provider)
|
|
where TColor : struct, IPackedPixel, IEquatable<TColor>
|
|
{
|
|
Image<TColor> image = provider.GetImage();
|
|
|
|
provider.Utility.SaveTestOutputFile(image, "bmp");
|
|
}
|
|
|
|
[Theory]
|
|
[WithFileCollection(nameof(ProgressiveTestJpegs), PixelTypes.Color | PixelTypes.StandardImageClass | PixelTypes.Argb)]
|
|
public void OpenProgressiveJpeg_SaveBmp<TColor>(TestImageProvider<TColor> provider)
|
|
where TColor : struct, IPackedPixel, IEquatable<TColor>
|
|
{
|
|
Image<TColor> image = provider.GetImage();
|
|
|
|
provider.Utility.SaveTestOutputFile(image, "bmp");
|
|
}
|
|
|
|
unsafe struct Buzisag
|
|
{
|
|
public int Value;
|
|
|
|
public delegate void BlockAction(Buzisag* b);
|
|
|
|
public static void Foo(Buzisag* buzisag)
|
|
{
|
|
Bar(buzisag, b => b->Value++);
|
|
}
|
|
|
|
public static void Bar(Buzisag* buzisag, BlockAction action)
|
|
{
|
|
action(buzisag);
|
|
}
|
|
}
|
|
|
|
[Fact]
|
|
public unsafe void Kabbe()
|
|
{
|
|
Buzisag b = default(Buzisag);
|
|
Buzisag.Foo(&b);
|
|
|
|
Assert.Equal(1, b.Value);
|
|
}
|
|
}
|
|
}
|