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.
94 lines
3.7 KiB
94 lines
3.7 KiB
// <copyright file="WithSolidFilledImagesAttribute.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;
|
|
using System.Reflection;
|
|
|
|
/// <summary>
|
|
/// Triggers passing <see cref="TestImageProvider{TPixel}"/> instances which produce an image of size width * height filled with the requested color.
|
|
/// One <see cref="TestImageProvider{TPixel}"/> instance will be passed for each the pixel format defined by the pixelTypes parameter
|
|
/// </summary>
|
|
public class WithSolidFilledImagesAttribute : WithBlankImagesAttribute
|
|
{
|
|
/// <summary>
|
|
/// Triggers passing <see cref="TestImageProvider{TPixel}"/> instances which produce an image of size width * height filled with the requested color.
|
|
/// One <see cref="TestImageProvider{TPixel}"/> instance will be passed for each the pixel format defined by the pixelTypes parameter
|
|
/// </summary>
|
|
/// <param name="width">The width of the requested image</param>
|
|
/// <param name="height">The height of the requested image</param>
|
|
/// <param name="r">Red</param>
|
|
/// <param name="g">Green</param>
|
|
/// <param name="b">Blue</param>
|
|
/// <param name="pixelTypes">The requested pixel types</param>
|
|
/// <param name="additionalParameters">Additional theory parameter values</param>
|
|
public WithSolidFilledImagesAttribute(
|
|
int width,
|
|
int height,
|
|
byte r,
|
|
byte g,
|
|
byte b,
|
|
PixelTypes pixelTypes,
|
|
params object[] additionalParameters)
|
|
: this(width, height, r, g, b, 255, pixelTypes, additionalParameters)
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// Triggers passing <see cref="TestImageProvider{TPixel}"/> instances which produce an image of size width * height filled with the requested color.
|
|
/// One <see cref="TestImageProvider{TPixel}"/> instance will be passed for each the pixel format defined by the pixelTypes parameter
|
|
/// </summary>
|
|
/// <param name="width">The width of the requested image</param>
|
|
/// <param name="height">The height of the requested image</param>
|
|
/// <param name="r">Red</param>
|
|
/// <param name="g">Green</param>
|
|
/// <param name="b">Blue</param>
|
|
/// /// <param name="a">Alpha</param>
|
|
/// <param name="pixelTypes">The requested pixel types</param>
|
|
/// <param name="additionalParameters">Additional theory parameter values</param>
|
|
public WithSolidFilledImagesAttribute(
|
|
int width,
|
|
int height,
|
|
byte r,
|
|
byte g,
|
|
byte b,
|
|
byte a,
|
|
PixelTypes pixelTypes,
|
|
params object[] additionalParameters)
|
|
: base(width, height, pixelTypes, additionalParameters)
|
|
{
|
|
this.R = r;
|
|
this.G = g;
|
|
this.B = b;
|
|
this.A = a;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Red
|
|
/// </summary>
|
|
public byte R { get; }
|
|
|
|
/// <summary>
|
|
/// Green
|
|
/// </summary>
|
|
public byte G { get; }
|
|
|
|
/// <summary>
|
|
/// Blue
|
|
/// </summary>
|
|
public byte B { get; }
|
|
|
|
/// <summary>
|
|
/// Alpha
|
|
/// </summary>
|
|
public byte A { get; }
|
|
|
|
protected override object[] GetFactoryMethodArgs(MethodInfo testMethod, Type factoryType)
|
|
=> new object[] { this.Width, this.Height, this.R, this.G, this.B, this.A };
|
|
|
|
protected override string GetFactoryMethodName(MethodInfo testMethod) => "Solid";
|
|
}
|
|
}
|