Class TiledDeltaEAlgorithm
Compares two images tile by tile. Each pixel's deltaE above PerPixelCorrectnessThreshold is averaged within each tile of a TilesPerAxis grid, and the comparison fails when the most different tile exceeds MaxTileDeltaEThreshold, so a difference confined to a small area is not diluted by the rest of the image. It also fails when the same average over the whole image exceeds AverageCorrectnessThreshold, which catches a difference spread evenly across the image that no single tile stands out for.
Inherited Members
Namespace: UnityEngine.TestTools.Graphics
Assembly: UnityEngine.TestTools.Graphics.dll
Syntax
public sealed class TiledDeltaEAlgorithm : TextureComparisonAlgorithm
Constructors
TiledDeltaEAlgorithm(ImageComparisonSettings)
Instantiates the algorithm with the thresholds and grid size from the given settings.
Declaration
public TiledDeltaEAlgorithm(ImageComparisonSettings settings)
Parameters
| Type | Name | Description |
|---|---|---|
| ImageComparisonSettings | settings | The settings to read PerPixelCorrectnessThreshold, AverageCorrectnessThreshold, TilesPerAxis and MaxTileDeltaEThreshold from. No other setting affects the comparison. When null, the default settings are used. |
Methods
Compare(Texture2D, Texture2D)
Compares the two given textures.
Declaration
public override ITextureComparisonResult Compare(Texture2D expected, Texture2D actual)
Parameters
| Type | Name | Description |
|---|---|---|
| Texture2D | expected | The expected texture. It must be readable. |
| Texture2D | actual | The actual texture, the same size and format as the expected one. It must be readable. |
Returns
| Type | Description |
|---|---|
| ITextureComparisonResult |
Overrides
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Either texture is null. |
| ArgumentException | The textures differ in size or format. |
Compare(Texture2D[], Texture2D[])
Comparing arrays of textures is not supported.
Declaration
public override ITextureComparisonResult Compare(Texture2D[] expected, Texture2D[] actual)
Parameters
| Type | Name | Description |
|---|---|---|
| Texture2D[] | expected | Expected textures |
| Texture2D[] | actual | Actual textures |
Returns
| Type | Description |
|---|---|
| ITextureComparisonResult | Nothing: always throws. |
Overrides
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Always. |
CompareAsync(Texture2D, Texture2D)
Asynchronous comparison is not supported.
Declaration
public override Task<ITextureComparisonResult> CompareAsync(Texture2D expected, Texture2D actual)
Parameters
| Type | Name | Description |
|---|---|---|
| Texture2D | expected | The expected texture |
| Texture2D | actual | The actual texture |
Returns
| Type | Description |
|---|---|
| Task<ITextureComparisonResult> | Nothing: always throws. |
Overrides
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | Always. |
DescribeActual(ITextureComparisonResult)
Describes the measured values of a comparison result produced by this algorithm, as named values for structured result reporting. The algorithm owns the keys. Returns null when the algorithm does not provide structured values (or the result is not one of its own); reporting then falls back to the result's ToString().
Declaration
public override IReadOnlyDictionary<string, object> DescribeActual(ITextureComparisonResult result)
Parameters
| Type | Name | Description |
|---|---|---|
| ITextureComparisonResult | result | The result of a comparison run by this algorithm. |
Returns
| Type | Description |
|---|---|
| IReadOnlyDictionary<string, object> | The measured values as named values, or null. |
Overrides
DescribeExpected()
Describes the thresholds this algorithm compares against, as named values for structured result reporting. The algorithm owns the keys. Returns null when the algorithm does not provide structured values; reporting then falls back to Description.
Declaration
public override IReadOnlyDictionary<string, object> DescribeExpected()
Returns
| Type | Description |
|---|---|
| IReadOnlyDictionary<string, object> | The configured thresholds as named values, or null. |
Overrides
Evaluate(ITextureComparisonResult)
Evaluates a result of this algorithm, for use with the NUnit texture constraint.
Declaration
public override (object, bool) Evaluate(ITextureComparisonResult result)
Parameters
| Type | Name | Description |
|---|---|---|
| ITextureComparisonResult | result | The result of the comparison |
Returns
| Type | Description |
|---|---|
| (object, bool) | The result, and whether the comparison passed |
Overrides
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | The result was not produced by this algorithm. |