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.
29 lines
966 B
29 lines
966 B
// <copyright file="LambdaProvider.cs" company="James Jackson-South">
|
|
// Copyright (c) James Jackson-South and contributors.
|
|
// Licensed under the Apache License, Version 2.0.
|
|
// </copyright>
|
|
|
|
namespace ImageSharp.Tests
|
|
{
|
|
using System;
|
|
|
|
/// <summary>
|
|
/// Provides <see cref="Image{TColor}" /> instances for parametric unit tests.
|
|
/// </summary>
|
|
/// <typeparam name="TColor">The pixel format of the image</typeparam>
|
|
public abstract partial class TestImageProvider<TColor>
|
|
where TColor : struct, IPixel<TColor>
|
|
{
|
|
private class LambdaProvider : TestImageProvider<TColor>
|
|
{
|
|
private readonly Func<GenericFactory<TColor>, Image<TColor>> creator;
|
|
|
|
public LambdaProvider(Func<GenericFactory<TColor>, Image<TColor>> creator)
|
|
{
|
|
this.creator = creator;
|
|
}
|
|
|
|
public override Image<TColor> GetImage() => this.creator(this.Factory);
|
|
}
|
|
}
|
|
}
|