<#@ template debug="false" hostspecific="false" language="C#" #> <#@ assembly name="System.Core" #> <#@ import namespace="System.Linq" #> <#@ import namespace="System.Text" #> <#@ import namespace="System.Collections.Generic" #> // Copyright (c) Six Labors. // Licensed under the Six Labors Split License. // using SixLabors.ImageSharp.PixelFormats; using Xunit; using Xunit.Abstractions; <#+ private static readonly string[] UnassociatedAlphaPixelTypes = [ "A8", "Argb32", "Abgr32", "Bgra32", "Bgra4444", "Bgra5551", "Byte4", "HalfVector4", "La16", "La32", "NormalizedByte4", "NormalizedShort4", "Rgba1010102", "Rgba32", "Rgba64", "RgbaVector", "Short4" ]; private static readonly string[] AssociatedAlphaPixelTypes = []; private static readonly string[] CommonPixelTypes = [ "A8", "Argb32", "Abgr32", "Bgr24", "Bgr565", "Bgra32", "Bgra4444", "Bgra5551", "Byte4", "HalfSingle", "HalfVector2", "HalfVector4", "L16", "L8", "La16", "La32", "NormalizedByte2", "NormalizedByte4", "NormalizedShort2", "NormalizedShort4", "Rg32", "Rgb24", "Rgb48", "Rgba1010102", "Rgba32", "Rgba64", "RgbaVector", "Short2", "Short4" ]; void GenerateSpecializedClass(string pixelType, string alpha) {#> public partial class <#=pixelType#>_OperationsTests : PixelOperationsTests<<#=pixelType#>> { public <#=pixelType#>_OperationsTests(ITestOutputHelper output) : base(output) { } [Fact] public void PixelTypeInfoHasCorrectAlphaRepresentation() { var alphaRepresentation = <#=pixelType#>.GetPixelTypeInfo().AlphaRepresentation; Assert.Equal(<#=alpha#>, alphaRepresentation); } } <#+ } void GenerateAllSpecializedClasses() { foreach (string pixelType in CommonPixelTypes) { string alpha = "PixelAlphaRepresentation.None"; if (AssociatedAlphaPixelTypes.Contains(pixelType)) { alpha = "PixelAlphaRepresentation.Associated"; } else if (UnassociatedAlphaPixelTypes.Contains(pixelType)) { alpha = "PixelAlphaRepresentation.Unassociated"; } GenerateSpecializedClass(pixelType, alpha); } } #>